Valhalla EG minutes 6/21/17
john.r.rose at oracle.com
Wed Jul 19 21:56:11 UTC 2017
On Jul 12, 2017, at 12:08 PM, Paul Sandoz <paul.sandoz at oracle.com> 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.
More information about the valhalla-spec-observers