152 ZHeapIteratorBitMap* const map = object_map(obj);
153 const size_t index = object_index(obj);
154 if (!map->try_set_bit(index)) {
155 // Already pushed
156 return;
157 }
158
159 // Push
160 _visit_stack.push(obj);
161 }
162
163 void ZHeapIterator::objects_do(ObjectClosure* cl) {
164 // Push roots onto stack
165 {
166 // Note that we also visit the JVMTI weak tag map as if they were
167 // strong roots to make sure we visit all tagged objects, even
168 // those that might now have become unreachable. If we didn't do
169 // this the user would have expected to see ObjectFree events for
170 // unreachable objects in the tag map.
171 ZRootsIterator roots;
172 ZHeapIteratorRootOopClosure root_cl(this);
173 roots.oops_do(&root_cl, true /* visit_jvmti_weak_export */);
174 }
175
176 // Drain stack
177 while (!_visit_stack.is_empty()) {
178 const oop obj = _visit_stack.pop();
179
180 // Visit
181 cl->do_object(obj);
182
183 // Push members to visit
184 ZHeapIteratorOopClosure push_cl(this, obj, _visit_referents);
185 obj->oop_iterate(&push_cl);
186 }
187 }
|
152 ZHeapIteratorBitMap* const map = object_map(obj);
153 const size_t index = object_index(obj);
154 if (!map->try_set_bit(index)) {
155 // Already pushed
156 return;
157 }
158
159 // Push
160 _visit_stack.push(obj);
161 }
162
163 void ZHeapIterator::objects_do(ObjectClosure* cl) {
164 // Push roots onto stack
165 {
166 // Note that we also visit the JVMTI weak tag map as if they were
167 // strong roots to make sure we visit all tagged objects, even
168 // those that might now have become unreachable. If we didn't do
169 // this the user would have expected to see ObjectFree events for
170 // unreachable objects in the tag map.
171 ZRootsIterator roots;
172 ZConcurrentRootsIterator concurrent_roots(false /* claim_clds */);
173 ZHeapIteratorRootOopClosure root_cl(this);
174 roots.oops_do(&root_cl, true /* visit_jvmti_weak_export */);
175 concurrent_roots.oops_do(&root_cl);
176 }
177
178 // Drain stack
179 while (!_visit_stack.is_empty()) {
180 const oop obj = _visit_stack.pop();
181
182 // Visit
183 cl->do_object(obj);
184
185 // Push members to visit
186 ZHeapIteratorOopClosure push_cl(this, obj, _visit_referents);
187 obj->oop_iterate(&push_cl);
188 }
189 }
|