[squeak-dev] storePop followed by push is inefficient?

Craig Latta craig at blackpagedigital.com
Mon Jun 6 02:31:44 UTC 2022


      Apologies if this is obvious, or I misunderstood. I notice many 
compiled methods with storePop instructions followed by push 
instructions for the same location. E.g., in the Sista version of 

305 <D7> popIntoTemp: 7
306 <47> pushTemp: 7

      Aren't those two instructions the same as a single storeTemp 
instruction? Even if that optimization were made, would it result in the 
same machine code from cogit anyway, and is that why the optimization 
isn't made at the Smalltalk compiler level? If so, where in cogit can I 
find the optimization? Wouldn't there be less work for cogit to do if it 
could expect this optimization from the Smalltalk compiler?

      If cogit doesn't make this optimization, would system performance 
improve if the Smalltalk compiler did it? I see that well over 10% of 
the methods in the upcoming release would be affected. Is there some 
reason why doing this optimization isn't a good idea? I'm writing a new 
Smalltalk compiler (based on a more straightforward parser) and I'd like 
to try this optimization.



Craig Latta  ::  research computer scientist
Black Page Digital  ::  Berkeley, California
663137D7940BF5C0AFC :: 1349FB2ADA32C4D5314CE

More information about the Squeak-dev mailing list