equal
deleted
inserted
replaced
1157 if (PrintCompilation && _state != unloaded) { |
1157 if (PrintCompilation && _state != unloaded) { |
1158 print_on(tty, state_msg); |
1158 print_on(tty, state_msg); |
1159 } |
1159 } |
1160 } |
1160 } |
1161 |
1161 |
|
1162 void nmethod::unlink_from_method(bool acquire_lock) { |
|
1163 // We need to check if both the _code and _from_compiled_code_entry_point |
|
1164 // refer to this nmethod because there is a race in setting these two fields |
|
1165 // in Method* as seen in bugid 4947125. |
|
1166 // If the vep() points to the zombie nmethod, the memory for the nmethod |
|
1167 // could be flushed and the compiler and vtable stubs could still call |
|
1168 // through it. |
|
1169 if (method() != NULL && (method()->code() == this || |
|
1170 method()->from_compiled_entry() == verified_entry_point())) { |
|
1171 method()->clear_code(acquire_lock); |
|
1172 } |
|
1173 } |
|
1174 |
1162 /** |
1175 /** |
1163 * Common functionality for both make_not_entrant and make_zombie |
1176 * Common functionality for both make_not_entrant and make_zombie |
1164 */ |
1177 */ |
1165 bool nmethod::make_not_entrant_or_zombie(int state) { |
1178 bool nmethod::make_not_entrant_or_zombie(int state) { |
1166 assert(state == zombie || state == not_entrant, "must be zombie or not_entrant"); |
1179 assert(state == zombie || state == not_entrant, "must be zombie or not_entrant"); |
1244 |
1257 |
1245 // Invalidate while holding the patching lock |
1258 // Invalidate while holding the patching lock |
1246 JVMCI_ONLY(maybe_invalidate_installed_code()); |
1259 JVMCI_ONLY(maybe_invalidate_installed_code()); |
1247 |
1260 |
1248 // Remove nmethod from method. |
1261 // Remove nmethod from method. |
1249 // We need to check if both the _code and _from_compiled_code_entry_point |
1262 unlink_from_method(false /* already owns Patching_lock */); |
1250 // refer to this nmethod because there is a race in setting these two fields |
|
1251 // in Method* as seen in bugid 4947125. |
|
1252 // If the vep() points to the zombie nmethod, the memory for the nmethod |
|
1253 // could be flushed and the compiler and vtable stubs could still call |
|
1254 // through it. |
|
1255 if (method() != NULL && (method()->code() == this || |
|
1256 method()->from_compiled_entry() == verified_entry_point())) { |
|
1257 HandleMark hm; |
|
1258 method()->clear_code(false /* already owns Patching_lock */); |
|
1259 } |
|
1260 } // leave critical region under Patching_lock |
1263 } // leave critical region under Patching_lock |
1261 |
1264 |
1262 #ifdef ASSERT |
1265 #ifdef ASSERT |
1263 if (is_osr_method() && method() != NULL) { |
1266 if (is_osr_method() && method() != NULL) { |
1264 // Make sure osr nmethod is invalidated, i.e. not on the list |
1267 // Make sure osr nmethod is invalidated, i.e. not on the list |