java.lang.constant.ClassDesc and TypeDescriptor for hidden class??

Mandy Chung mandy.chung at oracle.com
Thu Apr 2 01:19:29 UTC 2020



On 4/1/20 5:38 PM, John Rose wrote:
>> <suffix> is an unqualified name that is guaranteed to be unique during this execution of the JVM
> It started out as an identity hash code, so it was usually but not guaranteed
> unique.  Is there a cost to this guarantee?  Do we just have a 64-bit atomic
> counter? What if that overflows?  I would prefer not to guarantee uniqueness
> because that’s extra work and it tempts users to misuse it (as a secret
> namespace).

I started with an unique name within the namespace of a class loader and 
later proposed as during the execution of JVM.   The implementation is 
using a pointer address in the VM (not a counter).   Making the 
uniqueness as a quarantee during the execution of JVM is flaw as you 
point out.

What about:
The hidden class's name `N + "/" + <suffix>` is guaranteed to be unique 
among live classes at runtime.

The unique names among the classes would help the diagnosability. (we 
want hidden classes untie with class loaders and so uniqueness among 
live classes rather than classes defined by the same class loader).

I file https://bugs.openjdk.java.net/browse/JDK-8242012 to track this issue.

Mandy


More information about the valhalla-dev mailing list