Some Review of the EA build
Andrew Haley
aph at redhat.com
Wed Jul 1 11:23:31 UTC 2020
On 30/06/2020 04:38, Johannes Kuhn wrote:
> Looks very WIP-ish.
Work In Progress? Yes. We don't have any agreement about scope locals:
this implementation is a response to the challenge to make such things
efficient.
> I don't quite understand why this design was chosen for Scoped. I can
> make some assumptions:
> * As only one (static final) Scoped is used at a particular call site,
> the JIT should be able to inline that mono-morphic call.
Always, yes: what I wanted was to guarantee that lookups in the cache
of Scoped instances was no more than a couple of loads from memory.
> * Which would make the instanceof check cheap. The same effect might
> be archived with two @Stable fields?
That's certainly possible, but it isn't guaranteed in the same way,
and I didn't want to do a deep dive into C2 to make sure that it
always holds. A problem with C2 is that small examples generate
super-efficient-perfectly-optimized code but larger ones sometimes
degenerate into expensive checks.
Of course I am concerned about the size of class metadata, but the
generated code is almost as simple as a class can be, and we seem to
be quite happy to generate classes of every lambda expression, so it
seems to be a sanctioned approach.
I have no illusions that this will be the final design, but we
needed something: this is something.
--
Andrew Haley (he/him)
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
https://keybase.io/andrewhaley
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671
More information about the loom-dev
mailing list