OpenJDK / amber / amber
diff src/hotspot/share/code/nmethod.cpp @ 54526:ee29b516a36a
revert changes
author | jlaskey |
---|---|
date | Wed, 23 Jan 2019 16:09:20 -0400 |
parents | a682cf219811 |
children | f618cfbaf35b |
line wrap: on
line diff
--- a/src/hotspot/share/code/nmethod.cpp Thu Jan 03 21:27:14 2019 +0100 +++ b/src/hotspot/share/code/nmethod.cpp Wed Jan 23 16:09:20 2019 -0400 @@ -1159,6 +1159,19 @@ } } +void nmethod::unlink_from_method(bool acquire_lock) { + // We need to check if both the _code and _from_compiled_code_entry_point + // refer to this nmethod because there is a race in setting these two fields + // in Method* as seen in bugid 4947125. + // If the vep() points to the zombie nmethod, the memory for the nmethod + // could be flushed and the compiler and vtable stubs could still call + // through it. + if (method() != NULL && (method()->code() == this || + method()->from_compiled_entry() == verified_entry_point())) { + method()->clear_code(acquire_lock); + } +} + /** * Common functionality for both make_not_entrant and make_zombie */ @@ -1246,17 +1259,7 @@ JVMCI_ONLY(maybe_invalidate_installed_code()); // Remove nmethod from method. - // We need to check if both the _code and _from_compiled_code_entry_point - // refer to this nmethod because there is a race in setting these two fields - // in Method* as seen in bugid 4947125. - // If the vep() points to the zombie nmethod, the memory for the nmethod - // could be flushed and the compiler and vtable stubs could still call - // through it. - if (method() != NULL && (method()->code() == this || - method()->from_compiled_entry() == verified_entry_point())) { - HandleMark hm; - method()->clear_code(false /* already owns Patching_lock */); - } + unlink_from_method(false /* already owns Patching_lock */); } // leave critical region under Patching_lock #ifdef ASSERT