[fpc-devel] creating call nodes for managed operators

Hairy Pixels genericptr at gmail.com
Sun Jul 23 16:35:06 CEST 2023



> On Jul 23, 2023, at 7:13 AM, Benito van der Zander via fpc-devel <fpc-devel at lists.freepascal.org> wrote:
> 
> with my patch, "copy" can be inlined! 
> initialize and finalize some times, too.

Amazing!

> 
> There are two places that call them. compiler/nld.pas and compiler/ngenutil.pas where it creates the call nodes. There my patch turns them into ordinary function calls, which can be inlined like any other function call.

This is the "old way" you describe. Why did they do it like this instead of normal function calls which could be inlined? I suspect one of the compiler devs needs to explain this because there may be a reason.

> Then there is compiler/hlcgobj.pas, which calls initialize/finalize for local or temporary variables. That appears to happen after the inlining is done.  Perhaps it needs to do the inlining first to know which variables are there, and afterwards it could not change them anymore.

So the inlining caused extra init/finalize calls? That's not good for sure. There's already a problem with an extra copy operator being called on temporary memory which can make or break the feature entirely depending on your usage.

Regards,
Ryan Joseph



More information about the fpc-devel mailing list