Skip to content

Commit c73a0ff

Browse files
committedOct 12, 2020
8252105: Parallel heap inspection for ZCollectedHeap
Reviewed-by: ayang, eosterlund
1 parent 45b09a3 commit c73a0ff

8 files changed

+290
-95
lines changed
 

‎src/hotspot/share/gc/z/zCollectedHeap.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,10 @@ void ZCollectedHeap::object_iterate(ObjectClosure* cl) {
237237
_heap.object_iterate(cl, true /* visit_weaks */);
238238
}
239239

240+
ParallelObjectIterator* ZCollectedHeap::parallel_object_iterator(uint nworkers) {
241+
return _heap.parallel_object_iterator(nworkers, true /* visit_weaks */);
242+
}
243+
240244
void ZCollectedHeap::keep_alive(oop obj) {
241245
_heap.keep_alive(obj);
242246
}

‎src/hotspot/share/gc/z/zCollectedHeap.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ class ZCollectedHeap : public CollectedHeap {
9494
virtual GrowableArray<MemoryPool*> memory_pools();
9595

9696
virtual void object_iterate(ObjectClosure* cl);
97+
virtual ParallelObjectIterator* parallel_object_iterator(uint nworkers);
9798

9899
virtual void keep_alive(oop obj);
99100

‎src/hotspot/share/gc/z/zGranuleMap.hpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -47,6 +47,9 @@ class ZGranuleMap {
4747
T get(uintptr_t offset) const;
4848
void put(uintptr_t offset, T value);
4949
void put(uintptr_t offset, size_t size, T value);
50+
51+
T get_acquire(uintptr_t offset) const;
52+
void release_put(uintptr_t offset, T value);
5053
};
5154

5255
template <typename T>

‎src/hotspot/share/gc/z/zGranuleMap.inline.hpp

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
2727
#include "gc/z/zGlobals.hpp"
2828
#include "gc/z/zGranuleMap.hpp"
2929
#include "memory/allocation.inline.hpp"
30+
#include "runtime/atomic.hpp"
3031
#include "utilities/align.hpp"
3132
#include "utilities/debug.hpp"
3233

@@ -46,7 +47,6 @@ template <typename T>
4647
inline size_t ZGranuleMap<T>::index_for_offset(uintptr_t offset) const {
4748
const size_t index = offset >> ZGranuleSizeShift;
4849
assert(index < _size, "Invalid index");
49-
5050
return index;
5151
}
5252

@@ -73,6 +73,18 @@ inline void ZGranuleMap<T>::put(uintptr_t offset, size_t size, T value) {
7373
}
7474
}
7575

76+
template <typename T>
77+
inline T ZGranuleMap<T>::get_acquire(uintptr_t offset) const {
78+
const size_t index = index_for_offset(offset);
79+
return Atomic::load_acquire(_map + index);
80+
}
81+
82+
template <typename T>
83+
inline void ZGranuleMap<T>::release_put(uintptr_t offset, T value) {
84+
const size_t index = index_for_offset(offset);
85+
Atomic::release_store(_map + index, value);
86+
}
87+
7688
template <typename T>
7789
inline ZGranuleMapIterator<T>::ZGranuleMapIterator(const ZGranuleMap<T>* map) :
7890
_map(map),

