[fpc-devel] Kit's development progress and research

Jonas Maebe jonas at freepascal.org
Mon Jun 1 12:47:11 CEST 2020


On 01/06/2020 07:57, J. Gareth Moreton wrote:
> Well, I haven't managed to get much of a saving yet, probably due to how
> good FPC's memory manager is as well as the "nf_pass1_done" flag that
> minimises needless parsing of the nodes even when they're copied. 
> Ultimately it's not worth showcasing just yet, although I might be able
> to pick out a couple of things like removing memory leaks, and avoiding
> the use of copying nodes does save on memory, which might be good for
> platforms that are a bit more constrained.

If you use reference counting, how do you handle
1) node.location being different in pass 2 for identical nodes, since
the result of nodes will often end up in different virtual registers
2) cases in the compiler where existing nodes are directly modified.
This is mostly in ncnv, e.g. lines 2509 - 2511

While you are correct that the existing node juggling is error-prone in
terms of memory leaks and other mistakes, I'm afraid reference counting
may make it worse rather than better.


Jonas


More information about the fpc-devel mailing list