Object Storage Model: has anybody real-world experience?

Raffaello Giulietti raffaello.giulietti at supsi.ch
Wed Mar 16 13:21:34 UTC 2016


Hi Stefan,

On 2016-03-16 13:04, Stefan Marr wrote:
> Hi Raffaello:
>
>> On 16 Mar 2016, at 12:30, Raffaello Giulietti <raffaello.giulietti at supsi.ch> wrote:
>>
>> I’m wondering if it has been used even in such class-based dynamic languages like Smalltalk and Newspeak, where objects have a fixed size of (named) dynamically typed instance variables but where the full flexibility of the model might perhaps be an overkill.
>
> Yes, I used it for SOM Smalltalk: https://github.com/smarr/TruffleSOM/tree/truffle-object-model/
> It can have benefits there as well.
>

OK, I'll give it a look.



> Imagine a very specific use case, a simply linked list implemented in the standard library.
> The class that implements the elements of such a list is typically used to store a wide range of different types.
> So, if you decouple the object model from a class, you could allow for specialization of that list element for integers as well as doubles.
>
> This could be a benefit. However, I am not sure how common that actually would be.
>

I guess OrderedCollection is much more used.

More generally, to implement large contiguous heterogeneous collections 
in dynamically typed languages the OSM does not seem to be of great 
help: for the elements, one either has to resort to boxed primitives 
here and there or has to maintain two equally sized (large) Java arrays, 
one for potential primitives and one for potential objects. Or implement 
more complex and slower "strategies" to maintain mixed-mode cases.



> In SOMns, i.e., Newspeak, I did not implement the Truffle object model yet, because I got a very similar custom object model (still from my SOM Smalltalk), and in Newspeak, I actually need another version of it for not objects, but classes, because of the inner class semantics.
>

As far as I remember, classes in Newspeak are very light-weight objects 
of predictable shape: not sure if they need the flexibility of the OSM. 
(Many years ago, long before Graal/Truffle, I tried to implement 
Newspeak on the JVM with the then upcoming invokedynamic instruction on 
early-access JDK7 platforms but had to gave up to preserve my nerves.)



Greetings
Raffaello



More information about the graal-dev mailing list