[webkit-dev] Unnecessary instructions in bytecode

Oliver Hunt oliver at apple.com
Fri May 23 05:10:38 PDT 2008


For the same piece of code, but in a function (so there is no implied  
return value) the generated code is:
[   0] load		 lr1, undefined(@k0)		
[   3] load		 lr2, undefined(@k0)		
[   6] load		 lr1, 5(@k1)		
[   9] mul		 tr0, lr1, lr1
[  13] add		 lr2, tr0, lr1
[  17] load		 tr0, undefined(@k0)		
[  20] ret		 tr0

Which is marginally better, although it would be preferable if we  
could remove the unnecessary initialisation of lr1 and lr2

--Oliver

On May 23, 2008, at 5:05 AM, Oliver Hunt wrote:

> Hi Gabor,
>   Without actually know which instructions you think are unnecessary  
> this is difficult to answer, but i'll see if i can guess which  
> you're interested in
>
>> 9 instructions; 224 bytes at 0x69ca30; 2 locals (0 parameters); 2  
>> temporaries
>>
>> [   0] load		 lr6, undefined(@k0)		
>> [   3] load		 lr7, undefined(@k0)
>
> Technically we should be able to determine which of these loads are  
> actually necessary (eg. neither of them), but we currently don't  
> perform any data flow analysis so can't.
>>
>> [   6] load		 tr0, undefined(@k0)
>
>> ...
>> [  12] mov		 tr0, lr6
>> ...
>> [  23] mov		 tr0, lr7
>> [  26] end		 tr0
> These repeated moves into tr0 are to handle the implied return value  
> of global (and eval) code.  Once again we should be able to remove  
> these, but currently do not perform enough analysis to work that out
>>
>> These instructions are unnecessary, aren't they?
>> Or is there a technical explanation of them?
>
> Not all of them are necessary, it's just easier for global/eval code  
> to be less efficient at the moment -- with sufficient work we could  
> get rid of the redundant stores, but currently there are other much  
> lower hanging fruit to work on (there are still optimisations that  
> we had added to the ast interpreter that aren't in squirrelfish) :D
>
> Hope this helps,
>   Oliver
>
>> --Gabor
>>
>> _______________________________________________
>> webkit-dev mailing list
>> webkit-dev at lists.webkit.org
>> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.webkit.org/pipermail/webkit-dev/attachments/20080523/3cc31627/attachment.htm 


More information about the webkit-dev mailing list