< prev index next >

src/hotspot/share/runtime/sharedRuntime.cpp

Print this page

        

@@ -1312,10 +1312,15 @@
           if (!inline_cache->set_to_monomorphic(virtual_call_info)) {
             return false;
           }
         }
       } else {
+        if (UseFastClassInitChecks && invoke_code == Bytecodes::_invokestatic &&
+            callee_method->needs_clinit_barrier() &&
+            callee != NULL && (callee->is_compiled_by_jvmci() || callee->is_aot())) {
+          return true; // skip patching for JVMCI or AOT code
+        }
         CompiledStaticCall* ssc = caller_nm->compiledStaticCall_before(caller_frame.pc());
         if (ssc->is_clean()) ssc->set(static_call_info);
       }
     }
   } // unlock CompiledICLocker

@@ -1374,23 +1379,21 @@
     tty->print_cr(" at pc: " INTPTR_FORMAT " to code: " INTPTR_FORMAT,
                   p2i(caller_frame.pc()), p2i(callee_method->code()));
   }
 #endif
 
+  if (invoke_code == Bytecodes::_invokestatic) {
+    if (!UseFastClassInitChecks && callee_method->needs_clinit_barrier()) {
   // Do not patch call site for static call to another class
   // when the class is not fully initialized.
-  if (invoke_code == Bytecodes::_invokestatic) {
-    if (!callee_method->method_holder()->is_initialized() &&
-        callee_method->method_holder() != caller_nm->method()->method_holder()) {
       assert(callee_method->method_holder()->is_linked(), "must be");
       return callee_method;
-    } else {
+    }
       assert(callee_method->method_holder()->is_initialized() ||
              callee_method->method_holder()->is_reentrant_initialization(thread),
              "invalid class initialization state for invoke_static");
     }
-  }
 
   // JSR 292 key invariant:
   // If the resolved method is a MethodHandle invoke target, the call
   // site must be a MethodHandle call site, because the lambda form might tail-call
   // leaving the stack in a state unknown to either caller or callee
< prev index next >