34 #include "gc/shared/classUnloadingContext.hpp"
35 #include "gc/shared/suspendibleThreadSet.hpp"
36 #include "gc/shenandoah/shenandoahNMethod.inline.hpp"
37 #include "gc/shenandoah/shenandoahLock.hpp"
38 #include "gc/shenandoah/shenandoahPhaseTimings.hpp"
39 #include "gc/shenandoah/shenandoahRootProcessor.hpp"
40 #include "gc/shenandoah/shenandoahUnload.hpp"
41 #include "gc/shenandoah/shenandoahVerifier.hpp"
42 #include "memory/iterator.hpp"
43 #include "memory/metaspaceUtils.hpp"
44 #include "memory/resourceArea.hpp"
45 #include "oops/access.inline.hpp"
46
47 class ShenandoahIsUnloadingOopClosure : public OopClosure {
48 private:
49 ShenandoahMarkingContext* const _marking_context;
50 bool _is_unloading;
51
52 public:
53 ShenandoahIsUnloadingOopClosure() :
54 _marking_context(ShenandoahHeap::heap()->complete_marking_context()),
55 _is_unloading(false) {
56 }
57
58 virtual void do_oop(oop* p) {
59 if (_is_unloading) {
60 return;
61 }
62
63 const oop o = RawAccess<>::oop_load(p);
64 if (!CompressedOops::is_null(o) &&
65 !_marking_context->is_marked(o)) {
66 _is_unloading = true;
67 }
68 }
69
70 virtual void do_oop(narrowOop* p) {
71 ShouldNotReachHere();
72 }
73
74 bool is_unloading() const {
|
34 #include "gc/shared/classUnloadingContext.hpp"
35 #include "gc/shared/suspendibleThreadSet.hpp"
36 #include "gc/shenandoah/shenandoahNMethod.inline.hpp"
37 #include "gc/shenandoah/shenandoahLock.hpp"
38 #include "gc/shenandoah/shenandoahPhaseTimings.hpp"
39 #include "gc/shenandoah/shenandoahRootProcessor.hpp"
40 #include "gc/shenandoah/shenandoahUnload.hpp"
41 #include "gc/shenandoah/shenandoahVerifier.hpp"
42 #include "memory/iterator.hpp"
43 #include "memory/metaspaceUtils.hpp"
44 #include "memory/resourceArea.hpp"
45 #include "oops/access.inline.hpp"
46
47 class ShenandoahIsUnloadingOopClosure : public OopClosure {
48 private:
49 ShenandoahMarkingContext* const _marking_context;
50 bool _is_unloading;
51
52 public:
53 ShenandoahIsUnloadingOopClosure() :
54 // TODO: In non-generational mode, this should still be complete_marking_context()
55 _marking_context(ShenandoahHeap::heap()->marking_context()),
56 _is_unloading(false) {
57 }
58
59 virtual void do_oop(oop* p) {
60 if (_is_unloading) {
61 return;
62 }
63
64 const oop o = RawAccess<>::oop_load(p);
65 if (!CompressedOops::is_null(o) &&
66 !_marking_context->is_marked(o)) {
67 _is_unloading = true;
68 }
69 }
70
71 virtual void do_oop(narrowOop* p) {
72 ShouldNotReachHere();
73 }
74
75 bool is_unloading() const {
|