mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 19:14:38 +02:00
8011268: NPG: Free unused VirtualSpaceNodes
Reviewed-by: mgerdin, coleenp, johnc
This commit is contained in:
parent
687b6a8d44
commit
e1cbb28f3f
5 changed files with 233 additions and 52 deletions
|
@ -28,6 +28,7 @@
|
|||
#include "utilities/copy.hpp"
|
||||
#include "utilities/debug.hpp"
|
||||
|
||||
class VirtualSpaceNode;
|
||||
//
|
||||
// Future modification
|
||||
//
|
||||
|
@ -45,27 +46,30 @@ size_t Metachunk::_overhead =
|
|||
|
||||
// Metachunk methods
|
||||
|
||||
Metachunk* Metachunk::initialize(MetaWord* ptr, size_t word_size) {
|
||||
// Set bottom, top, and end. Allow space for the Metachunk itself
|
||||
Metachunk* chunk = (Metachunk*) ptr;
|
||||
|
||||
MetaWord* chunk_bottom = ptr + _overhead;
|
||||
chunk->set_bottom(ptr);
|
||||
chunk->set_top(chunk_bottom);
|
||||
MetaWord* chunk_end = ptr + word_size;
|
||||
assert(chunk_end > chunk_bottom, "Chunk must be too small");
|
||||
chunk->set_end(chunk_end);
|
||||
chunk->set_next(NULL);
|
||||
chunk->set_prev(NULL);
|
||||
chunk->set_word_size(word_size);
|
||||
Metachunk::Metachunk(size_t word_size,
|
||||
VirtualSpaceNode* container) :
|
||||
_word_size(word_size),
|
||||
_bottom(NULL),
|
||||
_end(NULL),
|
||||
_top(NULL),
|
||||
_next(NULL),
|
||||
_prev(NULL),
|
||||
_container(container)
|
||||
{
|
||||
_bottom = (MetaWord*)this;
|
||||
_top = (MetaWord*)this + _overhead;
|
||||
_end = (MetaWord*)this + word_size;
|
||||
#ifdef ASSERT
|
||||
size_t data_word_size = pointer_delta(chunk_end, chunk_bottom, sizeof(MetaWord));
|
||||
Copy::fill_to_words((HeapWord*) chunk_bottom, data_word_size, metadata_chunk_initialize);
|
||||
set_is_free(false);
|
||||
size_t data_word_size = pointer_delta(end(),
|
||||
top(),
|
||||
sizeof(MetaWord));
|
||||
Copy::fill_to_words((HeapWord*) top(),
|
||||
data_word_size,
|
||||
metadata_chunk_initialize);
|
||||
#endif
|
||||
return chunk;
|
||||
}
|
||||
|
||||
|
||||
MetaWord* Metachunk::allocate(size_t word_size) {
|
||||
MetaWord* result = NULL;
|
||||
// If available, bump the pointer to allocate.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue