Mercurial > hg > graal-jvmci-8
comparison src/share/vm/code/nmethod.cpp @ 22725:eada427470a3
Use proper GC barriers when clearing _jvmci_installed_code
author | Tom Rodriguez <tom.rodriguez@oracle.com> |
---|---|
date | Thu, 05 Nov 2015 15:21:30 -0800 |
parents | 456800cd1a17 |
children | 2dea101cdfe9 |
comparison
equal
deleted
inserted
replaced
22724:2d21c13d7829 | 22725:eada427470a3 |
---|---|
1976 // Follow JVMCI method | 1976 // Follow JVMCI method |
1977 BarrierSet* bs = Universe::heap()->barrier_set(); | 1977 BarrierSet* bs = Universe::heap()->barrier_set(); |
1978 if (_jvmci_installed_code != NULL) { | 1978 if (_jvmci_installed_code != NULL) { |
1979 if (_jvmci_installed_code->is_a(HotSpotNmethod::klass()) && HotSpotNmethod::isDefault(_jvmci_installed_code)) { | 1979 if (_jvmci_installed_code->is_a(HotSpotNmethod::klass()) && HotSpotNmethod::isDefault(_jvmci_installed_code)) { |
1980 if (!is_alive->do_object_b(_jvmci_installed_code)) { | 1980 if (!is_alive->do_object_b(_jvmci_installed_code)) { |
1981 bs->write_ref_nmethod_pre(&_jvmci_installed_code, this); | 1981 clear_jvmci_installed_code(); |
1982 _jvmci_installed_code = NULL; | |
1983 bs->write_ref_nmethod_post(&_jvmci_installed_code, this); | |
1984 } | 1982 } |
1985 } else { | 1983 } else { |
1986 if (can_unload(is_alive, (oop*)&_jvmci_installed_code, unloading_occurred)) { | 1984 if (can_unload(is_alive, (oop*)&_jvmci_installed_code, unloading_occurred)) { |
1987 return; | 1985 return; |
1988 } | 1986 } |
2107 // call to post_compiled_method_unload() so that the unloading | 2105 // call to post_compiled_method_unload() so that the unloading |
2108 // of this nmethod is reported. | 2106 // of this nmethod is reported. |
2109 unloading_occurred = true; | 2107 unloading_occurred = true; |
2110 } | 2108 } |
2111 | 2109 |
2112 #if INCLUDE_JVMCI | |
2113 // Follow JVMCI method | |
2114 if (_jvmci_installed_code != NULL) { | |
2115 if (_jvmci_installed_code->is_a(HotSpotNmethod::klass()) && HotSpotNmethod::isDefault(_jvmci_installed_code)) { | |
2116 if (!is_alive->do_object_b(_jvmci_installed_code)) { | |
2117 _jvmci_installed_code = NULL; | |
2118 } | |
2119 } else { | |
2120 if (can_unload(is_alive, (oop*)&_jvmci_installed_code, unloading_occurred)) { | |
2121 return false; | |
2122 } | |
2123 } | |
2124 } | |
2125 | |
2126 if (_speculation_log != NULL) { | |
2127 if (!is_alive->do_object_b(_speculation_log)) { | |
2128 _speculation_log = NULL; | |
2129 } | |
2130 } | |
2131 #endif | |
2132 | |
2133 // When class redefinition is used all metadata in the CodeCache has to be recorded, | 2110 // When class redefinition is used all metadata in the CodeCache has to be recorded, |
2134 // so that unused "previous versions" can be purged. Since walking the CodeCache can | 2111 // so that unused "previous versions" can be purged. Since walking the CodeCache can |
2135 // be expensive, the "mark on stack" is piggy-backed on this parallel unloading code. | 2112 // be expensive, the "mark on stack" is piggy-backed on this parallel unloading code. |
2136 bool mark_metadata_on_stack = a_class_was_redefined; | 2113 bool mark_metadata_on_stack = a_class_was_redefined; |
2137 | 2114 |
2202 // Follow JVMCI method | 2179 // Follow JVMCI method |
2203 BarrierSet* bs = Universe::heap()->barrier_set(); | 2180 BarrierSet* bs = Universe::heap()->barrier_set(); |
2204 if (_jvmci_installed_code != NULL) { | 2181 if (_jvmci_installed_code != NULL) { |
2205 if (_jvmci_installed_code->is_a(HotSpotNmethod::klass()) && HotSpotNmethod::isDefault(_jvmci_installed_code)) { | 2182 if (_jvmci_installed_code->is_a(HotSpotNmethod::klass()) && HotSpotNmethod::isDefault(_jvmci_installed_code)) { |
2206 if (!is_alive->do_object_b(_jvmci_installed_code)) { | 2183 if (!is_alive->do_object_b(_jvmci_installed_code)) { |
2207 bs->write_ref_nmethod_pre(&_jvmci_installed_code, this); | 2184 clear_jvmci_installed_code(); |
2208 _jvmci_installed_code = NULL; | |
2209 bs->write_ref_nmethod_post(&_jvmci_installed_code, this); | |
2210 } | 2185 } |
2211 } else { | 2186 } else { |
2212 if (can_unload(is_alive, (oop*)&_jvmci_installed_code, unloading_occurred)) { | 2187 if (can_unload(is_alive, (oop*)&_jvmci_installed_code, unloading_occurred)) { |
2213 is_unloaded = true; | 2188 is_unloaded = true; |
2214 } | 2189 } |
3540 Dependencies::print_statistics(); | 3515 Dependencies::print_statistics(); |
3541 if (xtty != NULL) xtty->tail("statistics"); | 3516 if (xtty != NULL) xtty->tail("statistics"); |
3542 } | 3517 } |
3543 | 3518 |
3544 #if INCLUDE_JVMCI | 3519 #if INCLUDE_JVMCI |
3520 void nmethod::clear_jvmci_installed_code() { | |
3521 // This must be done carefully to maintain nmethod remembered sets properly | |
3522 BarrierSet* bs = Universe::heap()->barrier_set(); | |
3523 bs->write_ref_nmethod_pre(&_jvmci_installed_code, this); | |
3524 _jvmci_installed_code = NULL; | |
3525 bs->write_ref_nmethod_post(&_jvmci_installed_code, this); | |
3526 } | |
3527 | |
3545 void nmethod::maybe_invalidate_installed_code() { | 3528 void nmethod::maybe_invalidate_installed_code() { |
3546 if (_jvmci_installed_code != NULL) { | 3529 if (_jvmci_installed_code != NULL) { |
3547 if (!is_alive()) { | 3530 if (!is_alive()) { |
3548 // Break the link between nmethod and InstalledCode such that the nmethod | 3531 // Break the link between nmethod and InstalledCode such that the nmethod |
3549 // can subsequently be flushed safely. The link must be maintained while | 3532 // can subsequently be flushed safely. The link must be maintained while |
3550 // the method could have live activations since invalidateInstalledCode | 3533 // the method could have live activations since invalidateInstalledCode |
3551 // might want to invalidate all existing activations. | 3534 // might want to invalidate all existing activations. |
3552 InstalledCode::set_address(_jvmci_installed_code, 0); | 3535 InstalledCode::set_address(_jvmci_installed_code, 0); |
3553 InstalledCode::set_entryPoint(_jvmci_installed_code, 0); | 3536 InstalledCode::set_entryPoint(_jvmci_installed_code, 0); |
3554 _jvmci_installed_code = NULL; | 3537 clear_jvmci_installed_code(); |
3555 } else if (is_not_entrant()) { | 3538 } else if (is_not_entrant()) { |
3556 InstalledCode::set_entryPoint(_jvmci_installed_code, 0); | 3539 InstalledCode::set_entryPoint(_jvmci_installed_code, 0); |
3557 } | 3540 } |
3558 } | 3541 } |
3559 } | 3542 } |