52 class HeapRegionSetBase; |
52 class HeapRegionSetBase; |
53 class nmethod; |
53 class nmethod; |
54 |
54 |
55 #define HR_FORMAT "%u:(%s)["PTR_FORMAT","PTR_FORMAT","PTR_FORMAT"]" |
55 #define HR_FORMAT "%u:(%s)["PTR_FORMAT","PTR_FORMAT","PTR_FORMAT"]" |
56 #define HR_FORMAT_PARAMS(_hr_) \ |
56 #define HR_FORMAT_PARAMS(_hr_) \ |
57 (_hr_)->hrs_index(), \ |
57 (_hr_)->hrm_index(), \ |
58 (_hr_)->is_survivor() ? "S" : (_hr_)->is_young() ? "E" : \ |
58 (_hr_)->is_survivor() ? "S" : (_hr_)->is_young() ? "E" : \ |
59 (_hr_)->startsHumongous() ? "HS" : \ |
59 (_hr_)->startsHumongous() ? "HS" : \ |
60 (_hr_)->continuesHumongous() ? "HC" : \ |
60 (_hr_)->continuesHumongous() ? "HC" : \ |
61 !(_hr_)->is_empty() ? "O" : "F", \ |
61 !(_hr_)->is_empty() ? "O" : "F", \ |
62 p2i((_hr_)->bottom()), p2i((_hr_)->top()), p2i((_hr_)->end()) |
62 p2i((_hr_)->bottom()), p2i((_hr_)->top()), p2i((_hr_)->end()) |
63 |
63 |
64 // sentinel value for hrs_index |
64 // sentinel value for hrm_index |
65 #define G1_NO_HRS_INDEX ((uint) -1) |
65 #define G1_NO_HRM_INDEX ((uint) -1) |
66 |
66 |
67 // A dirty card to oop closure for heap regions. It |
67 // A dirty card to oop closure for heap regions. It |
68 // knows how to get the G1 heap and how to use the bitmap |
68 // knows how to get the G1 heap and how to use the bitmap |
69 // in the concurrent marker used by G1 to filter remembered |
69 // in the concurrent marker used by G1 to filter remembered |
70 // sets. |
70 // sets. |
232 |
232 |
233 G1BlockOffsetArrayContigSpace* offsets() { return &_offsets; } |
233 G1BlockOffsetArrayContigSpace* offsets() { return &_offsets; } |
234 |
234 |
235 protected: |
235 protected: |
236 // The index of this region in the heap region sequence. |
236 // The index of this region in the heap region sequence. |
237 uint _hrs_index; |
237 uint _hrm_index; |
238 |
238 |
239 HumongousType _humongous_type; |
239 HumongousType _humongous_type; |
240 // For a humongous region, region in which it starts. |
240 // For a humongous region, region in which it starts. |
241 HeapRegion* _humongous_start_region; |
241 HeapRegion* _humongous_start_region; |
242 // For the start region of a humongous sequence, it's original end(). |
242 // For the start region of a humongous sequence, it's original end(). |
328 // The predicted number of bytes to copy that was added to |
328 // The predicted number of bytes to copy that was added to |
329 // the total value for the collection set. |
329 // the total value for the collection set. |
330 size_t _predicted_bytes_to_copy; |
330 size_t _predicted_bytes_to_copy; |
331 |
331 |
332 public: |
332 public: |
333 HeapRegion(uint hrs_index, |
333 HeapRegion(uint hrm_index, |
334 G1BlockOffsetSharedArray* sharedOffsetArray, |
334 G1BlockOffsetSharedArray* sharedOffsetArray, |
335 MemRegion mr); |
335 MemRegion mr); |
336 |
336 |
337 // Initializing the HeapRegion not only resets the data structure, but also |
337 // Initializing the HeapRegion not only resets the data structure, but also |
338 // resets the BOT for that heap region. |
338 // resets the BOT for that heap region. |
383 size_t block_size(const HeapWord* p) const; |
383 size_t block_size(const HeapWord* p) const; |
384 |
384 |
385 inline HeapWord* par_allocate_no_bot_updates(size_t word_size); |
385 inline HeapWord* par_allocate_no_bot_updates(size_t word_size); |
386 inline HeapWord* allocate_no_bot_updates(size_t word_size); |
386 inline HeapWord* allocate_no_bot_updates(size_t word_size); |
387 |
387 |
388 // If this region is a member of a HeapRegionSeq, the index in that |
388 // If this region is a member of a HeapRegionManager, the index in that |
389 // sequence, otherwise -1. |
389 // sequence, otherwise -1. |
390 uint hrs_index() const { return _hrs_index; } |
390 uint hrm_index() const { return _hrm_index; } |
391 |
391 |
392 // The number of bytes marked live in the region in the last marking phase. |
392 // The number of bytes marked live in the region in the last marking phase. |
393 size_t marked_bytes() { return _prev_marked_bytes; } |
393 size_t marked_bytes() { return _prev_marked_bytes; } |
394 size_t live_bytes() { |
394 size_t live_bytes() { |
395 return (top() - prev_top_at_mark_start()) * HeapWordSize + marked_bytes(); |
395 return (top() - prev_top_at_mark_start()) * HeapWordSize + marked_bytes(); |
456 |
456 |
457 // Return the index + 1 of the last HC regions that's associated |
457 // Return the index + 1 of the last HC regions that's associated |
458 // with this HS region. |
458 // with this HS region. |
459 uint last_hc_index() const { |
459 uint last_hc_index() const { |
460 assert(startsHumongous(), "don't call this otherwise"); |
460 assert(startsHumongous(), "don't call this otherwise"); |
461 return hrs_index() + region_num(); |
461 return hrm_index() + region_num(); |
462 } |
462 } |
463 |
463 |
464 // Same as Space::is_in_reserved, but will use the original size of the region. |
464 // Same as Space::is_in_reserved, but will use the original size of the region. |
465 // The original size is different only for start humongous regions. They get |
465 // The original size is different only for start humongous regions. They get |
466 // their _end set up to be the end of the last continues region of the |
466 // their _end set up to be the end of the last continues region of the |
811 }; |
811 }; |
812 |
812 |
813 // HeapRegionClosure is used for iterating over regions. |
813 // HeapRegionClosure is used for iterating over regions. |
814 // Terminates the iteration when the "doHeapRegion" method returns "true". |
814 // Terminates the iteration when the "doHeapRegion" method returns "true". |
815 class HeapRegionClosure : public StackObj { |
815 class HeapRegionClosure : public StackObj { |
816 friend class HeapRegionSeq; |
816 friend class HeapRegionManager; |
817 friend class G1CollectedHeap; |
817 friend class G1CollectedHeap; |
818 |
818 |
819 bool _complete; |
819 bool _complete; |
820 void incomplete() { _complete = false; } |
820 void incomplete() { _complete = false; } |
821 |
821 |