59 // considerations). Metadata is allocated in the rest of the chunk. |
62 // considerations). Metadata is allocated in the rest of the chunk. |
60 // This size is the overhead of maintaining the Metachunk within |
63 // This size is the overhead of maintaining the Metachunk within |
61 // the space. |
64 // the space. |
62 static size_t _overhead; |
65 static size_t _overhead; |
63 |
66 |
64 void set_bottom(MetaWord* v) { _bottom = v; } |
|
65 void set_end(MetaWord* v) { _end = v; } |
|
66 void set_top(MetaWord* v) { _top = v; } |
|
67 void set_word_size(size_t v) { _word_size = v; } |
|
68 public: |
67 public: |
69 #ifdef ASSERT |
68 Metachunk(size_t word_size , VirtualSpaceNode* container); |
70 Metachunk() : _bottom(NULL), _end(NULL), _top(NULL), _is_free(false), |
|
71 _next(NULL), _prev(NULL) {} |
|
72 #else |
|
73 Metachunk() : _bottom(NULL), _end(NULL), _top(NULL), |
|
74 _next(NULL), _prev(NULL) {} |
|
75 #endif |
|
76 |
69 |
77 // Used to add a Metachunk to a list of Metachunks |
70 // Used to add a Metachunk to a list of Metachunks |
78 void set_next(Metachunk* v) { _next = v; assert(v != this, "Boom");} |
71 void set_next(Metachunk* v) { _next = v; assert(v != this, "Boom");} |
79 void set_prev(Metachunk* v) { _prev = v; assert(v != this, "Boom");} |
72 void set_prev(Metachunk* v) { _prev = v; assert(v != this, "Boom");} |
|
73 void set_container(VirtualSpaceNode* v) { _container = v; } |
80 |
74 |
81 MetaWord* allocate(size_t word_size); |
75 MetaWord* allocate(size_t word_size); |
82 static Metachunk* initialize(MetaWord* ptr, size_t word_size); |
|
83 |
76 |
84 // Accessors |
77 // Accessors |
85 Metachunk* next() const { return _next; } |
78 Metachunk* next() const { return _next; } |
86 Metachunk* prev() const { return _prev; } |
79 Metachunk* prev() const { return _prev; } |
|
80 VirtualSpaceNode* container() const { return _container; } |
87 MetaWord* bottom() const { return _bottom; } |
81 MetaWord* bottom() const { return _bottom; } |
88 MetaWord* end() const { return _end; } |
82 MetaWord* end() const { return _end; } |
89 MetaWord* top() const { return _top; } |
83 MetaWord* top() const { return _top; } |
90 size_t word_size() const { return _word_size; } |
84 size_t word_size() const { return _word_size; } |
91 size_t size() const volatile { return _word_size; } |
85 size_t size() const volatile { return _word_size; } |