equal
deleted
inserted
replaced
1348 } |
1348 } |
1349 |
1349 |
1350 // Unregister must be done before the state change |
1350 // Unregister must be done before the state change |
1351 Universe::heap()->unregister_nmethod(this); |
1351 Universe::heap()->unregister_nmethod(this); |
1352 |
1352 |
|
1353 _state = unloaded; |
|
1354 |
1353 #if INCLUDE_JVMCI |
1355 #if INCLUDE_JVMCI |
1354 // The method can only be unloaded after the pointer to the installed code |
1356 // The method can only be unloaded after the pointer to the installed code |
1355 // Java wrapper is no longer alive. Here we need to clear out this weak |
1357 // Java wrapper is no longer alive. Here we need to clear out this weak |
1356 // reference to the dead object. Nulling out the reference has to happen |
1358 // reference to the dead object. Nulling out the reference has to happen |
1357 // after the method is unregistered since the original value may be still |
1359 // after the method is unregistered since the original value may be still |
1358 // tracked by the rset. |
1360 // tracked by the rset. |
1359 if (_jvmci_installed_code != NULL) { |
1361 maybe_invalidate_installed_code(); |
1360 InstalledCode::set_address(_jvmci_installed_code, 0); |
1362 #endif |
1361 _jvmci_installed_code = NULL; |
|
1362 } |
|
1363 #endif |
|
1364 |
|
1365 _state = unloaded; |
|
1366 |
1363 |
1367 // Log the unloading. |
1364 // Log the unloading. |
1368 log_state_change(); |
1365 log_state_change(); |
1369 |
1366 |
1370 // The Method* is gone at this point |
1367 // The Method* is gone at this point |
1523 // nmethod is in zombie state |
1520 // nmethod is in zombie state |
1524 set_method(NULL); |
1521 set_method(NULL); |
1525 } else { |
1522 } else { |
1526 assert(state == not_entrant, "other cases may need to be handled differently"); |
1523 assert(state == not_entrant, "other cases may need to be handled differently"); |
1527 } |
1524 } |
1528 #if INCLUDE_JVMCI |
1525 |
1529 if (_jvmci_installed_code != NULL) { |
1526 JVMCI_ONLY(maybe_invalidate_installed_code()); |
1530 // Break the link between nmethod and InstalledCode such that the nmethod can subsequently be flushed safely. |
|
1531 InstalledCode::set_address(_jvmci_installed_code, 0); |
|
1532 } |
|
1533 #endif |
|
1534 |
1527 |
1535 if (TraceCreateZombies) { |
1528 if (TraceCreateZombies) { |
1536 ResourceMark m; |
1529 ResourceMark m; |
1537 tty->print_cr("nmethod <" INTPTR_FORMAT "> %s code made %s", p2i(this), this->method() ? this->method()->name_and_sig_as_C_string() : "null", (state == not_entrant) ? "not entrant" : "zombie"); |
1530 tty->print_cr("nmethod <" INTPTR_FORMAT "> %s code made %s", p2i(this), this->method() ? this->method()->name_and_sig_as_C_string() : "null", (state == not_entrant) ? "not entrant" : "zombie"); |
1538 } |
1531 } |
3382 } |
3375 } |
3383 |
3376 |
3384 #endif // !PRODUCT |
3377 #endif // !PRODUCT |
3385 |
3378 |
3386 #if INCLUDE_JVMCI |
3379 #if INCLUDE_JVMCI |
|
3380 void nmethod::maybe_invalidate_installed_code() { |
|
3381 if (_jvmci_installed_code != NULL) { |
|
3382 if (!is_alive()) { |
|
3383 // Break the link between nmethod and InstalledCode such that the nmethod |
|
3384 // can subsequently be flushed safely. The link must be maintained while |
|
3385 // the method could have live activations since invalidateInstalledCode |
|
3386 // might want to invalidate all existing activations. |
|
3387 InstalledCode::set_address(_jvmci_installed_code, 0); |
|
3388 InstalledCode::set_entryPoint(_jvmci_installed_code, 0); |
|
3389 _jvmci_installed_code = NULL; |
|
3390 } else if (is_not_entrant()) { |
|
3391 InstalledCode::set_entryPoint(_jvmci_installed_code, 0); |
|
3392 } |
|
3393 } |
|
3394 } |
|
3395 |
3387 char* nmethod::jvmci_installed_code_name(char* buf, size_t buflen) { |
3396 char* nmethod::jvmci_installed_code_name(char* buf, size_t buflen) { |
3388 if (!this->is_compiled_by_jvmci()) { |
3397 if (!this->is_compiled_by_jvmci()) { |
3389 return NULL; |
3398 return NULL; |
3390 } |
3399 } |
3391 oop installedCode = this->jvmci_installed_code(); |
3400 oop installedCode = this->jvmci_installed_code(); |