< prev index next >
src/share/vm/code/nmethod.cpp
Print this page
rev 9252 : 8142436: [JVMCI] fix management of nmethod::_installed_code field
@@ -1821,13 +1821,11 @@
// Follow JVMCI method
BarrierSet* bs = Universe::heap()->barrier_set();
if (_jvmci_installed_code != NULL) {
if (_jvmci_installed_code->is_a(HotSpotNmethod::klass()) && HotSpotNmethod::isDefault(_jvmci_installed_code)) {
if (!is_alive->do_object_b(_jvmci_installed_code)) {
- bs->write_ref_nmethod_pre(&_jvmci_installed_code, this);
- _jvmci_installed_code = NULL;
- bs->write_ref_nmethod_post(&_jvmci_installed_code, this);
+ clear_jvmci_installed_code();
}
} else {
if (can_unload(is_alive, (oop*)&_jvmci_installed_code, unloading_occurred)) {
return;
}
@@ -1924,31 +1922,10 @@
// call to post_compiled_method_unload() so that the unloading
// of this nmethod is reported.
unloading_occurred = true;
}
-#if INCLUDE_JVMCI
- // Follow JVMCI method
- if (_jvmci_installed_code != NULL) {
- if (_jvmci_installed_code->is_a(HotSpotNmethod::klass()) && HotSpotNmethod::isDefault(_jvmci_installed_code)) {
- if (!is_alive->do_object_b(_jvmci_installed_code)) {
- _jvmci_installed_code = NULL;
- }
- } else {
- if (can_unload(is_alive, (oop*)&_jvmci_installed_code, unloading_occurred)) {
- return false;
- }
- }
- }
-
- if (_speculation_log != NULL) {
- if (!is_alive->do_object_b(_speculation_log)) {
- _speculation_log = NULL;
- }
- }
-#endif
-
// Exception cache
clean_exception_cache(is_alive);
bool is_unloaded = false;
bool postponed = false;
@@ -2008,13 +1985,11 @@
// Follow JVMCI method
BarrierSet* bs = Universe::heap()->barrier_set();
if (_jvmci_installed_code != NULL) {
if (_jvmci_installed_code->is_a(HotSpotNmethod::klass()) && HotSpotNmethod::isDefault(_jvmci_installed_code)) {
if (!is_alive->do_object_b(_jvmci_installed_code)) {
- bs->write_ref_nmethod_pre(&_jvmci_installed_code, this);
- _jvmci_installed_code = NULL;
- bs->write_ref_nmethod_post(&_jvmci_installed_code, this);
+ clear_jvmci_installed_code();
}
} else {
if (can_unload(is_alive, (oop*)&_jvmci_installed_code, unloading_occurred)) {
is_unloaded = true;
}
@@ -3375,20 +3350,28 @@
}
#endif // !PRODUCT
#if INCLUDE_JVMCI
+void nmethod::clear_jvmci_installed_code() {
+ // This must be done carefully to maintain nmethod remembered sets properly
+ BarrierSet* bs = Universe::heap()->barrier_set();
+ bs->write_ref_nmethod_pre(&_jvmci_installed_code, this);
+ _jvmci_installed_code = NULL;
+ bs->write_ref_nmethod_post(&_jvmci_installed_code, this);
+}
+
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;
+ clear_jvmci_installed_code();
} else if (is_not_entrant()) {
InstalledCode::set_entryPoint(_jvmci_installed_code, 0);
}
}
}
< prev index next >