24 #include "code/relocInfo.hpp"
25 #include "code/nmethod.hpp"
26 #include "code/icBuffer.hpp"
27 #include "gc/shared/barrierSet.hpp"
28 #include "gc/shared/barrierSetNMethod.hpp"
29 #include "gc/z/zGlobals.hpp"
30 #include "gc/z/zLock.inline.hpp"
31 #include "gc/z/zNMethod.hpp"
32 #include "gc/z/zNMethodData.hpp"
33 #include "gc/z/zNMethodTable.hpp"
34 #include "gc/z/zOopClosures.inline.hpp"
35 #include "gc/z/zTask.hpp"
36 #include "gc/z/zWorkers.hpp"
37 #include "logging/log.hpp"
38 #include "memory/allocation.inline.hpp"
39 #include "memory/iterator.hpp"
40 #include "memory/resourceArea.hpp"
41 #include "runtime/atomic.hpp"
42 #include "runtime/orderAccess.hpp"
43 #include "utilities/debug.hpp"
44
45 static ZNMethodData* gc_data(const nmethod* nm) {
46 return nm->gc_data<ZNMethodData>();
47 }
48
49 static void set_gc_data(nmethod* nm, ZNMethodData* data) {
50 return nm->set_gc_data<ZNMethodData>(data);
51 }
52
53 void ZNMethod::attach_gc_data(nmethod* nm) {
54 GrowableArray<oop*> immediate_oops;
55 bool non_immediate_oops = false;
56
57 // Find all oops relocations
58 RelocIterator iter(nm);
59 while (iter.next()) {
60 if (iter.type() != relocInfo::oop_type) {
61 // Not an oop
62 continue;
|
24 #include "code/relocInfo.hpp"
25 #include "code/nmethod.hpp"
26 #include "code/icBuffer.hpp"
27 #include "gc/shared/barrierSet.hpp"
28 #include "gc/shared/barrierSetNMethod.hpp"
29 #include "gc/z/zGlobals.hpp"
30 #include "gc/z/zLock.inline.hpp"
31 #include "gc/z/zNMethod.hpp"
32 #include "gc/z/zNMethodData.hpp"
33 #include "gc/z/zNMethodTable.hpp"
34 #include "gc/z/zOopClosures.inline.hpp"
35 #include "gc/z/zTask.hpp"
36 #include "gc/z/zWorkers.hpp"
37 #include "logging/log.hpp"
38 #include "memory/allocation.inline.hpp"
39 #include "memory/iterator.hpp"
40 #include "memory/resourceArea.hpp"
41 #include "runtime/atomic.hpp"
42 #include "runtime/orderAccess.hpp"
43 #include "utilities/debug.hpp"
44 #include "utilities/globalCounter.inline.hpp"
45
46 static ZNMethodData* gc_data(const nmethod* nm) {
47 return nm->gc_data<ZNMethodData>();
48 }
49
50 static void set_gc_data(nmethod* nm, ZNMethodData* data) {
51 return nm->set_gc_data<ZNMethodData>(data);
52 }
53
54 void ZNMethod::attach_gc_data(nmethod* nm) {
55 GrowableArray<oop*> immediate_oops;
56 bool non_immediate_oops = false;
57
58 // Find all oops relocations
59 RelocIterator iter(nm);
60 while (iter.next()) {
61 if (iter.type() != relocInfo::oop_type) {
62 // Not an oop
63 continue;
|
188
189 void ZNMethod::disarm_nmethod(nmethod* nm) {
190 BarrierSetNMethod* const bs = BarrierSet::barrier_set()->barrier_set_nmethod();
191 if (bs != NULL) {
192 bs->disarm(nm);
193 }
194 }
195
196 void ZNMethod::nmethod_oops_do(nmethod* nm, OopClosure* cl) {
197 // Process oops table
198 {
199 oop* const begin = nm->oops_begin();
200 oop* const end = nm->oops_end();
201 for (oop* p = begin; p < end; p++) {
202 if (*p != Universe::non_oop_word()) {
203 cl->do_oop(p);
204 }
205 }
206 }
207
208 ZNMethodDataOops* const oops = gc_data(nm)->oops();
209
210 // Process immediate oops
211 {
212 oop** const begin = oops->immediates_begin();
213 oop** const end = oops->immediates_end();
214 for (oop** p = begin; p < end; p++) {
215 if (**p != Universe::non_oop_word()) {
216 cl->do_oop(*p);
217 }
218 }
219 }
220
221 // Process non-immediate oops
222 if (oops->has_non_immediates()) {
223 nm->fix_oop_relocations();
224 }
225 }
226
|
189
190 void ZNMethod::disarm_nmethod(nmethod* nm) {
191 BarrierSetNMethod* const bs = BarrierSet::barrier_set()->barrier_set_nmethod();
192 if (bs != NULL) {
193 bs->disarm(nm);
194 }
195 }
196
197 void ZNMethod::nmethod_oops_do(nmethod* nm, OopClosure* cl) {
198 // Process oops table
199 {
200 oop* const begin = nm->oops_begin();
201 oop* const end = nm->oops_end();
202 for (oop* p = begin; p < end; p++) {
203 if (*p != Universe::non_oop_word()) {
204 cl->do_oop(p);
205 }
206 }
207 }
208
209 GlobalCounter::CriticalSection cs(Thread::current());
210 ZNMethodDataOops* const oops = gc_data(nm)->oops();
211
212 // Process immediate oops
213 {
214 oop** const begin = oops->immediates_begin();
215 oop** const end = oops->immediates_end();
216 for (oop** p = begin; p < end; p++) {
217 if (**p != Universe::non_oop_word()) {
218 cl->do_oop(*p);
219 }
220 }
221 }
222
223 // Process non-immediate oops
224 if (oops->has_non_immediates()) {
225 nm->fix_oop_relocations();
226 }
227 }
228
|