On 19 Feb 2015, at 10:45, Marcus Denker <marcus.denker@inria.fr> wrote:
-> generate better byte code, the reflective read is of course slow.
this is easy. What we need to do is to override #emitValue: and #emitStore:
emitValue: methodBuilder
methodBuilder pushInstVar: baseSlot index; pushLiteral: self name; pushLiteral: nil; send: #at:ifAbsent:
for storing, the problem is that the value to be saved is on top of the stack. so we need to first save it and pop it off to be able to use #at:put::
emitStore: methodBuilder | tempName |
tempName := ('0generated_',self name) asSymbol.
methodBuilder addTemp: tempName; storeTemp: tempName; popTop; pushInstVar: baseSlot index; pushLiteral: self name; pushTemp: tempName; send: #at:put:
committed. https://pharo.fogbugz.com/f/cases/14962/emit-bytecode-for-PropertySlot-impro... This in addition uses the same trick of the temp to not need a writeToSlot:of: method in object for the default code generated for reflective write of slots. Marcus