30 #include "gc/shared/barrierSet.hpp"
31 #include "gc/shared/barrierSetNMethod.hpp"
32 #include "gc/shenandoah/shenandoahClosures.inline.hpp"
33
34 nmethod* ShenandoahNMethod::nm() const {
35 return _nm;
36 }
37
38 ShenandoahNMethodLock* ShenandoahNMethod::lock() {
39 return &_lock;
40 }
41
42 ShenandoahNMethodLock* ShenandoahNMethod::ic_lock() {
43 return &_ic_lock;
44 }
45
46 bool ShenandoahNMethod::is_unregistered() const {
47 return _unregistered;
48 }
49
50 void ShenandoahNMethod::oops_do(OopClosure* oops, bool fix_relocations) {
51 for (int c = 0; c < _oops_count; c ++) {
52 oops->do_oop(_oops[c]);
53 }
54
55 oop* const begin = _nm->oops_begin();
56 oop* const end = _nm->oops_end();
57 for (oop* p = begin; p < end; p++) {
58 if (*p != Universe::non_oop_word()) {
59 oops->do_oop(p);
60 }
61 }
62
63 if (fix_relocations && _has_non_immed_oops) {
64 _nm->fix_oop_relocations();
65 }
66 }
67
68 void ShenandoahNMethod::heal_nmethod_metadata(ShenandoahNMethod* nmethod_data) {
69 ShenandoahEvacuateUpdateMetadataClosure cl;
70 nmethod_data->oops_do(&cl, true /*fix relocation*/);
71 }
72
73 void ShenandoahNMethod::disarm_nmethod(nmethod* nm) {
74 BarrierSetNMethod* const bs = BarrierSet::barrier_set()->barrier_set_nmethod();
75 if (bs->is_armed(nm)) {
76 bs->disarm(nm);
77 }
78 }
79
80 ShenandoahNMethod* ShenandoahNMethod::gc_data(nmethod* nm) {
81 return nm->gc_data<ShenandoahNMethod>();
82 }
83
84 void ShenandoahNMethod::attach_gc_data(nmethod* nm, ShenandoahNMethod* gc_data) {
85 nm->set_gc_data<ShenandoahNMethod>(gc_data);
86 }
87
88 ShenandoahNMethodLock* ShenandoahNMethod::lock_for_nmethod(nmethod* nm) {
89 return gc_data(nm)->lock();
90 }
|
30 #include "gc/shared/barrierSet.hpp"
31 #include "gc/shared/barrierSetNMethod.hpp"
32 #include "gc/shenandoah/shenandoahClosures.inline.hpp"
33
34 nmethod* ShenandoahNMethod::nm() const {
35 return _nm;
36 }
37
38 ShenandoahNMethodLock* ShenandoahNMethod::lock() {
39 return &_lock;
40 }
41
42 ShenandoahNMethodLock* ShenandoahNMethod::ic_lock() {
43 return &_ic_lock;
44 }
45
46 bool ShenandoahNMethod::is_unregistered() const {
47 return _unregistered;
48 }
49
50 void ShenandoahNMethod::oops_do(OopClosure* oops, bool fix_relocations, ICacheInvalidationContext* icic) {
51 assert(!fix_relocations || icic != nullptr, "Need ICIC if fixing relocations");
52
53 for (int c = 0; c < _oops_count; c ++) {
54 oops->do_oop(_oops[c]);
55 }
56
57 oop* const begin = _nm->oops_begin();
58 oop* const end = _nm->oops_end();
59 for (oop* p = begin; p < end; p++) {
60 if (*p != Universe::non_oop_word()) {
61 oops->do_oop(p);
62 }
63 }
64
65 if (fix_relocations && _has_non_immed_oops) {
66 _nm->fix_oop_relocations(icic);
67 }
68 }
69
70 void ShenandoahNMethod::heal_nmethod_metadata(ShenandoahNMethod* nmethod_data, ICacheInvalidationContext* icic) {
71 ShenandoahEvacuateUpdateMetadataClosure cl;
72 nmethod_data->oops_do(&cl, /* fix_relocations = */ true, icic);
73 }
74
75 void ShenandoahNMethod::disarm_nmethod(nmethod* nm) {
76 BarrierSetNMethod* const bs = BarrierSet::barrier_set()->barrier_set_nmethod();
77 if (bs->is_armed(nm)) {
78 bs->disarm(nm);
79 }
80 }
81
82 ShenandoahNMethod* ShenandoahNMethod::gc_data(nmethod* nm) {
83 return nm->gc_data<ShenandoahNMethod>();
84 }
85
86 void ShenandoahNMethod::attach_gc_data(nmethod* nm, ShenandoahNMethod* gc_data) {
87 nm->set_gc_data<ShenandoahNMethod>(gc_data);
88 }
89
90 ShenandoahNMethodLock* ShenandoahNMethod::lock_for_nmethod(nmethod* nm) {
91 return gc_data(nm)->lock();
92 }
|