OpenJDK / jdk / jdk
changeset 59332:b78256118358
8245124: Shenandoah: optimize code root evacuation/update during concurrent class unloading
Reviewed-by: shade
author | zgu |
---|---|
date | Mon, 18 May 2020 14:47:09 -0400 |
parents | d1ad49003c3d |
children | 4bec5ceb7e59 |
files | src/hotspot/share/gc/shenandoah/shenandoahCodeRoots.cpp src/hotspot/share/gc/shenandoah/shenandoahNMethod.cpp src/hotspot/share/gc/shenandoah/shenandoahNMethod.hpp src/hotspot/share/gc/shenandoah/shenandoahNMethod.inline.hpp |
diffstat | 4 files changed, 29 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/src/hotspot/share/gc/shenandoah/shenandoahCodeRoots.cpp Mon May 18 17:15:32 2020 +0000 +++ b/src/hotspot/share/gc/shenandoah/shenandoahCodeRoots.cpp Mon May 18 14:47:09 2020 -0400 @@ -26,6 +26,7 @@ #include "code/codeCache.hpp" #include "code/icBuffer.hpp" #include "code/nmethod.hpp" +#include "gc/shenandoah/shenandoahClosures.inline.hpp" #include "gc/shenandoah/shenandoahCodeRoots.hpp" #include "gc/shenandoah/shenandoahEvacOOMHandler.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" @@ -272,7 +273,8 @@ // Heal oops and disarm if (_bs->is_armed(nm)) { - ShenandoahNMethod::heal_nmethod(nm); + ShenandoahEvacOOMScope oom_evac_scope; + ShenandoahNMethod::heal_nmethod_metadata(nm_data); _bs->disarm(nm); }
--- a/src/hotspot/share/gc/shenandoah/shenandoahNMethod.cpp Mon May 18 17:15:32 2020 +0000 +++ b/src/hotspot/share/gc/shenandoah/shenandoahNMethod.cpp Mon May 18 14:47:09 2020 -0400 @@ -110,24 +110,6 @@ assert_same_oops(); } -void ShenandoahNMethod::oops_do(OopClosure* oops, bool fix_relocations) { - for (int c = 0; c < _oops_count; c ++) { - oops->do_oop(_oops[c]); - } - - oop* const begin = _nm->oops_begin(); - oop* const end = _nm->oops_end(); - for (oop* p = begin; p < end; p++) { - if (*p != Universe::non_oop_word()) { - oops->do_oop(p); - } - } - - if (fix_relocations && _has_non_immed_oops) { - _nm->fix_oop_relocations(); - } -} - void ShenandoahNMethod::detect_reloc_oops(nmethod* nm, GrowableArray<oop*>& oops, bool& has_non_immed_oops) { has_non_immed_oops = false; // Find all oops relocations @@ -215,8 +197,7 @@ } } else if (heap->is_concurrent_weak_root_in_progress()) { ShenandoahEvacOOMScope evac_scope; - ShenandoahEvacuateUpdateRootsClosure<> cl; - data->oops_do(&cl, true /*fix relocation*/); + heal_nmethod_metadata(data); } else { // There is possibility that GC is cancelled when it arrives final mark. // In this case, concurrent root phase is skipped and degenerated GC should be
--- a/src/hotspot/share/gc/shenandoah/shenandoahNMethod.hpp Mon May 18 17:15:32 2020 +0000 +++ b/src/hotspot/share/gc/shenandoah/shenandoahNMethod.hpp Mon May 18 14:47:09 2020 -0400 @@ -51,7 +51,7 @@ inline nmethod* nm() const; inline ShenandoahReentrantLock* lock(); - void oops_do(OopClosure* oops, bool fix_relocations = false); + inline void oops_do(OopClosure* oops, bool fix_relocations = false); // Update oops when the nmethod is re-registered void update(); @@ -67,6 +67,7 @@ static inline ShenandoahReentrantLock* lock_for_nmethod(nmethod* nm); static void heal_nmethod(nmethod* nm); + static inline void heal_nmethod_metadata(ShenandoahNMethod* nmethod_data); static inline void disarm_nmethod(nmethod* nm); static inline ShenandoahNMethod* gc_data(nmethod* nm);
--- a/src/hotspot/share/gc/shenandoah/shenandoahNMethod.inline.hpp Mon May 18 17:15:32 2020 +0000 +++ b/src/hotspot/share/gc/shenandoah/shenandoahNMethod.inline.hpp Mon May 18 14:47:09 2020 -0400 @@ -54,6 +54,29 @@ return _unregistered; } +void ShenandoahNMethod::oops_do(OopClosure* oops, bool fix_relocations) { + for (int c = 0; c < _oops_count; c ++) { + oops->do_oop(_oops[c]); + } + + oop* const begin = _nm->oops_begin(); + oop* const end = _nm->oops_end(); + for (oop* p = begin; p < end; p++) { + if (*p != Universe::non_oop_word()) { + oops->do_oop(p); + } + } + + if (fix_relocations && _has_non_immed_oops) { + _nm->fix_oop_relocations(); + } +} + +void ShenandoahNMethod::heal_nmethod_metadata(ShenandoahNMethod* nmethod_data) { + ShenandoahEvacuateUpdateRootsClosure<> cl; + nmethod_data->oops_do(&cl, true /*fix relocation*/); +} + void ShenandoahNMethod::disarm_nmethod(nmethod* nm) { if (!ShenandoahConcurrentRoots::can_do_concurrent_class_unloading()) { return;