< prev index next >

src/hotspot/share/memory/heap.hpp

Print this page
rev 54914 : 8223444: Improve CodeHeap Free Space Management
Reviewed-by:

*** 49,58 **** --- 49,60 ---- }; public: // Initialization void initialize(size_t length) { _header._length = length; set_used(); } + // Merging/splitting + void set_length(size_t length) { _header._length = length; } // Accessors void* allocated_space() const { return (void*)(this + 1); } size_t length() const { return _header._length; }
*** 69,81 **** public: // Initialization void initialize(size_t length) { HeapBlock::initialize(length); _link= NULL; } - // Merging - void set_length(size_t l) { _header._length = l; } - // Accessors FreeBlock* link() const { return _link; } void set_link(FreeBlock* link) { _link = link; } }; --- 71,80 ----
*** 113,141 **** size_t segment_for(void* p) const { return ((char*)p - _memory.low()) >> _log2_segment_size; } bool is_segment_unused(int val) const { return val == free_sentinel; } HeapBlock* block_at(size_t i) const { return (HeapBlock*)(_memory.low() + (i << _log2_segment_size)); } void mark_segmap_as_free(size_t beg, size_t end); void mark_segmap_as_used(size_t beg, size_t end); // Freelist management helpers FreeBlock* following_block(FreeBlock* b); void insert_after(FreeBlock* a, FreeBlock* b); bool merge_right (FreeBlock* a); // Toplevel freelist management void add_to_freelist(HeapBlock* b); ! FreeBlock* search_freelist(size_t length); // Iteration helpers void* next_used(HeapBlock* b) const; HeapBlock* block_start(void* p) const; // to perform additional actions on creation of executable code void on_code_mapping(char* base, size_t size); - void clear(); // clears all heap contents public: CodeHeap(const char* name, const int code_blob_type); // Heap extents --- 112,143 ---- size_t segment_for(void* p) const { return ((char*)p - _memory.low()) >> _log2_segment_size; } bool is_segment_unused(int val) const { return val == free_sentinel; } HeapBlock* block_at(size_t i) const { return (HeapBlock*)(_memory.low() + (i << _log2_segment_size)); } + // These methods take segment map indices as range boundaries void mark_segmap_as_free(size_t beg, size_t end); void mark_segmap_as_used(size_t beg, size_t end); + void invalidate(size_t beg, size_t end, size_t header_bytes); + void clear(size_t beg, size_t end); + void clear(); // clears all heap contents // Freelist management helpers FreeBlock* following_block(FreeBlock* b); void insert_after(FreeBlock* a, FreeBlock* b); bool merge_right (FreeBlock* a); // Toplevel freelist management void add_to_freelist(HeapBlock* b); ! HeapBlock* search_freelist(size_t length); // Iteration helpers void* next_used(HeapBlock* b) const; HeapBlock* block_start(void* p) const; // to perform additional actions on creation of executable code void on_code_mapping(char* base, size_t size); public: CodeHeap(const char* name, const int code_blob_type); // Heap extents
*** 178,187 **** --- 180,190 ---- static size_t header_size(); // returns the header size for each heap block size_t segment_size() const { return _segment_size; } // for CodeHeapState HeapBlock* first_block() const; // for CodeHeapState HeapBlock* next_block(HeapBlock* b) const; // for CodeHeapState + HeapBlock* split_block(HeapBlock* b, size_t split_seg); // split one block into two FreeBlock* freelist() const { return _freelist; } // for CodeHeapState size_t allocated_in_freelist() const { return _freelist_segments * CodeCacheSegmentSize; } int freelist_length() const { return _freelist_length; } // number of elements in the freelist
< prev index next >