< prev index next >

src/hotspot/share/oops/cpCache.cpp

Print this page

        

@@ -260,18 +260,21 @@
     // is executed.
     if (invoke_code == Bytecodes::_invokespecial && sender_is_interface &&
         method->name() != vmSymbols::object_initializer_name()) {
       do_resolve = false;
     }
+    if (invoke_code == Bytecodes::_invokestatic) {
+      if (method->needs_clinit_barrier()) {
+        if (UseFastClassInitChecks) {
+          // Template interpreter supports fast class initialization check for invokestatic which
+          // doesn't require unresolved call site.
+        } else {
     // Don't mark invokestatic to method as resolved if the holder class has not yet completed
     // initialization. An invokestatic must only proceed if the class is initialized, but if
-    // we resolve it before then that class initialization check is skipped. However if the call
-    // is from the same class we can resolve as we must be executing with <clinit> on our call stack.
-    if (invoke_code == Bytecodes::_invokestatic) {
-      if (!method->method_holder()->is_initialized() &&
-          method->method_holder() != pool_holder) {
+          // we resolve it before then that class initialization check is skipped.
         do_resolve = false;
+        }
       } else {
         assert(method->method_holder()->is_initialized() ||
                method->method_holder()->is_reentrant_initialization(Thread::current()),
                "invalid class initialization state for invoke_static");
       }
< prev index next >