changeset 55045:81a9748bc86c

8217765: Internal Error (javaCalls.cpp:61) guarantee(thread->can_call_java()) failed Reviewed-by: rehn, redestad, coleenp
author dholmes
date Wed, 20 Feb 2019 19:41:43 -0500
parents d001808c57e8
children c925e36a8e6d
files src/hotspot/share/oops/instanceKlass.cpp
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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,