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

Sergei Gorelkin sergei_gorelkin at mail.ru
Sat Dec 8 16:57:11 CET 2007


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).

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

Sergei
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: psub.diff
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20071208/49ebcb47/attachment.ksh>


More information about the fpc-devel mailing list