Object Storage Model: has anybody real-world experience?

Stefan Marr java at stefan-marr.de
Wed Mar 16 21:57:06 UTC 2016

Hi Raffaello:

> On 16 Mar 2016, at 20:29, Raffaello Giulietti <raffaello.giulietti at supsi.ch> wrote:
> I have to think about your solution versus the more intuitive but
> perhaps more naive "class-as-a-triple" alternative.
> Since both the enclosing object and the superclass, and thus the method
> dictionary, are known only at runtime, I would have bet that a triple is
> more appropriate.

Well, this is something that pops up here and there in optimistic optimizations.
So, I’d argue it is actually an interesting thing to discuss here.

The problem with Newspeak is indeed that classes are pure run-time constructs.
To optimize them, you need to find some reoccurring stability. In the case of Newspeak,
I speculate that classes are actually used like in Smalltalk, or Java for that matter.
So, the combination of superclass and mixing gives me a concrete set of methods, and a set of object fields.
And, it turns out at run time, most instantiations of inner classes belong to a group that has the same super class and mixin.

Based on that in SOMns, an object knows not only which class it is of, but also which group it belongs to.
So, if I see that speculating on a class does not work, because a specific point in a program sees to many classes, I fall back to speculate on the class group, which is just as good in terms of performance. It allows me to cache lookups, do inline, etc. Doing that based on the class identity, which is common in other languages like Smalltalk would just not work.

Hope that makes some sense.
So, the general lesson learned here for other optimization issues is: try to find a stable representation of common aspects that can be easily checked for at run time, and then try to speculate on that.

Best regards

More information about the graal-dev mailing list