‎src/hotspot/share/gc/z/zHeap.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,13 @@ void ZHeap::relocate() {
436436

437437
void ZHeap::object_iterate(ObjectClosure* cl, bool visit_weaks) {
438438
assert(SafepointSynchronize::is_at_safepoint(), "Should be at safepoint");
439+
ZHeapIterator iter(1 /* nworkers */, visit_weaks);
440+
iter.object_iterate(cl, 0 /* worker_id */);
441+
}
439442

440-
ZHeapIterator iter;
441-
iter.objects_do(cl, visit_weaks);
443+
ParallelObjectIterator* ZHeap::parallel_object_iterator(uint nworkers, bool visit_weaks) {
444+
assert(SafepointSynchronize::is_at_safepoint(), "Should be at safepoint");
445+
return new ZHeapIterator(nworkers, visit_weaks);
442446
}
443447

444448
void ZHeap::pages_do(ZPageClosure* cl) {

‎src/hotspot/share/gc/z/zHeap.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ class ZHeap {
141141

142142
// Iteration
143143
void object_iterate(ObjectClosure* cl, bool visit_weaks);
144+
ParallelObjectIterator* parallel_object_iterator(uint nworkers, bool visit_weaks);
144145
void pages_do(ZPageClosure* cl);
145146

146147
// Serviceability

‎src/hotspot/share/gc/z/zHeapIterator.cpp

+204-70
Original file line numberDiff line numberDiff line change
@@ -23,42 +23,80 @@
2323

2424
#include "precompiled.hpp"
2525
#include "classfile/classLoaderData.hpp"
26-
#include "classfile/classLoaderDataGraph.hpp"
26+
#include "gc/shared/taskqueue.inline.hpp"
2727
#include "gc/z/zAddress.inline.hpp"
28-
#include "gc/z/zBarrier.inline.hpp"
2928
#include "gc/z/zGlobals.hpp"
3029
#include "gc/z/zGranuleMap.inline.hpp"
3130
#include "gc/z/zHeapIterator.hpp"
31+
#include "gc/z/zLock.inline.hpp"
3232
#include "gc/z/zOop.inline.hpp"
33-
#include "gc/z/zRootsIterator.hpp"
34-
#include "gc/z/zStat.hpp"
3533
#include "memory/iterator.inline.hpp"
3634
#include "runtime/stackWatermarkSet.hpp"
3735
#include "utilities/bitMap.inline.hpp"
38-
#include "utilities/stack.inline.hpp"
3936

4037
class ZHeapIteratorBitMap : public CHeapObj<mtGC> {
4138
private:
42-
CHeapBitMap _map;
39+
CHeapBitMap _bitmap;
4340

4441
public:
4542
ZHeapIteratorBitMap(size_t size_in_bits) :
46-
_map(size_in_bits) {}
43+
_bitmap(size_in_bits, mtGC) {}
4744

4845
bool try_set_bit(size_t index) {
49-
if (_map.at(index)) {
50-
return false;
46+
return _bitmap.par_set_bit(index);
47+
}
48+
};
49+
50+
class ZHeapIteratorContext {
51+
private:
52+
ZHeapIterator* const _iter;
53+
ZHeapIteratorQueue* const _queue;
54+
ZHeapIteratorArrayQueue* const _array_queue;
55+
const uint _worker_id;
56+
ZStatTimerDisable _timer_disable;
57+
58+
public:
59+
ZHeapIteratorContext(ZHeapIterator* iter, uint worker_id) :
60+
_iter(iter),
61+
_queue(_iter->_queues.queue(worker_id)),
62+
_array_queue(_iter->_array_queues.queue(worker_id)),
63+
_worker_id(worker_id) {}
64+
65+
void mark_and_push(oop obj) const {
66+
if (_iter->mark_object(obj)) {
67+
_queue->push(obj);
5168
}
69+
}
70+
71+
void push_array(const ObjArrayTask& array) const {
72+
_array_queue->push(array);
73+
}
74+
75+
bool pop(oop& obj) const {
76+
return _queue->pop_overflow(obj) || _queue->pop_local(obj);
77+
}
78+
79+
bool pop_array(ObjArrayTask& array) const {
80+
return _array_queue->pop_overflow(array) || _array_queue->pop_local(array);
81+
}
5282

53-
_map.set_bit(index);
54-
return true;
83+
bool steal(oop& obj) const {
84+
return _iter->_queues.steal(_worker_id, obj);
85+
}
86+
87+
bool steal_array(ObjArrayTask& array) const {
88+
return _iter->_array_queues.steal(_worker_id, array);
89+
}
90+
91+
bool is_drained() const {
92+
return _queue->is_empty() && _array_queue->is_empty();
5593
}
5694
};
5795

5896
template <bool Concurrent, bool Weak>
5997
class ZHeapIteratorRootOopClosure : public ZRootsIteratorClosure {
6098
private:
61-
ZHeapIterator* const _iter;
99+
const ZHeapIteratorContext& _context;
62100

63101
oop load_oop(oop* p) {
64102
if (Weak) {
@@ -73,12 +111,12 @@ class ZHeapIteratorRootOopClosure : public ZRootsIteratorClosure {
73111
}
74112

75113
public:
76-
ZHeapIteratorRootOopClosure(ZHeapIterator* iter) :
77-
_iter(iter) {}
114+
ZHeapIteratorRootOopClosure(const ZHeapIteratorContext& context) :
115+
_context(context) {}
78116

79117
virtual void do_oop(oop* p) {
80118
const oop obj = load_oop(p);
81-
_iter->push(obj);
119+
_context.mark_and_push(obj);
82120
}
83121

84122
virtual void do_oop(narrowOop* p) {
@@ -94,8 +132,8 @@ class ZHeapIteratorRootOopClosure : public ZRootsIteratorClosure {
94132
template <bool VisitReferents>
95133
class ZHeapIteratorOopClosure : public ClaimMetadataVisitingOopIterateClosure {
96134
private:
97-
ZHeapIterator* const _iter;
98-
const oop _base;
135+
const ZHeapIteratorContext& _context;
136+
const oop _base;
99137

100138
oop load_oop(oop* p) {
101139
if (VisitReferents) {
@@ -106,9 +144,9 @@ class ZHeapIteratorOopClosure : public ClaimMetadataVisitingOopIterateClosure {
106144
}
107145

108146
public:
109-
ZHeapIteratorOopClosure(ZHeapIterator* iter, oop base) :
147+
ZHeapIteratorOopClosure(const ZHeapIteratorContext& context, oop base) :
110148
ClaimMetadataVisitingOopIterateClosure(ClassLoaderData::_claim_other),
111-
_iter(iter),
149+
_context(context),
112150
_base(base) {}
113151

114152
virtual ReferenceIterationMode reference_iteration_mode() {
@@ -117,7 +155,7 @@ class ZHeapIteratorOopClosure : public ClaimMetadataVisitingOopIterateClosure {
117155

118156
virtual void do_oop(oop* p) {
119157
const oop obj = load_oop(p);
120-
_iter->push(obj);
158+
_context.mark_and_push(obj);
121159
}
122160

123161
virtual void do_oop(narrowOop* p) {
@@ -131,16 +169,50 @@ class ZHeapIteratorOopClosure : public ClaimMetadataVisitingOopIterateClosure {
131169
#endif
132170
};
133171

134-
ZHeapIterator::ZHeapIterator() :
135-
_visit_stack(),
136-
_visit_map(ZAddressOffsetMax) {}
172+
ZHeapIterator::ZHeapIterator(uint nworkers, bool visit_weaks) :
173+
_visit_weaks(visit_weaks),
174+
_timer_disable(),
175+
_bitmaps(ZAddressOffsetMax),
176+
_bitmaps_lock(),
177+
_queues(nworkers),
178+
_array_queues(nworkers),
179+
_roots(),
180+
_concurrent_roots(),
181+
_weak_roots(),
182+
_concurrent_weak_roots(),
183+
_terminator(nworkers, &_queues) {
184+
185+
// Create queues
186+
for (uint i = 0; i < _queues.size(); i++) {
187+
ZHeapIteratorQueue* const queue = new ZHeapIteratorQueue();
188+
queue->initialize();
189+
_queues.register_queue(i, queue);
190+
}
191+
192+
// Create array queues
193+
for (uint i = 0; i < _array_queues.size(); i++) {
194+
ZHeapIteratorArrayQueue* const array_queue = new ZHeapIteratorArrayQueue();
195+
array_queue->initialize();
196+
_array_queues.register_queue(i, array_queue);
197+
}
198+
}
137199

138200
ZHeapIterator::~ZHeapIterator() {
139-
ZVisitMapIterator iter(&_visit_map);
140-
for (ZHeapIteratorBitMap* map; iter.next(&map);) {
141-
delete map;
201+
// Destroy bitmaps
202+
ZHeapIteratorBitMapsIterator iter(&_bitmaps);
203+
for (ZHeapIteratorBitMap* bitmap; iter.next(&bitmap);) {
204+
delete bitmap;
205+
}
206+
207+
// Destroy array queues
208+
for (uint i = 0; i < _array_queues.size(); i++) {
209+
delete _array_queues.queue(i);
210+
}
211+
212+
// Destroy queues
213+
for (uint i = 0; i < _queues.size(); i++) {
214+
delete _queues.queue(i);
142215
}
143-
ClassLoaderDataGraph::clear_claimed_marks(ClassLoaderData::_claim_other);
144216
}
145217

146218
static size_t object_index_max() {
@@ -154,75 +226,137 @@ static size_t object_index(oop obj) {
154226
return (offset & mask) >> ZObjectAlignmentSmallShift;
155227
}
156228

157-
ZHeapIteratorBitMap* ZHeapIterator::object_map(oop obj) {
229+
ZHeapIteratorBitMap* ZHeapIterator::object_bitmap(oop obj) {
158230
const uintptr_t offset = ZAddress::offset(ZOop::to_address(obj));
159-
ZHeapIteratorBitMap* map = _visit_map.get(offset);
160-
if (map == NULL) {
161-
map = new ZHeapIteratorBitMap(object_index_max());
162-
_visit_map.put(offset, map);
231+
ZHeapIteratorBitMap* bitmap = _bitmaps.get_acquire(offset);
232+
if (bitmap == NULL) {
233+
ZLocker<ZLock> locker(&_bitmaps_lock);
234+
bitmap = _bitmaps.get(offset);
235+
if (bitmap == NULL) {
236+
// Install new bitmap
237+
bitmap = new ZHeapIteratorBitMap(object_index_max());
238+
_bitmaps.release_put(offset, bitmap);
239+
}
163240
}
164241

165-
return map;
242+
return bitmap;
166243
}
167244

168-
void ZHeapIterator::push(oop obj) {
245+
bool ZHeapIterator::mark_object(oop obj) {
169246
if (obj == NULL) {
170-
// Ignore
171-
return;
247+
return false;
172248
}
173249

174-
ZHeapIteratorBitMap* const map = object_map(obj);
250+
ZHeapIteratorBitMap* const bitmap = object_bitmap(obj);
175251
const size_t index = object_index(obj);
176-
if (!map->try_set_bit(index)) {
177-
// Already pushed
178-
return;
179-
}
180-
181-
// Push
182-
_visit_stack.push(obj);
252+
return bitmap->try_set_bit(index);
183253
}
184254

185-
template <typename RootsIterator, bool Concurrent, bool Weak>
186-
void ZHeapIterator::push_roots() {
187-
ZHeapIteratorRootOopClosure<Concurrent, Weak> cl(this);
188-
RootsIterator roots;
189-
roots.oops_do(&cl);
255+
template <bool Concurrent, bool Weak, typename RootsIterator>
256+
void ZHeapIterator::push_roots(const ZHeapIteratorContext& context, RootsIterator& iter) {
257+
ZHeapIteratorRootOopClosure<Concurrent, Weak> cl(context);
258+
iter.oops_do(&cl);
190259
}
191260

192261
template <bool VisitReferents>
193-
void ZHeapIterator::push_fields(oop obj) {
194-
ZHeapIteratorOopClosure<VisitReferents> cl(this, obj);
262+
void ZHeapIterator::follow_object(const ZHeapIteratorContext& context, oop obj) {
263+
ZHeapIteratorOopClosure<VisitReferents> cl(context, obj);
195264
obj->oop_iterate(&cl);
196265
}
197266

267+
void ZHeapIterator::follow_array(const ZHeapIteratorContext& context, oop obj) {
268+
// Follow klass
269+
ZHeapIteratorOopClosure<false /* VisitReferents */> cl(context, obj);
270+
cl.do_klass(obj->klass());
271+
272+
// Push array chunk
273+
context.push_array(ObjArrayTask(obj, 0 /* index */));
274+
}
275+
276+
void ZHeapIterator::follow_array_chunk(const ZHeapIteratorContext& context, const ObjArrayTask& array) {
277+
const objArrayOop obj = objArrayOop(array.obj());
278+
const int length = obj->length();
279+
const int start = array.index();
280+
const int stride = MIN2<int>(length - start, ObjArrayMarkingStride);
281+
const int end = start + stride;
282+
283+
// Push remaining array chunk first
284+
if (end < length) {
285+
context.push_array(ObjArrayTask(obj, end));
286+
}
287+
288+
// Follow array chunk
289+
ZHeapIteratorOopClosure<false /* VisitReferents */> cl(context, obj);
290+
obj->oop_iterate_range(&cl, start, end);
291+
}
292+
198293
template <bool VisitWeaks>
199-
void ZHeapIterator::objects_do(ObjectClosure* cl) {
200-
ZStatTimerDisable disable;
294+
void ZHeapIterator::visit_and_follow(const ZHeapIteratorContext& context, ObjectClosure* cl, oop obj) {
295+
// Visit
296+
cl->do_object(obj);
201297

202-
// Push roots to visit
203-
push_roots<ZRootsIterator, false /* Concurrent */, false /* Weak */>();
204-
push_roots<ZConcurrentRootsIteratorClaimOther, true /* Concurrent */, false /* Weak */>();
205-
if (VisitWeaks) {
206-
push_roots<ZWeakRootsIterator, false /* Concurrent */, true /* Weak */>();
207-
push_roots<ZConcurrentWeakRootsIterator, true /* Concurrent */, true /* Weak */>();
298+
// Follow
299+
if (obj->is_objArray()) {
300+
follow_array(context, obj);
301+
} else {
302+
follow_object<VisitWeaks>(context, obj);
208303
}
304+
}
209305

210-
// Drain stack
211-
while (!_visit_stack.is_empty()) {
212-
const oop obj = _visit_stack.pop();
306+
template <bool VisitWeaks>
307+
void ZHeapIterator::drain(const ZHeapIteratorContext& context, ObjectClosure* cl) {
308+
ObjArrayTask array;
309+
oop obj;
213310

214-
// Visit object
215-
cl->do_object(obj);
311+
do {
312+
while (context.pop(obj)) {
313+
visit_and_follow<VisitWeaks>(context, cl, obj);
314+
}
216315

217-
// Push fields to visit
218-
push_fields<VisitWeaks>(obj);
316+
if (context.pop_array(array)) {
317+
follow_array_chunk(context, array);
318+
}
319+
} while (!context.is_drained());
320+
}
321+
322+
template <bool VisitWeaks>
323+
void ZHeapIterator::steal(const ZHeapIteratorContext& context, ObjectClosure* cl) {
324+
ObjArrayTask array;
325+
oop obj;
326+
327+
if (context.steal_array(array)) {
328+
follow_array_chunk(context, array);
329+
} else if (context.steal(obj)) {
330+
visit_and_follow<VisitWeaks>(context, cl, obj);
331+
}
332+
}
333+
334+
template <bool VisitWeaks>
335+
void ZHeapIterator::drain_and_steal(const ZHeapIteratorContext& context, ObjectClosure* cl) {
336+
do {
337+
drain<VisitWeaks>(context, cl);
338+
steal<VisitWeaks>(context, cl);
339+
} while (!context.is_drained() || !_terminator.offer_termination());
340+
}
341+
342+
template <bool VisitWeaks>
343+
void ZHeapIterator::object_iterate_inner(const ZHeapIteratorContext& context, ObjectClosure* cl) {
344+
push_roots<false /* Concurrent */, false /* Weak */>(context, _roots);
345+
push_roots<true /* Concurrent */, false /* Weak */>(context, _concurrent_roots);
346+
if (VisitWeaks) {
347+
push_roots<false /* Concurrent */, true /* Weak */>(context, _weak_roots);
348+
push_roots<true /* Concurrent */, true /* Weak */>(context, _concurrent_weak_roots);
219349
}
350+
351+
drain_and_steal<VisitWeaks>(context, cl);
220352
}
221353

222-
void ZHeapIterator::objects_do(ObjectClosure* cl, bool visit_weaks) {
223-
if (visit_weaks) {
224-
objects_do<true /* VisitWeaks */>(cl);
354+
void ZHeapIterator::object_iterate(ObjectClosure* cl, uint worker_id) {
355+
ZHeapIteratorContext context(this, worker_id);
356+
357+
if (_visit_weaks) {
358+
object_iterate_inner<true /* VisitWeaks */>(context, cl);
225359
} else {
226-
objects_do<false /* VisitWeaks */>(cl);
360+
object_iterate_inner<false /* VisitWeaks */>(context, cl);
227361
}
228362
}
+56-20
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -24,37 +24,73 @@
2424
#ifndef SHARE_GC_Z_ZHEAPITERATOR_HPP
2525
#define SHARE_GC_Z_ZHEAPITERATOR_HPP
2626

27+
#include "gc/shared/collectedHeap.hpp"
28+
#include "gc/shared/taskTerminator.hpp"
29+
#include "gc/shared/taskqueue.hpp"
2730
#include "gc/z/zGranuleMap.hpp"
28-
#include "memory/allocation.hpp"
29-
#include "utilities/stack.hpp"
31+
#include "gc/z/zLock.hpp"
32+
#include "gc/z/zRootsIterator.hpp"
33+
#include "gc/z/zStat.hpp"
3034

31-
class ObjectClosure;
3235
class ZHeapIteratorBitMap;
36+
class ZHeapIteratorContext;
3337

34-
class ZHeapIterator : public StackObj {
35-
template<bool Concurrent, bool Weak> friend class ZHeapIteratorRootOopClosure;
36-
template<bool VisitReferents> friend class ZHeapIteratorOopClosure;
38+
using ZHeapIteratorBitMaps = ZGranuleMap<ZHeapIteratorBitMap*>;
39+
using ZHeapIteratorBitMapsIterator = ZGranuleMapIterator<ZHeapIteratorBitMap*>;
40+
using ZHeapIteratorQueue = OverflowTaskQueue<oop, mtGC>;
41+
using ZHeapIteratorQueues = GenericTaskQueueSet<ZHeapIteratorQueue, mtGC>;
42+
using ZHeapIteratorArrayQueue = OverflowTaskQueue<ObjArrayTask, mtGC>;
43+
using ZHeapIteratorArrayQueues = GenericTaskQueueSet<ZHeapIteratorArrayQueue, mtGC>;
44+
45+
class ZHeapIterator : public ParallelObjectIterator {
46+
friend class ZHeapIteratorContext;
3747

3848
private:
39-
typedef ZGranuleMap<ZHeapIteratorBitMap*> ZVisitMap;
40-
typedef ZGranuleMapIterator<ZHeapIteratorBitMap*> ZVisitMapIterator;
41-
typedef Stack<oop, mtGC> ZVisitStack;
49+
const bool _visit_weaks;
50+
ZStatTimerDisable _timer_disable;
51+
ZHeapIteratorBitMaps _bitmaps;
52+
ZLock _bitmaps_lock;
53+
ZHeapIteratorQueues _queues;
54+
ZHeapIteratorArrayQueues _array_queues;
55+
ZRootsIterator _roots;
56+
ZConcurrentRootsIteratorClaimOther _concurrent_roots;
57+
ZWeakRootsIterator _weak_roots;
58+
ZConcurrentWeakRootsIterator _concurrent_weak_roots;
59+
TaskTerminator _terminator;
60+
61+
ZHeapIteratorBitMap* object_bitmap(oop obj);
62+
63+
bool mark_object(oop obj);
64+
65+
template <bool Concurrent, bool Weak, typename RootsIterator>
66+
void push_roots(const ZHeapIteratorContext& context, RootsIterator& iter);
67+
68+
template <bool VisitReferents>
69+
void follow_object(const ZHeapIteratorContext& context, oop obj);
70+
71+
void follow_array(const ZHeapIteratorContext& context, oop obj);
72+
void follow_array_chunk(const ZHeapIteratorContext& context, const ObjArrayTask& array);
73+
74+
template <bool VisitWeaks>
75+
void visit_and_follow(const ZHeapIteratorContext& context, ObjectClosure* cl, oop obj);
76+
77+
template <bool VisitWeaks>
78+
void drain(const ZHeapIteratorContext& context, ObjectClosure* cl);
4279

43-
ZVisitStack _visit_stack;
44-
ZVisitMap _visit_map;
80+
template <bool VisitWeaks>
81+
void steal(const ZHeapIteratorContext& context, ObjectClosure* cl);
4582

46-
ZHeapIteratorBitMap* object_map(oop obj);
47-
void push(oop obj);
83+
template <bool VisitWeaks>
84+
void drain_and_steal(const ZHeapIteratorContext& context, ObjectClosure* cl);
4885

49-
template <typename RootsIterator, bool Concurrent, bool Weak> void push_roots();
50-
template <bool VisitReferents> void push_fields(oop obj);
51-
template <bool VisitReferents> void objects_do(ObjectClosure* cl);
86+
template <bool VisitWeaks>
87+
void object_iterate_inner(const ZHeapIteratorContext& context, ObjectClosure* cl);
5288

5389
public:
54-
ZHeapIterator();
55-
~ZHeapIterator();
90+
ZHeapIterator(uint nworkers, bool visit_weaks);
91+
virtual ~ZHeapIterator();
5692

57-
void objects_do(ObjectClosure* cl, bool visit_weaks);
93+
virtual void object_iterate(ObjectClosure* cl, uint worker_id);
5894
};
5995

6096
#endif // SHARE_GC_Z_ZHEAPITERATOR_HPP

1 commit comments

Comments
 (1)

bridgekeeper[bot] commented on Oct 12, 2020

@bridgekeeper[bot]
Please sign in to comment.