Class-based dynamic languages on Truffle OSM

Raffaello Giulietti raffaello.giulietti at
Mon Nov 10 16:46:02 UTC 2014

Is there any hope that the Graal VM will someday be able to optimize the 
layout (quantity/type of fields) of the objects and inline the 
extensions arrays in the objects once it sees a stable shape? And to 
de-optimize it when needed?


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