This commit is contained in:
Nils Eliasson 2015-11-06 11:34:03 +01:00
commit 3307d0f163
326 changed files with 9465 additions and 4610 deletions

View file

@ -1350,20 +1350,17 @@ void nmethod::make_unloaded(BoolObjectClosure* is_alive, oop cause) {
// Unregister must be done before the state change
Universe::heap()->unregister_nmethod(this);
_state = unloaded;
#if INCLUDE_JVMCI
// 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. Nulling out the reference has to happen
// after the method is unregistered since the original value may be still
// tracked by the rset.
if (_jvmci_installed_code != NULL) {
InstalledCode::set_address(_jvmci_installed_code, 0);
_jvmci_installed_code = NULL;
}
maybe_invalidate_installed_code();
#endif
_state = unloaded;
// Log the unloading.
log_state_change();
@ -1525,12 +1522,8 @@ bool nmethod::make_not_entrant_or_zombie(unsigned int state) {
} else {
assert(state == not_entrant, "other cases may need to be handled differently");
}
#if INCLUDE_JVMCI
if (_jvmci_installed_code != NULL) {
// Break the link between nmethod and InstalledCode such that the nmethod can subsequently be flushed safely.
InstalledCode::set_address(_jvmci_installed_code, 0);
}
#endif
JVMCI_ONLY(maybe_invalidate_installed_code());
if (TraceCreateZombies) {
ResourceMark m;
@ -3388,6 +3381,22 @@ void nmethod::print_statistics() {
#endif // !PRODUCT
#if INCLUDE_JVMCI
void nmethod::maybe_invalidate_installed_code() {
if (_jvmci_installed_code != NULL) {
if (!is_alive()) {
// Break the link between nmethod and InstalledCode such that the nmethod
// can subsequently be flushed safely. The link must be maintained while
// the method could have live activations since invalidateInstalledCode
// might want to invalidate all existing activations.
InstalledCode::set_address(_jvmci_installed_code, 0);
InstalledCode::set_entryPoint(_jvmci_installed_code, 0);
_jvmci_installed_code = NULL;
} else if (is_not_entrant()) {
InstalledCode::set_entryPoint(_jvmci_installed_code, 0);
}
}
}
char* nmethod::jvmci_installed_code_name(char* buf, size_t buflen) {
if (!this->is_compiled_by_jvmci()) {
return NULL;