Hi All,�� �� just stumbled across a bytecode compiler bug that's in both the Squeak compiler and the Opal compiler.�� I'm told by Cl��ment that Opal mimics the bug to avoid crashing legacy code.�� So there may be places that depend on this bug.�� It would be good to eliminate the dependencies and the bug.For illustration look at the to:do: loop in the ifNil: arm in Context>>privRefresh:Context>>privRefresh"Reinitialize the receiver so that it is in the state it was at its creation."closureOrNilifNotNil:[pc := closureOrNil startpc.self stackp: closureOrNil numArgs + closureOrNil numCopiedValues.1 to: closureOrNil numCopiedValues do:[:i | self tempAt: closureOrNil numArgs + i put: (closureOrNil at: i)]]ifNil:[pc := method initialPC.self stackp: method numTemps.method numArgs+1 to: method numTemps do:[:i | self tempAt: i put: nil]]This should evaluate method numArgs + 1 then method numTemps.�� If it were written as a non-in-lined (method numArgs+1 to: method numTemps) do: [:i| self tempAt: i put: nil] then the [self tempAt: i put: nil] block would be created next.�� But the bytecode for the inlined version isself stackp: method numTemps.63 <70> self64 <84 40 03> pushRcvr: 367 <D6> send: numTemps68 <E1> send: stackp:69 <87> popiLimit := method numTemps70 <84 40 03> pushRcvr: 373 <D6> send: numTemps74 <69> popIntoTemp: 1i := method numArgs + 175 <84 40 03> pushRcvr: 378 <D2> send: numArgs79 <76> pushConstant: 180 <B0> send: +81 <81 40> storeIntoTemp: 0 (squeak)��<69> popIntoTemp: 1 (pharo)83 <10> pushTemp: 084 <11> pushTemp: 185 <B4> send: <=86 <AC 0B> jumpFalse: 99There is a second bug in the Squeak bytecode; storeIntoTemp: is used to load i whereas it should be popIntoTemp:.�� It was this second bug that alerted me to the order-of-evaluation bug.
_,,,^..^,,,_best,��Eliot