34 friend class ShenandoahHeap;
35 private:
36 size_t const _map_size;
37 size_t const _region_size_bytes_shift;
38 ReservedSpace _map_space;
39 char* const _cset_map;
40 // Bias cset map's base address for fast test if an oop is in cset
41 char* const _biased_cset_map;
42
43 ShenandoahHeap* const _heap;
44
45 size_t _garbage;
46 size_t _used;
47 size_t _region_count;
48
49 shenandoah_padding(0);
50 volatile jint _current_index;
51 shenandoah_padding(1);
52
53 public:
54 ShenandoahCollectionSet(ShenandoahHeap* heap, char* heap_base, size_t size);
55
56 // Add region to collection set
57 void add_region(ShenandoahHeapRegion* r);
58
59 // MT version
60 ShenandoahHeapRegion* claim_next();
61
62 // Single-thread version
63 ShenandoahHeapRegion* next();
64
65 size_t count() const { return _region_count; }
66 bool is_empty() const { return _region_count == 0; }
67
68 void clear_current_index() {
69 _current_index = 0;
70 }
71
72 inline bool is_in(ShenandoahHeapRegion* r) const;
73 inline bool is_in(size_t region_idx) const;
74 inline bool is_in(oop obj) const;
|
34 friend class ShenandoahHeap;
35 private:
36 size_t const _map_size;
37 size_t const _region_size_bytes_shift;
38 ReservedSpace _map_space;
39 char* const _cset_map;
40 // Bias cset map's base address for fast test if an oop is in cset
41 char* const _biased_cset_map;
42
43 ShenandoahHeap* const _heap;
44
45 size_t _garbage;
46 size_t _used;
47 size_t _region_count;
48
49 shenandoah_padding(0);
50 volatile jint _current_index;
51 shenandoah_padding(1);
52
53 public:
54 ShenandoahCollectionSet(ShenandoahHeap* heap, ReservedSpace space, char* heap_base);
55
56 // Add region to collection set
57 void add_region(ShenandoahHeapRegion* r);
58
59 // MT version
60 ShenandoahHeapRegion* claim_next();
61
62 // Single-thread version
63 ShenandoahHeapRegion* next();
64
65 size_t count() const { return _region_count; }
66 bool is_empty() const { return _region_count == 0; }
67
68 void clear_current_index() {
69 _current_index = 0;
70 }
71
72 inline bool is_in(ShenandoahHeapRegion* r) const;
73 inline bool is_in(size_t region_idx) const;
74 inline bool is_in(oop obj) const;
|