# HG changeset patch # User dholmes # Date 1550709703 18000 # Node ID 81a9748bc86cc7c22a6f0e409c3930035d57602f # Parent d001808c57e85ee07815373483e748952f6ef1da 8217765: Internal Error (javaCalls.cpp:61) guarantee(thread->can_call_java()) failed Reviewed-by: rehn, redestad, coleenp diff -r d001808c57e8 -r 81a9748bc86c src/hotspot/share/oops/instanceKlass.cpp --- a/src/hotspot/share/oops/instanceKlass.cpp Wed Feb 20 16:15:02 2019 -0800 +++ b/src/hotspot/share/oops/instanceKlass.cpp Wed Feb 20 19:41:43 2019 -0500 @@ -183,8 +183,14 @@ if (name == k->name()) { log_trace(class, nestmates)("- Found it at nest_members[%d] => cp[%d]", i, cp_index); - // names match so check actual klass - this may trigger class loading if - // it doesn't match (but that should be impossible) + // Names match so check actual klass - this may trigger class loading if + // it doesn't match (though that should be impossible). But to be safe we + // have to check for a compiler thread executing here. + if (!THREAD->can_call_java() && !_constants->tag_at(cp_index).is_klass()) { + log_trace(class, nestmates)("- validation required resolution in an unsuitable thread"); + return false; + } + Klass* k2 = _constants->klass_at(cp_index, CHECK_false); if (k2 == k) { log_trace(class, nestmates)("- class is listed as a nest member"); @@ -296,7 +302,7 @@ error); } - if (validationException != NULL) { + if (validationException != NULL && THREAD->can_call_java()) { ResourceMark rm(THREAD); Exceptions::fthrow(THREAD_AND_LOCATION, validationException,