< prev index next >

src/hotspot/share/gc/g1/heapRegionManager.hpp

Print this page
rev 51649 : version 1
rev 51650 : added comments
rev 52017 : All changes for G1 GC moved from 'combined' repo folder

*** 69,88 **** class HeapRegionManager: public CHeapObj<mtGC> { friend class VMStructs; friend class HeapRegionClaimer; G1HeapRegionTable _regions; - G1RegionToSpaceMapper* _heap_mapper; G1RegionToSpaceMapper* _prev_bitmap_mapper; G1RegionToSpaceMapper* _next_bitmap_mapper; G1RegionToSpaceMapper* _bot_mapper; G1RegionToSpaceMapper* _cardtable_mapper; G1RegionToSpaceMapper* _card_counts_mapper; FreeRegionList _free_list; // Each bit in this bitmap indicates that the corresponding region is available // for allocation. CHeapBitMap _available_map; --- 69,91 ---- class HeapRegionManager: public CHeapObj<mtGC> { friend class VMStructs; friend class HeapRegionClaimer; + protected: G1HeapRegionTable _regions; G1RegionToSpaceMapper* _heap_mapper; + private: G1RegionToSpaceMapper* _prev_bitmap_mapper; G1RegionToSpaceMapper* _next_bitmap_mapper; G1RegionToSpaceMapper* _bot_mapper; G1RegionToSpaceMapper* _cardtable_mapper; G1RegionToSpaceMapper* _card_counts_mapper; + protected: FreeRegionList _free_list; + private: // Each bit in this bitmap indicates that the corresponding region is available // for allocation. CHeapBitMap _available_map;
*** 93,107 **** uint _allocated_heapregions_length; HeapWord* heap_bottom() const { return _regions.bottom_address_mapped(); } HeapWord* heap_end() const {return _regions.end_address_mapped(); } void make_regions_available(uint index, uint num_regions = 1, WorkGang* pretouch_gang = NULL); ! // Pass down commit calls to the VirtualSpace. void commit_regions(uint index, size_t num_regions = 1, WorkGang* pretouch_gang = NULL); - void uncommit_regions(uint index, size_t num_regions = 1); // Notify other data structures about change in the heap layout. void update_committed_space(HeapWord* old_end, HeapWord* new_end); // Find a contiguous set of empty or uncommitted regions of length num and return --- 96,111 ---- uint _allocated_heapregions_length; HeapWord* heap_bottom() const { return _regions.bottom_address_mapped(); } HeapWord* heap_end() const {return _regions.end_address_mapped(); } + protected: void make_regions_available(uint index, uint num_regions = 1, WorkGang* pretouch_gang = NULL); ! void uncommit_regions(uint index, size_t num_regions = 1); ! private: // Pass down commit calls to the VirtualSpace. void commit_regions(uint index, size_t num_regions = 1, WorkGang* pretouch_gang = NULL); // Notify other data structures about change in the heap layout. void update_committed_space(HeapWord* old_end, HeapWord* new_end); // Find a contiguous set of empty or uncommitted regions of length num and return
*** 115,132 **** uint find_unavailable_from_idx(uint start_idx, uint* res_idx) const; // Finds the next sequence of empty regions starting from start_idx, going backwards in // the heap. Returns the length of the sequence found. If this value is zero, no // sequence could be found, otherwise res_idx contains the start index of this range. uint find_empty_from_idx_reverse(uint start_idx, uint* res_idx) const; - // Allocate a new HeapRegion for the given index. - HeapRegion* new_heap_region(uint hrm_index); #ifdef ASSERT public: bool is_free(HeapRegion* hr) const; ! #endif // Returns whether the given region is available for allocation. bool is_available(uint region) const; public: // Empty constructor, we'll initialize it with the initialize() method. HeapRegionManager(); --- 119,139 ---- uint find_unavailable_from_idx(uint start_idx, uint* res_idx) const; // Finds the next sequence of empty regions starting from start_idx, going backwards in // the heap. Returns the length of the sequence found. If this value is zero, no // sequence could be found, otherwise res_idx contains the start index of this range. uint find_empty_from_idx_reverse(uint start_idx, uint* res_idx) const; #ifdef ASSERT public: bool is_free(HeapRegion* hr) const; ! bool is_available(uint region) const; ! #else // Returns whether the given region is available for allocation. + protected: bool is_available(uint region) const; + #endif + // Allocate a new HeapRegion for the given index. + HeapRegion* new_heap_region(uint hrm_index); public: // Empty constructor, we'll initialize it with the initialize() method. HeapRegionManager();
*** 139,149 **** // Return the "dummy" region used for G1AllocRegion. This is currently a hardwired // new HeapRegion that owns HeapRegion at index 0. Since at the moment we commit // the heap from the lowest address, this region (and its associated data // structures) are available and we do not need to check further. ! HeapRegion* get_dummy_region() { return new_heap_region(0); } // Return the HeapRegion at the given index. Assume that the index // is valid. inline HeapRegion* at(uint index) const; --- 146,156 ---- // Return the "dummy" region used for G1AllocRegion. This is currently a hardwired // new HeapRegion that owns HeapRegion at index 0. Since at the moment we commit // the heap from the lowest address, this region (and its associated data // structures) are available and we do not need to check further. ! virtual HeapRegion* get_dummy_region() { return new_heap_region(0); } // Return the HeapRegion at the given index. Assume that the index // is valid. inline HeapRegion* at(uint index) const;
*** 161,171 **** // Insert the given region list into the global free region list. void insert_list_into_free_list(FreeRegionList* list) { _free_list.add_ordered(list); } ! HeapRegion* allocate_free_region(bool is_old) { HeapRegion* hr = _free_list.remove_region(is_old); if (hr != NULL) { assert(hr->next() == NULL, "Single region should not have next"); assert(is_available(hr->hrm_index()), "Must be committed"); --- 168,178 ---- // Insert the given region list into the global free region list. void insert_list_into_free_list(FreeRegionList* list) { _free_list.add_ordered(list); } ! virtual HeapRegion* allocate_free_region(bool is_old) { HeapRegion* hr = _free_list.remove_region(is_old); if (hr != NULL) { assert(hr->next() == NULL, "Single region should not have next"); assert(is_available(hr->hrm_index()), "Must be committed");
*** 196,233 **** uint length() const { return _num_committed; } // Return the maximum number of regions in the heap. uint max_length() const { return (uint)_regions.length(); } MemoryUsage get_auxiliary_data_memory_usage() const; MemRegion reserved() const { return MemRegion(heap_bottom(), heap_end()); } // Expand the sequence to reflect that the heap has grown. Either create new // HeapRegions, or re-use existing ones. Returns the number of regions the // sequence was expanded by. If a HeapRegion allocation fails, the resulting // number of regions might be smaller than what's desired. ! uint expand_by(uint num_regions, WorkGang* pretouch_workers); // Makes sure that the regions from start to start+num_regions-1 are available // for allocation. Returns the number of regions that were committed to achieve // this. ! uint expand_at(uint start, uint num_regions, WorkGang* pretouch_workers); // Find a contiguous set of empty regions of length num. Returns the start index of // that set, or G1_NO_HRM_INDEX. ! uint find_contiguous_only_empty(size_t num) { return find_contiguous(num, true); } // Find a contiguous set of empty or unavailable regions of length num. Returns the // start index of that set, or G1_NO_HRM_INDEX. ! uint find_contiguous_empty_or_unavailable(size_t num) { return find_contiguous(num, false); } HeapRegion* next_region_in_heap(const HeapRegion* r) const; // Find the highest free or uncommitted region in the reserved heap, // and if uncommitted, commit it. If none are available, return G1_NO_HRM_INDEX. // Set the 'expanded' boolean true if a new region was committed. ! uint find_highest_free(bool* expanded); // Allocate the regions that contain the address range specified, committing the // regions if necessary. Return false if any of the regions is already committed // and not free, and return the number of regions newly committed in commit_count. bool allocate_containing_regions(MemRegion range, size_t* commit_count, WorkGang* pretouch_workers); --- 203,243 ---- uint length() const { return _num_committed; } // Return the maximum number of regions in the heap. uint max_length() const { return (uint)_regions.length(); } + // Return maximum number of regions that heap can expand to. + virtual uint max_expandable_length() const { return (uint)_regions.length(); } + MemoryUsage get_auxiliary_data_memory_usage() const; MemRegion reserved() const { return MemRegion(heap_bottom(), heap_end()); } // Expand the sequence to reflect that the heap has grown. Either create new // HeapRegions, or re-use existing ones. Returns the number of regions the // sequence was expanded by. If a HeapRegion allocation fails, the resulting // number of regions might be smaller than what's desired. ! virtual uint expand_by(uint num_regions, WorkGang* pretouch_workers); // Makes sure that the regions from start to start+num_regions-1 are available // for allocation. Returns the number of regions that were committed to achieve // this. ! virtual uint expand_at(uint start, uint num_regions, WorkGang* pretouch_workers); // Find a contiguous set of empty regions of length num. Returns the start index of // that set, or G1_NO_HRM_INDEX. ! virtual uint find_contiguous_only_empty(size_t num) { return find_contiguous(num, true); } // Find a contiguous set of empty or unavailable regions of length num. Returns the // start index of that set, or G1_NO_HRM_INDEX. ! virtual uint find_contiguous_empty_or_unavailable(size_t num) { return find_contiguous(num, false); } HeapRegion* next_region_in_heap(const HeapRegion* r) const; // Find the highest free or uncommitted region in the reserved heap, // and if uncommitted, commit it. If none are available, return G1_NO_HRM_INDEX. // Set the 'expanded' boolean true if a new region was committed. ! virtual uint find_highest_free(bool* expanded); // Allocate the regions that contain the address range specified, committing the // regions if necessary. Return false if any of the regions is already committed // and not free, and return the number of regions newly committed in commit_count. bool allocate_containing_regions(MemRegion range, size_t* commit_count, WorkGang* pretouch_workers);
*** 238,254 **** void par_iterate(HeapRegionClosure* blk, HeapRegionClaimer* hrclaimer, const uint start_index) const; // Uncommit up to num_regions_to_remove regions that are completely free. // Return the actual number of uncommitted regions. ! uint shrink_by(uint num_regions_to_remove); // Uncommit a number of regions starting at the specified index, which must be available, // empty, and free. void shrink_at(uint index, size_t num_regions); ! void verify(); // Do some sanity checking. void verify_optional() PRODUCT_RETURN; }; --- 248,264 ---- void par_iterate(HeapRegionClosure* blk, HeapRegionClaimer* hrclaimer, const uint start_index) const; // Uncommit up to num_regions_to_remove regions that are completely free. // Return the actual number of uncommitted regions. ! virtual uint shrink_by(uint num_regions_to_remove); // Uncommit a number of regions starting at the specified index, which must be available, // empty, and free. void shrink_at(uint index, size_t num_regions); ! virtual void verify(); // Do some sanity checking. void verify_optional() PRODUCT_RETURN; };
< prev index next >