8065894: CodeHeap::next_free should be renamed
Rename next_free() to next_used() Reviewed-by: thartmann, iveresov
This commit is contained in:
parent
53821ffdfa
commit
b5909f6d03
@ -279,10 +279,12 @@ size_t CodeHeap::alignment_offset() const {
|
|||||||
return sizeof(HeapBlock) & (_segment_size - 1);
|
return sizeof(HeapBlock) & (_segment_size - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finds the next free heapblock. If the current one is free, that it returned
|
// Returns the current block if available and used.
|
||||||
void* CodeHeap::next_free(HeapBlock* b) const {
|
// If not, it returns the subsequent block (if available), NULL otherwise.
|
||||||
// Since free blocks are merged, there is max. on free block
|
// Free blocks are merged, therefore there is at most one free block
|
||||||
// between two used ones
|
// between two used ones. As a result, the subsequent block (if available) is
|
||||||
|
// guaranteed to be used.
|
||||||
|
void* CodeHeap::next_used(HeapBlock* b) const {
|
||||||
if (b != NULL && b->free()) b = next_block(b);
|
if (b != NULL && b->free()) b = next_block(b);
|
||||||
assert(b == NULL || !b->free(), "must be in use or at end of heap");
|
assert(b == NULL || !b->free(), "must be in use or at end of heap");
|
||||||
return (b == NULL) ? NULL : b->allocated_space();
|
return (b == NULL) ? NULL : b->allocated_space();
|
||||||
|
@ -123,7 +123,7 @@ class CodeHeap : public CHeapObj<mtCode> {
|
|||||||
FreeBlock* search_freelist(size_t length);
|
FreeBlock* search_freelist(size_t length);
|
||||||
|
|
||||||
// Iteration helpers
|
// Iteration helpers
|
||||||
void* next_free(HeapBlock* b) const;
|
void* next_used(HeapBlock* b) const;
|
||||||
HeapBlock* first_block() const;
|
HeapBlock* first_block() const;
|
||||||
HeapBlock* next_block(HeapBlock* b) const;
|
HeapBlock* next_block(HeapBlock* b) const;
|
||||||
HeapBlock* block_start(void* p) const;
|
HeapBlock* block_start(void* p) const;
|
||||||
@ -158,9 +158,9 @@ class CodeHeap : public CHeapObj<mtCode> {
|
|||||||
int freelist_length() const { return _freelist_length; } // number of elements in the freelist
|
int freelist_length() const { return _freelist_length; } // number of elements in the freelist
|
||||||
|
|
||||||
// returns the first block or NULL
|
// returns the first block or NULL
|
||||||
void* first() const { return next_free(first_block()); }
|
void* first() const { return next_used(first_block()); }
|
||||||
// returns the next block given a block p or NULL
|
// returns the next block given a block p or NULL
|
||||||
void* next(void* p) const { return next_free(next_block(block_start(p))); }
|
void* next(void* p) const { return next_used(next_block(block_start(p))); }
|
||||||
|
|
||||||
// Statistics
|
// Statistics
|
||||||
size_t capacity() const;
|
size_t capacity() const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user