[squeak-dev] modifying instance variable allocation

Marcel Taeumel marcel.taeumel at hpi.de
Mon May 2 12:23:59 UTC 2022

It would be interesting to see a compiler (configuration) where you could disable some optimized byte codes to then generate the sends instead. Scoped per class just like #compilerClass already does. Maybe via #compilerPreferences to make it more user-friendly?

MySpecialObject class >> #compilerPreferences

   ^ #(
      fastInstVarAccess false
      fastClassAccess false "#class"
      fastConditionals false "#ifTrue: #ifFalse: #ifNil: #ifNotNil:"
      fastIntervalEnumeration false "#to:do:"
      ... )

Anyway, I presume that no such configurable option exists in Compiler/Encoder yet?

Am 02.05.2022 07:42:41 schrieb Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>:
Hi Lauren,
Indeed, the VM is cheating, and for obvious efficiency reasons don't send the message instVarAt:. You would need to define a specific Compiler to encode the inst var access with other bytecode sequences.

Le lun. 2 mai 2022, 03:08, Lauren Pullen <drurowin at gmail.com [mailto:drurowin at gmail.com]> a écrit :

Hi list,

I'm trying to make an object that has special instance variable
allocation methods by overriding #instVarAt: and #instVarAt:put:, but it
isn't working.

In an inspector, the fields are presented as expected, but the
#pushRcvr: and #popIntoRcvr: bytecodes seem to use the basic behavior.

#instVarAt: and #instVarAt:put: aren't labeled 'No lookup.' like #== is,
but the VM bytecode evaluator doesn't use them for instance variable
access so the overridden the new behavior only works in the simulator...
which includes everything from inspectors to fileIn/Out and bytecode

Is this something you can do? or are you required to use custom getter
and setter methods?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20220502/e68e401c/attachment.html>

More information about the Squeak-dev mailing list