244 inline size_t scanned_block_size(const HeapWord* addr) const {
245 return HeapRegion::block_size(addr); // Avoid virtual call
246 }
247
248 void report_region_type_change(G1HeapRegionTraceType::Type to);
249
250 protected:
251 // The index of this region in the heap region sequence.
252 uint _hrm_index;
253
254 AllocationContext_t _allocation_context;
255
256 HeapRegionType _type;
257
258 // For a humongous region, region in which it starts.
259 HeapRegion* _humongous_start_region;
260
261 // True iff an attempt to evacuate an object in the region failed.
262 bool _evacuation_failed;
263
264 // A heap region may be a member one of a number of special subsets, each
265 // represented as linked lists through the field below. Currently, there
266 // is only one set:
267 // The collection set.
268 HeapRegion* _next_in_special_set;
269
270 // Fields used by the HeapRegionSetBase class and subclasses.
271 HeapRegion* _next;
272 HeapRegion* _prev;
273 #ifdef ASSERT
274 HeapRegionSetBase* _containing_set;
275 #endif // ASSERT
276
277 // We use concurrent marking to determine the amount of live data
278 // in each heap region.
279 size_t _prev_marked_bytes; // Bytes known to be live via last completed marking.
280 size_t _next_marked_bytes; // Bytes known to be live via in-progress marking.
281
282 // The calculated GC efficiency of the region.
283 double _gc_efficiency;
284
285 int _young_index_in_cset;
286 SurvRateGroup* _surv_rate_group;
287 int _age_index;
288
289 // The start of the unmarked area. The unmarked area extends from this
459 //
460 // obj_top : points to the top of the humongous object.
461 // fill_size : size of the filler object at the end of the region series.
462 void set_starts_humongous(HeapWord* obj_top, size_t fill_size);
463
464 // Makes the current region be a "continues humongous'
465 // region. first_hr is the "start humongous" region of the series
466 // which this region will be part of.
467 void set_continues_humongous(HeapRegion* first_hr);
468
469 // Unsets the humongous-related fields on the region.
470 void clear_humongous();
471
472 // If the region has a remembered set, return a pointer to it.
473 HeapRegionRemSet* rem_set() const {
474 return _rem_set;
475 }
476
477 inline bool in_collection_set() const;
478
479 inline HeapRegion* next_in_collection_set() const;
480 inline void set_next_in_collection_set(HeapRegion* r);
481
482 void set_allocation_context(AllocationContext_t context) {
483 _allocation_context = context;
484 }
485
486 AllocationContext_t allocation_context() const {
487 return _allocation_context;
488 }
489
490 // Methods used by the HeapRegionSetBase class and subclasses.
491
492 // Getter and setter for the next and prev fields used to link regions into
493 // linked lists.
494 HeapRegion* next() { return _next; }
495 HeapRegion* prev() { return _prev; }
496
497 void set_next(HeapRegion* next) { _next = next; }
498 void set_prev(HeapRegion* prev) { _prev = prev; }
499
500 // Every region added to a set is tagged with a reference to that
501 // set. This is used for doing consistency checking to make sure that
727 // vo == UsePrevMarking.
728 // Currently, there is only one case where this is called with
729 // vo == UseNextMarking, which is to verify the "next" marking
730 // information at the end of remark.
731 // Currently there is only one place where this is called with
732 // vo == UseMarkWord, which is to verify the marking during a
733 // full GC.
734 void verify(VerifyOption vo, bool *failures) const;
735
736 // Override; it uses the "prev" marking information
737 virtual void verify() const;
738
739 void verify_rem_set(VerifyOption vo, bool *failures) const;
740 void verify_rem_set() const;
741 };
742
743 // HeapRegionClosure is used for iterating over regions.
744 // Terminates the iteration when the "doHeapRegion" method returns "true".
745 class HeapRegionClosure : public StackObj {
746 friend class HeapRegionManager;
747 friend class G1CollectedHeap;
748
749 bool _complete;
750 void incomplete() { _complete = false; }
751
752 public:
753 HeapRegionClosure(): _complete(true) {}
754
755 // Typically called on each region until it returns true.
756 virtual bool doHeapRegion(HeapRegion* r) = 0;
757
758 // True after iteration if the closure was applied to all heap regions
759 // and returned "false" in all cases.
760 bool complete() { return _complete; }
761 };
762
763 #endif // SHARE_VM_GC_G1_HEAPREGION_HPP
|
244 inline size_t scanned_block_size(const HeapWord* addr) const {
245 return HeapRegion::block_size(addr); // Avoid virtual call
246 }
247
248 void report_region_type_change(G1HeapRegionTraceType::Type to);
249
250 protected:
251 // The index of this region in the heap region sequence.
252 uint _hrm_index;
253
254 AllocationContext_t _allocation_context;
255
256 HeapRegionType _type;
257
258 // For a humongous region, region in which it starts.
259 HeapRegion* _humongous_start_region;
260
261 // True iff an attempt to evacuate an object in the region failed.
262 bool _evacuation_failed;
263
264 // Fields used by the HeapRegionSetBase class and subclasses.
265 HeapRegion* _next;
266 HeapRegion* _prev;
267 #ifdef ASSERT
268 HeapRegionSetBase* _containing_set;
269 #endif // ASSERT
270
271 // We use concurrent marking to determine the amount of live data
272 // in each heap region.
273 size_t _prev_marked_bytes; // Bytes known to be live via last completed marking.
274 size_t _next_marked_bytes; // Bytes known to be live via in-progress marking.
275
276 // The calculated GC efficiency of the region.
277 double _gc_efficiency;
278
279 int _young_index_in_cset;
280 SurvRateGroup* _surv_rate_group;
281 int _age_index;
282
283 // The start of the unmarked area. The unmarked area extends from this
453 //
454 // obj_top : points to the top of the humongous object.
455 // fill_size : size of the filler object at the end of the region series.
456 void set_starts_humongous(HeapWord* obj_top, size_t fill_size);
457
458 // Makes the current region be a "continues humongous'
459 // region. first_hr is the "start humongous" region of the series
460 // which this region will be part of.
461 void set_continues_humongous(HeapRegion* first_hr);
462
463 // Unsets the humongous-related fields on the region.
464 void clear_humongous();
465
466 // If the region has a remembered set, return a pointer to it.
467 HeapRegionRemSet* rem_set() const {
468 return _rem_set;
469 }
470
471 inline bool in_collection_set() const;
472
473 void set_allocation_context(AllocationContext_t context) {
474 _allocation_context = context;
475 }
476
477 AllocationContext_t allocation_context() const {
478 return _allocation_context;
479 }
480
481 // Methods used by the HeapRegionSetBase class and subclasses.
482
483 // Getter and setter for the next and prev fields used to link regions into
484 // linked lists.
485 HeapRegion* next() { return _next; }
486 HeapRegion* prev() { return _prev; }
487
488 void set_next(HeapRegion* next) { _next = next; }
489 void set_prev(HeapRegion* prev) { _prev = prev; }
490
491 // Every region added to a set is tagged with a reference to that
492 // set. This is used for doing consistency checking to make sure that
718 // vo == UsePrevMarking.
719 // Currently, there is only one case where this is called with
720 // vo == UseNextMarking, which is to verify the "next" marking
721 // information at the end of remark.
722 // Currently there is only one place where this is called with
723 // vo == UseMarkWord, which is to verify the marking during a
724 // full GC.
725 void verify(VerifyOption vo, bool *failures) const;
726
727 // Override; it uses the "prev" marking information
728 virtual void verify() const;
729
730 void verify_rem_set(VerifyOption vo, bool *failures) const;
731 void verify_rem_set() const;
732 };
733
734 // HeapRegionClosure is used for iterating over regions.
735 // Terminates the iteration when the "doHeapRegion" method returns "true".
736 class HeapRegionClosure : public StackObj {
737 friend class HeapRegionManager;
738 friend class G1CollectionSet;
739
740 bool _complete;
741 void incomplete() { _complete = false; }
742
743 public:
744 HeapRegionClosure(): _complete(true) {}
745
746 // Typically called on each region until it returns true.
747 virtual bool doHeapRegion(HeapRegion* r) = 0;
748
749 // True after iteration if the closure was applied to all heap regions
750 // and returned "false" in all cases.
751 bool complete() { return _complete; }
752 };
753
754 #endif // SHARE_VM_GC_G1_HEAPREGION_HPP
|