102 const size_t nstripes = calculate_nstripes(_nworkers);
103 _stripes.set_nstripes(nstripes);
104
105 // Update statistics
106 ZStatMark::set_at_mark_start(nstripes);
107
108 // Print worker/stripe distribution
109 LogTarget(Debug, gc, marking) log;
110 if (log.is_enabled()) {
111 log.print("Mark Worker/Stripe Distribution");
112 for (uint worker_id = 0; worker_id < _nworkers; worker_id++) {
113 const ZMarkStripe* const stripe = _stripes.stripe_for_worker(_nworkers, worker_id);
114 const size_t stripe_id = _stripes.stripe_id(stripe);
115 log.print(" Worker %u(%u) -> Stripe " SIZE_FORMAT "(" SIZE_FORMAT ")",
116 worker_id, _nworkers, stripe_id, nstripes);
117 }
118 }
119 }
120
121 class ZMarkRootsIteratorClosure : public ZRootsIteratorClosure {
122 public:
123 ZMarkRootsIteratorClosure() {
124 ZStatTLAB::reset();
125 }
126
127 ~ZMarkRootsIteratorClosure() {
128 ZStatTLAB::publish();
129 }
130
131 virtual void do_thread(Thread* thread) {
132 ZRootsIteratorClosure::do_thread(thread);
133
134 // Update thread local address bad mask
135 ZThreadLocalData::set_address_bad_mask(thread, ZAddressBadMask);
136
137 // Retire TLAB
138 if (UseTLAB && thread->is_Java_thread()) {
139 thread->tlab().retire(ZStatTLAB::get());
140 thread->tlab().resize();
141 }
142 }
143
144 virtual void do_oop(oop* p) {
145 ZBarrier::mark_barrier_on_root_oop_field(p);
146 }
147
148 virtual void do_oop(narrowOop* p) {
149 ShouldNotReachHere();
150 }
151 };
152
153 class ZMarkRootsTask : public ZTask {
154 private:
155 ZMark* const _mark;
156 ZRootsIterator _roots;
157 ZMarkRootsIteratorClosure _cl;
158
|
102 const size_t nstripes = calculate_nstripes(_nworkers);
103 _stripes.set_nstripes(nstripes);
104
105 // Update statistics
106 ZStatMark::set_at_mark_start(nstripes);
107
108 // Print worker/stripe distribution
109 LogTarget(Debug, gc, marking) log;
110 if (log.is_enabled()) {
111 log.print("Mark Worker/Stripe Distribution");
112 for (uint worker_id = 0; worker_id < _nworkers; worker_id++) {
113 const ZMarkStripe* const stripe = _stripes.stripe_for_worker(_nworkers, worker_id);
114 const size_t stripe_id = _stripes.stripe_id(stripe);
115 log.print(" Worker %u(%u) -> Stripe " SIZE_FORMAT "(" SIZE_FORMAT ")",
116 worker_id, _nworkers, stripe_id, nstripes);
117 }
118 }
119 }
120
121 class ZMarkRootsIteratorClosure : public ZRootsIteratorClosure {
122 private:
123 static void fixup_address(HeapWord** p) {
124 *p = (HeapWord*)ZAddress::good_or_null((uintptr_t)*p);
125 }
126
127 public:
128 ZMarkRootsIteratorClosure() {
129 ZStatTLAB::reset();
130 }
131
132 ~ZMarkRootsIteratorClosure() {
133 ZStatTLAB::publish();
134 }
135
136 virtual void do_thread(Thread* thread) {
137 ZRootsIteratorClosure::do_thread(thread);
138
139 // Update thread local address bad mask
140 ZThreadLocalData::set_address_bad_mask(thread, ZAddressBadMask);
141
142 // Retire TLAB
143 if (UseTLAB && thread->is_Java_thread()) {
144 thread->tlab().addresses_do(fixup_address);
145 thread->tlab().retire(ZStatTLAB::get());
146 thread->tlab().resize();
147 }
148 }
149
150 virtual void do_oop(oop* p) {
151 ZBarrier::mark_barrier_on_root_oop_field(p);
152 }
153
154 virtual void do_oop(narrowOop* p) {
155 ShouldNotReachHere();
156 }
157 };
158
159 class ZMarkRootsTask : public ZTask {
160 private:
161 ZMark* const _mark;
162 ZRootsIterator _roots;
163 ZMarkRootsIteratorClosure _cl;
164
|