1.1 --- a/src/share/vm/code/nmethod.cpp Wed Dec 02 17:48:20 2015 -0800 1.2 +++ b/src/share/vm/code/nmethod.cpp Thu Nov 12 09:53:17 2015 +0100 1.3 @@ -1619,7 +1619,11 @@ 1.4 // During GC the is_alive closure is non-NULL, and is used to 1.5 // determine liveness of dependees that need to be updated. 1.6 if (is_alive == NULL || klass->is_loader_alive(is_alive)) { 1.7 - InstanceKlass::cast(klass)->remove_dependent_nmethod(this); 1.8 + // The GC defers deletion of this entry, since there might be multiple threads 1.9 + // iterating over the _dependencies graph. Other call paths are single-threaded 1.10 + // and may delete it immediately. 1.11 + bool delete_immediately = is_alive == NULL; 1.12 + InstanceKlass::cast(klass)->remove_dependent_nmethod(this, delete_immediately); 1.13 } 1.14 } 1.15 }