--- old/src/hotspot/share/prims/jvm.cpp 2020-03-08 18:58:33.327676672 -0400 +++ new/src/hotspot/share/prims/jvm.cpp 2020-03-08 18:58:32.170663851 -0400 @@ -1017,7 +1017,7 @@ InstanceKlass* host_class = NULL; if (is_nestmate) { - host_class = InstanceKlass::cast(lookup_k)->nest_host(THREAD); + host_class = InstanceKlass::cast(lookup_k)->nest_host(CHECK_NULL); } if (log_is_enabled(Info, class, nestmates)) { @@ -2052,8 +2052,8 @@ assert(c->is_instance_klass(), "must be"); InstanceKlass* ck = InstanceKlass::cast(c); InstanceKlass* host = ck->nest_host(THREAD); - assert(host != NULL, "host should never be NULL"); - return (jclass) JNIHandles::make_local(THREAD, host->java_mirror()); + return (jclass) (host == NULL ? NULL : + JNIHandles::make_local(THREAD, host->java_mirror())); } JVM_END @@ -2094,6 +2094,9 @@ int cp_index = members->at(i); Klass* k = host->constants()->klass_at(cp_index, THREAD); if (HAS_PENDING_EXCEPTION) { + if (PENDING_EXCEPTION->is_a(SystemDictionary::VirtualMachineError_klass())) { + return NULL; // propagate VMEs + } if (doLog) { ResourceMark rm(THREAD); stringStream ss; @@ -2107,7 +2110,7 @@ } if (k->is_instance_klass()) { InstanceKlass* ik = InstanceKlass::cast(k); - InstanceKlass* nest_host_k = ik->nest_host(THREAD); + InstanceKlass* nest_host_k = ik->nest_host(CHECK_NULL); if (nest_host_k == host) { result->obj_at_put(count+1, k->java_mirror()); count++;