diff -r 8b6cc0bb93d0 -r 9186be5c78ba src/hotspot/share/gc/shenandoah/shenandoahClosures.inline.hpp --- a/src/hotspot/share/gc/shenandoah/shenandoahClosures.inline.hpp Wed Nov 27 06:36:41 2019 -0800 +++ b/src/hotspot/share/gc/shenandoah/shenandoahClosures.inline.hpp Wed Nov 27 11:52:57 2019 -0500 @@ -23,9 +23,11 @@ #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHCLOSURES_INLINE_HPP #define SHARE_GC_SHENANDOAH_SHENANDOAHCLOSURES_INLINE_HPP +#include "gc/shared/barrierSetNMethod.hpp" #include "gc/shenandoah/shenandoahAsserts.hpp" #include "gc/shenandoah/shenandoahClosures.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" +#include "gc/shenandoah/shenandoahNMethod.inline.hpp" #include "gc/shenandoah/shenandoahTraversalGC.hpp" #include "oops/compressedOops.inline.hpp" #include "runtime/atomic.hpp" @@ -157,6 +159,20 @@ ShouldNotReachHere(); } +ShenandoahCodeBlobAndDisarmClosure::ShenandoahCodeBlobAndDisarmClosure(OopClosure* cl) : + CodeBlobToOopClosure(cl, true /* fix_relocations */), + _bs(BarrierSet::barrier_set()->barrier_set_nmethod()) { +} + +void ShenandoahCodeBlobAndDisarmClosure::do_code_blob(CodeBlob* cb) { + nmethod* const nm = cb->as_nmethod_or_null(); + if (nm != NULL && nm->oops_do_try_claim()) { + assert(!ShenandoahNMethod::gc_data(nm)->is_unregistered(), "Should not be here"); + CodeBlobToOopClosure::do_code_blob(cb); + _bs->disarm(nm); + } +} + #ifdef ASSERT template void ShenandoahAssertNotForwardedClosure::do_oop_work(T* p) {