[fpc-devel] (patch) An attempt to improve assignments/function	result reuse
    Sergei Gorelkin 
    sergei_gorelkin at mail.ru
       
    Sat Dec  8 18:30:39 CET 2007
    
    
  
Florian Klaempfl wrote:
> 
> Are you sure with the strings?
Yes. Any function that returns a string is supplied with one more 
argument than it was declared. After calling the function, register eax 
(which is used to contain the non-parameter result) is not used.
Here is a simple example:
function TDOMCharacterData.GetNodeValue: DOMString;
begin
   Result := FNodeValue;
end;
push  ebx
push  esi
mov   esi, edx        <- address of result
mov   ebx, eax        <- Self
mov   eax, esi
mov   edx, [ebx+14]   <- FNodeValue
call  @WStrAsg
pop   esi
pop   ebx
ret
Sergei
    
    
More information about the fpc-devel
mailing list