src/share/vm/code/nmethod.cpp
Print this page
@@ -1298,10 +1298,17 @@
// Common functionality for both make_not_entrant and make_zombie
bool nmethod::make_not_entrant_or_zombie(unsigned int state) {
assert(state == zombie || state == not_entrant, "must be zombie or not_entrant");
assert(!is_zombie(), "should not already be a zombie");
+ // The state of nmethods that are currently locked by the VM must not change.
+ // Some operations such as setting ICs (e.g., SharedRuntime::resolve_sub_helper())
+ // rely on this fact.
+ if (is_locked_by_vm()) {
+ return false;
+ }
+
// Make sure neither the nmethod nor the method is flushed in case of a safepoint in code below.
nmethodLocker nml(this);
methodHandle the_method(method());
No_Safepoint_Verifier nsv;
@@ -1415,11 +1422,10 @@
tty->print_cr("nmethod <" INTPTR_FORMAT "> code made %s", this, (state == not_entrant) ? "not entrant" : "zombie");
}
// Make sweeper aware that there is a zombie method that needs to be removed
NMethodSweeper::notify(this);
-
return true;
}
void nmethod::flush() {
// Note that there are no valid oops in the nmethod anymore.