From MethodProperties to Pragmas

Marcus Denker denker at
Fri Jan 20 12:50:37 UTC 2006

Hi Lukas,

I will have a look.

But one thing is *essential* for me: I need an interface for storing  
in compiledMethods, things that do not appear textually as pragmas but
that you would normally do with intance variables (if Squeak would
allow them...).

e.g. I want to be able to cache the name of a method (for a fast  
#who) and bytesurgeon
needs space to store a lot of information like original unmodified  
number of temps, things like that. For all sorts of experiments this  
is essential.

I will check how to merge those two things. e.g. why not keep the  
idea of properties and
put the Pragmas into a property? Empty pragmas should take no space  
here, too. Of cource
non-empty ones would be a bit less efficient, as they would mean to  
have a PropertyDict and
the collection of Pragmas.

And then of course we should make CompiledMethods to be real objects  
at some point.
Tim's changeset now is over 8 years old, I think...


On 20.01.2006, at 12:38, Lukas Renggli wrote:

> Hi,
> I changed the implementation of the class MethodProperty to match the
> one of the pragma-framework found in VisualWorks. MethodProperties in
> Squeak only provided a small subset of the functionality available in
> VisualWorks and with a completely different interface. I am in favour
> -- if they are available and make sense -- not to introduce yet
> another concept, but stick to 'standards'.
> What I did:
> - MethodProperty was renamed to 'Pragma', it provides the same
> protocol as the class in VisualWorks, however it is implemented
> slightly different.
> - The Squeak Parser was changed to deal with all kind of pragmas, such
> as <foo>, <foo: nil>, <foo: -1 bar: 'zork'>, etc; MethodProperties
> only supported the one argument form <foo: #bar>. Primitives are also
> parsed as Pragmas, what has the nice side-effect that one can look for
> all senders of #primitive: and #primitve:module:. Unfortunately the
> FFI package introduces a very ugly hack to define its external
> functions. External functions are parsed the same way as before;
> however I feel the need to change that, so that the FFI package does
> not need to patch the parser anymore.
> - CompiledMethod efficiently stores the pragmas within the literal
> frame as implemented by Marcus Denker. The new implementation takes
> care not to waste memory: methods without pragmas have the
> literal-slot set to nil, methods with pragmas store an array of Pragma
> instances. There is no dictionary required.
> - The parser of the submitted version does not implement the mechanism
> of VisualWorks to force the use to declare the pragmas he is using
> with <pragmas: #class> and <pragmas: #instance>. If requested I can
> submit an enhanced version that provides this feature.
> - The Pragma class implements a complete protocol to efficiently find
> pragmas in classes and class-hierarchies.
> - All the parts of the implementation are heavily testsed in the class
> PragmaTest (25 run, 25 passes, 0 expected failures, 0 failures, 0
> errors, 0 unexpected passes).
> To load the code you have to file-in the attached change-set, it is a
> hand-modified one to make sure everything is done in the right order.
> At the end it will recompile the image and all PragmaTests should
> pass. I tested it on the latest Squeak3.9a-6715.
> Lukas
> --
> Lukas Renggli
> <Pragma.cs>

More information about the V3dot9 mailing list