src/share/vm/interpreter/interpreterRuntime.cpp

Print this page

        

*** 1191,1203 **** } else { // set handler method->set_signature_handler(_handlers->at(handler_index)); } } assert(method->signature_handler() == Interpreter::slow_signature_handler() || ! _handlers->find(method->signature_handler()) == _fingerprints->find(Fingerprinter(method).fingerprint()), ! "sanity check"); } BufferBlob* SignatureHandlerLibrary::_handler_blob = NULL; address SignatureHandlerLibrary::_handler = NULL; --- 1191,1214 ---- } else { // set handler method->set_signature_handler(_handlers->at(handler_index)); } } + #ifdef ASSERT + int handler_index, fingerprint_index; + { + // '_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); + handler_index = _handlers->find(method->signature_handler()); + fingerprint_index = _fingerprints->find(Fingerprinter(method).fingerprint()); + } assert(method->signature_handler() == Interpreter::slow_signature_handler() || ! handler_index == fingerprint_index, "sanity check"); ! #endif } BufferBlob* SignatureHandlerLibrary::_handler_blob = NULL; address SignatureHandlerLibrary::_handler = NULL;