src/share/vm/interpreter/interpreterRuntime.cpp

Print this page

        

@@ -1191,13 +1191,22 @@
     } else {
       // set handler
       method->set_signature_handler(_handlers->at(handler_index));
     }
   }
+#ifdef ASSERT
+  {
+    // '_handlers' and '_fingerprints' are 'GrowableArray's and are NOT synchronized
+    // in any way if accessed from multiple threads. To avoid races with another
+    // thread which may change the arrays in the above, mutex protected block, we
+    // have to protect this read access here with the same mutex as well!
+    MutexLocker mu(SignatureHandlerLibrary_lock);
   assert(method->signature_handler() == Interpreter::slow_signature_handler() ||
          _handlers->find(method->signature_handler()) == _fingerprints->find(Fingerprinter(method).fingerprint()),
          "sanity check");
+  }
+#endif
 }
 
 
 BufferBlob*              SignatureHandlerLibrary::_handler_blob = NULL;
 address                  SignatureHandlerLibrary::_handler      = NULL;