Mercurial > hg > truffle
diff src/share/vm/code/nmethod.cpp @ 9046:c6a1ffc707ff
Comments and #ifdef GRAAL for recent changes to C++ code for calling nmethods directly.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Fri, 12 Apr 2013 17:22:54 +0200 |
parents | 9a3e25e270a0 |
children | fe9a18fbb15e 197426668a5d |
line wrap: on
line diff
--- a/src/share/vm/code/nmethod.cpp Fri Apr 12 06:19:35 2013 +0200 +++ b/src/share/vm/code/nmethod.cpp Fri Apr 12 17:22:54 2013 +0200 @@ -1307,9 +1307,12 @@ } #ifdef GRAAL - if (_graal_installed_code != NULL) { - _graal_installed_code = NULL; - } + // The method can only be unloaded after the pointer to the installed code + // Java wrapper is no longer alive. Here we need to clear out this weak + // reference to the dead object. + if (_graal_installed_code != NULL) { + _graal_installed_code = NULL; + } #endif // Make the class unloaded - i.e., change state and notify sweeper @@ -1396,14 +1399,14 @@ // The caller can be calling the method statically or through an inline // cache call. if (!is_osr_method() && !is_not_entrant()) { + address stub = SharedRuntime::get_handle_wrong_method_stub(); +#ifdef GRAAL if (_graal_installed_code != NULL && !HotSpotInstalledCode::isDefault(_graal_installed_code)) { // This was manually installed machine code. Patch entry with stub that throws an exception. - NativeJump::patch_verified_entry(entry_point(), verified_entry_point(), - SharedRuntime::get_deoptimized_installed_code_stub()); - } else { - NativeJump::patch_verified_entry(entry_point(), verified_entry_point(), - SharedRuntime::get_handle_wrong_method_stub()); + stub = SharedRuntime::get_deoptimized_installed_code_stub(); } +#endif + NativeJump::patch_verified_entry(entry_point(), verified_entry_point(), stub); } if (is_in_use()) {