65 _is_unloading = true;
66 }
67 }
68
69 virtual void do_oop(narrowOop* p) {
70 ShouldNotReachHere();
71 }
72
73 bool is_unloading() const {
74 return _is_unloading;
75 }
76 };
77
78 class ShenandoahIsUnloadingBehaviour : public IsUnloadingBehaviour {
79 public:
80 virtual bool has_dead_oop(nmethod* nm) const {
81 assert(ShenandoahHeap::heap()->is_concurrent_weak_root_in_progress(), "Only for this phase");
82 ShenandoahNMethod* data = ShenandoahNMethod::gc_data(nm);
83 ShenandoahNMethodLocker locker(data->lock());
84 ShenandoahIsUnloadingOopClosure cl;
85 data->oops_do(&cl);
86 return cl.is_unloading();
87 }
88 };
89
90 class ShenandoahCompiledICProtectionBehaviour : public CompiledICProtectionBehaviour {
91 public:
92 virtual bool lock(nmethod* nm) {
93 ShenandoahNMethodLock* const lock = ShenandoahNMethod::ic_lock_for_nmethod(nm);
94 assert(lock != nullptr, "Not yet registered?");
95 lock->lock();
96 return true;
97 }
98
99 virtual void unlock(nmethod* nm) {
100 ShenandoahNMethodLock* const lock = ShenandoahNMethod::ic_lock_for_nmethod(nm);
101 assert(lock != nullptr, "Not yet registered?");
102 lock->unlock();
103 }
104
105 virtual bool is_safe(nmethod* nm) {
|
65 _is_unloading = true;
66 }
67 }
68
69 virtual void do_oop(narrowOop* p) {
70 ShouldNotReachHere();
71 }
72
73 bool is_unloading() const {
74 return _is_unloading;
75 }
76 };
77
78 class ShenandoahIsUnloadingBehaviour : public IsUnloadingBehaviour {
79 public:
80 virtual bool has_dead_oop(nmethod* nm) const {
81 assert(ShenandoahHeap::heap()->is_concurrent_weak_root_in_progress(), "Only for this phase");
82 ShenandoahNMethod* data = ShenandoahNMethod::gc_data(nm);
83 ShenandoahNMethodLocker locker(data->lock());
84 ShenandoahIsUnloadingOopClosure cl;
85 data->oops_do(&cl, /* fix_relocations = */ false, /* icic = */ nullptr);
86 return cl.is_unloading();
87 }
88 };
89
90 class ShenandoahCompiledICProtectionBehaviour : public CompiledICProtectionBehaviour {
91 public:
92 virtual bool lock(nmethod* nm) {
93 ShenandoahNMethodLock* const lock = ShenandoahNMethod::ic_lock_for_nmethod(nm);
94 assert(lock != nullptr, "Not yet registered?");
95 lock->lock();
96 return true;
97 }
98
99 virtual void unlock(nmethod* nm) {
100 ShenandoahNMethodLock* const lock = ShenandoahNMethod::ic_lock_for_nmethod(nm);
101 assert(lock != nullptr, "Not yet registered?");
102 lock->unlock();
103 }
104
105 virtual bool is_safe(nmethod* nm) {
|