253
254 inline ShenandoahHeapRegion* const heap_region_containing(const void* addr) const;
255 inline size_t heap_region_index_containing(const void* addr) const;
256
257 inline ShenandoahHeapRegion* const get_region(size_t region_idx) const;
258
259 void heap_region_iterate(ShenandoahHeapRegionClosure* blk) const;
260 void parallel_heap_region_iterate(ShenandoahHeapRegionClosure* blk) const;
261
262 // ---------- GC state machinery
263 //
264 // GC state describes the important parts of collector state, that may be
265 // used to make barrier selection decisions in the native and generated code.
266 // Multiple bits can be set at once.
267 //
268 // Important invariant: when GC state is zero, the heap is stable, and no barriers
269 // are required.
270 //
271 public:
272 enum GCStateBitPos {
273 // Heap has forwarded objects: need RB, ACMP, CAS barriers.
274 HAS_FORWARDED_BITPOS = 0,
275
276 // Heap is under marking: needs SATB barriers.
277 MARKING_BITPOS = 1,
278
279 // Heap is under evacuation: needs WB barriers. (Set together with UNSTABLE)
280 EVACUATION_BITPOS = 2,
281
282 // Heap is under updating: needs SVRB/SVWB barriers.
283 UPDATEREFS_BITPOS = 3,
284
285 // Heap is under traversal collection
286 TRAVERSAL_BITPOS = 4,
287 };
288
289 enum GCState {
290 STABLE = 0,
291 HAS_FORWARDED = 1 << HAS_FORWARDED_BITPOS,
292 MARKING = 1 << MARKING_BITPOS,
293 EVACUATION = 1 << EVACUATION_BITPOS,
294 UPDATEREFS = 1 << UPDATEREFS_BITPOS,
295 TRAVERSAL = 1 << TRAVERSAL_BITPOS,
296 };
297
298 private:
299 ShenandoahSharedBitmap _gc_state;
300 ShenandoahSharedFlag _degenerated_gc_in_progress;
301 ShenandoahSharedFlag _full_gc_in_progress;
302 ShenandoahSharedFlag _full_gc_move_in_progress;
|
253
254 inline ShenandoahHeapRegion* const heap_region_containing(const void* addr) const;
255 inline size_t heap_region_index_containing(const void* addr) const;
256
257 inline ShenandoahHeapRegion* const get_region(size_t region_idx) const;
258
259 void heap_region_iterate(ShenandoahHeapRegionClosure* blk) const;
260 void parallel_heap_region_iterate(ShenandoahHeapRegionClosure* blk) const;
261
262 // ---------- GC state machinery
263 //
264 // GC state describes the important parts of collector state, that may be
265 // used to make barrier selection decisions in the native and generated code.
266 // Multiple bits can be set at once.
267 //
268 // Important invariant: when GC state is zero, the heap is stable, and no barriers
269 // are required.
270 //
271 public:
272 enum GCStateBitPos {
273 // Heap has forwarded objects: needs LRB barriers.
274 HAS_FORWARDED_BITPOS = 0,
275
276 // Heap is under marking: needs SATB barriers.
277 MARKING_BITPOS = 1,
278
279 // Heap is under evacuation: needs LRB barriers. (Set together with HAS_FORWARDED)
280 EVACUATION_BITPOS = 2,
281
282 // Heap is under updating: needs no additional barriers.
283 UPDATEREFS_BITPOS = 3,
284
285 // Heap is under traversal collection
286 TRAVERSAL_BITPOS = 4,
287 };
288
289 enum GCState {
290 STABLE = 0,
291 HAS_FORWARDED = 1 << HAS_FORWARDED_BITPOS,
292 MARKING = 1 << MARKING_BITPOS,
293 EVACUATION = 1 << EVACUATION_BITPOS,
294 UPDATEREFS = 1 << UPDATEREFS_BITPOS,
295 TRAVERSAL = 1 << TRAVERSAL_BITPOS,
296 };
297
298 private:
299 ShenandoahSharedBitmap _gc_state;
300 ShenandoahSharedFlag _degenerated_gc_in_progress;
301 ShenandoahSharedFlag _full_gc_in_progress;
302 ShenandoahSharedFlag _full_gc_move_in_progress;
|