Valhalla EG minutes 6/21/17

John Rose john.r.rose at
Wed Jul 19 21:56:11 UTC 2017

On Jul 12, 2017, at 12:08 PM, Paul Sandoz <paul.sandoz at> wrote:
> A ClassValue kind of map might be more efficient than say a ConcurrentHM.

A cell in the java.lang.Class is better.  It requires JVM collaboration.

The trick can be done 99% correctly with ThreadLocal and ClassValue.
The defineClass guy sets up a ThreadLocal to hold the value while
the class is loaded.  Then, in the same thread (we expect at a 99%
level) the ClassValue for the newly defined class is tickled.  The
recursive call to ClassValue.computeValue catches the long pass
from defineClass via the ThreadLocal, and… touchdown!

That wouldn't require any JVM changes at all but it might not be reliable.
Certainly not clean.

— John

More information about the valhalla-spec-observers mailing list