[Nestmates] RFR Lookup.defineClass nest-host update

Mandy Chung mandy.chung at oracle.com
Mon Nov 5 18:52:03 UTC 2018

Hi David,

On 11/4/18 11:03 PM, David Holmes wrote:
> webrev: 
> http://cr.openjdk.java.net/~dholmes/dynamic-nestmates/webrev.nest_host_update/ 
> Testing showed that the internal use of Class.getNestHost inside 
> Lookup.defineClass was not suitable as invalidly defined 
> nest-hosts/members resulted in an inappropriate nest-host being passed 
> into the the VM to set_nest_host (a class becomes it's own nest-host 
> if there are any validation errors). set_nest_host needs a valid 
> nest-host else we'll hit assertion failures.
> The solution was to pass the lookupClass through to the VM and have 
> jvm_lookup_define_class do a direct InstanceKlass::nest_host() lookup 
> that will throw exceptions if there are validation issues.

The fix looks fine to me.  The adjusted logging statement reads better, 
thanks.  Should we add a test for it?

Alternatively  we can keep JVM_LookupDefineClass to expect the lookup 
class parameter must be the nest host (that's the intent - do you see a 
check in the VM side to enforce that?).  The library will do the 
validation and pass a valid nest host to JVM entry point to keep it 
simple.   In that case perhaps JVM_GetNestHost can take an additional 
argument with exception or not.   Lois may have an opinion.


More information about the valhalla-dev mailing list