src/share/vm/memory/metachunk.hpp

changeset 5007
c23dbf0e8ab7
parent 4382
e51c9860cf66
child 5941
bdfbb1fb19ca
equal deleted inserted replaced
4934:07a4efc5ed14 5007:c23dbf0e8ab7
39 // | | | used | 39 // | | | used |
40 // | | | | 40 // | | | |
41 // | | | | 41 // | | | |
42 // +--------------+ <- bottom ---+ ---+ 42 // +--------------+ <- bottom ---+ ---+
43 43
44 class VirtualSpaceNode;
45
44 class Metachunk VALUE_OBJ_CLASS_SPEC { 46 class Metachunk VALUE_OBJ_CLASS_SPEC {
45 // link to support lists of chunks 47 // link to support lists of chunks
46 Metachunk* _next; 48 Metachunk* _next;
47 Metachunk* _prev; 49 Metachunk* _prev;
50 VirtualSpaceNode* _container;
48 51
49 MetaWord* _bottom; 52 MetaWord* _bottom;
50 MetaWord* _end; 53 MetaWord* _end;
51 MetaWord* _top; 54 MetaWord* _top;
52 size_t _word_size; 55 size_t _word_size;
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; }

mercurial