[fpc-devel] (patch) An attempt to improve assignments/function result reuse

Jonas Maebe jonas.maebe at elis.ugent.be
Sat Dec 8 17:07:28 CET 2007


On 08 Dec 2007, at 16:57, Sergei Gorelkin wrote:

> Jonas Maebe wrote:
>> Thanks, I've applied your patch. I'm also testing a patch for the  
>> function result handling (there was another issue: the fact that  
>> the fake "result" variable is actually implemented as an absolute  
>> variable referring to the actual function result, causing an extra  
>> absolute type conversion node to appear around it), which optimizes  
>> a lot more in general (in the compiler it removes a lot of  
>> unnecessary shortstring copy operations).
>
> Another thought about 'result' came to my mind:
> Whenever the function returns its result in parameter, this  
> parameter is always properly allocated and finalized by the caller.  
> Therefore, the function itself does not need to implicitly finalize  
> its result in case of exception. Am I right? The patch for this  
> seems trivial (see the attachment).

Possibly, yes, I'll look at it.

> The next logical step would be returning all automated types in  
> parameters, which would get rid of quite a pack of implicit  
> finalization code.

And thoroughly break Delphi compatibility at the same time :)  
Especially for assembler routines this could result in quite a few  
problems.


Jonas



More information about the fpc-devel mailing list