From a0598de66de289c6108848a06388dac200339234 Mon Sep 17 00:00:00 2001 From: coleenp Date: Sat, 4 Dec 2010 00:09:05 -0500 Subject: [PATCH] 6704010: Internal Error (src/share/vm/interpreter/interpreterRuntime.cpp:1106) Summary: Fixed a race condition in the assertion caused by an unguarded, concurrent access to a GrowableArray object. Reviewed-by: coleenp, dholmes, dsamersoff Contributed-by: volker.simonis@gmail.com --- src/share/vm/interpreter/interpreterRuntime.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/share/vm/interpreter/interpreterRuntime.cpp b/src/share/vm/interpreter/interpreterRuntime.cpp index 2aa0c96dc..494ba1fcc 100644 --- a/src/share/vm/interpreter/interpreterRuntime.cpp +++ b/src/share/vm/interpreter/interpreterRuntime.cpp @@ -1193,9 +1193,20 @@ void SignatureHandlerLibrary::add(methodHandle method) { 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() || - _handlers->find(method->signature_handler()) == _fingerprints->find(Fingerprinter(method).fingerprint()), - "sanity check"); + handler_index == fingerprint_index, "sanity check"); +#endif } -- GitLab