Class-based dynamic languages on Truffle OSM

Raffaello Giulietti raffaello.giulietti at
Sun Nov 9 19:26:41 UTC 2014


thanks for referring to the work of Stefan, I'm already in contact with him.

Yes, the design I would like to realize, after a look at TruffleSOM to 
learn about Stefan's way, is to speculate on the type of the instance 
variables (fields) as to distinguish between primitive values like small 
integers and doubles and true references, as otherwise values would need 
to be boxed. So where traditional Smalltalk implementations use tagging, 
speculating on the type would be beneficial, as the paper points out.


On 2014-11-09 19:25, Thomas Wuerthinger wrote:
> Raffaello,
> Languages are free to chose their own way of implementing the object
> layout when using Truffle. The paper describes one specific technique
> that has shown to be good for objects of dynamic size and shape.
> In case of fixed size objects, one might still want to speculate on the
> types of fields. This can be beneficial even in case of static languages
> like Java, because the provided static type of a field is only a
> conservative estimate of the actual type of values stored in the field
> at run time. Stefan Marr’s TruffleSOM
> ( is an example implementation of
> Smalltalk using Truffle.
> Regards, thomas
> On 09 Nov 2014, at 18:26, Raffaello Giulietti
> <raffaello.giulietti at <mailto:raffaello.giulietti at>> wrote:
>> I recently read the very interesting Truffle OSM paper
>> (
>> If my understanding is correct, the paper proposes to treat all guest
>> language (g-lang) objects as instances of a *single* Java subclass of
>> StorageObject, like the exemplar JSObject.
>> While this one-size-fits-all approach might be ideal for
>> prototype-based or open-ended class-based g-langs, where instances can
>> grow as new properties are added at runtime, I wonder if it is ideal
>> for those dynamic g-langs where the set of instance variables (fields)
>> is fixed at class definition time, like in Smalltalk.
>> I'm not sure if my understanding is correct or if Truffle/Graal's
>> magic is able to optimize the size and the shape of objects along
>> their way from birth to death. This would be wonderful!
>> Any clarifications, even technically detailed ones, would be welcome.
>> Thanks in advance
>> Raffaello Giulietti

More information about the graal-dev mailing list