src/share/vm/memory/metachunk.hpp

changeset 4382
e51c9860cf66
parent 4304
90273fc0a981
child 5007
c23dbf0e8ab7
equal deleted inserted replaced
4381:cd962e15c08e 4382:e51c9860cf66
65 void set_end(MetaWord* v) { _end = v; } 65 void set_end(MetaWord* v) { _end = v; }
66 void set_top(MetaWord* v) { _top = v; } 66 void set_top(MetaWord* v) { _top = v; }
67 void set_word_size(size_t v) { _word_size = v; } 67 void set_word_size(size_t v) { _word_size = v; }
68 public: 68 public:
69 #ifdef ASSERT 69 #ifdef ASSERT
70 Metachunk() : _bottom(NULL), _end(NULL), _top(NULL), _is_free(false) {} 70 Metachunk() : _bottom(NULL), _end(NULL), _top(NULL), _is_free(false),
71 _next(NULL), _prev(NULL) {}
71 #else 72 #else
72 Metachunk() : _bottom(NULL), _end(NULL), _top(NULL) {} 73 Metachunk() : _bottom(NULL), _end(NULL), _top(NULL),
74 _next(NULL), _prev(NULL) {}
73 #endif 75 #endif
74 76
75 // Used to add a Metachunk to a list of Metachunks 77 // Used to add a Metachunk to a list of Metachunks
76 void set_next(Metachunk* v) { _next = v; assert(v != this, "Boom");} 78 void set_next(Metachunk* v) { _next = v; assert(v != this, "Boom");}
77 void set_prev(Metachunk* v) { _prev = v; assert(v != this, "Boom");} 79 void set_prev(Metachunk* v) { _prev = v; assert(v != this, "Boom");}
100 link_next(ptr); 102 link_next(ptr);
101 if (ptr != NULL) ptr->link_prev(this); 103 if (ptr != NULL) ptr->link_prev(this);
102 } 104 }
103 105
104 // Reset top to bottom so chunk can be reused. 106 // Reset top to bottom so chunk can be reused.
105 void reset_empty() { _top = (_bottom + _overhead); } 107 void reset_empty() { _top = (_bottom + _overhead); _next = NULL; _prev = NULL; }
106 bool is_empty() { return _top == (_bottom + _overhead); } 108 bool is_empty() { return _top == (_bottom + _overhead); }
107 109
108 // used (has been allocated) 110 // used (has been allocated)
109 // free (available for future allocations) 111 // free (available for future allocations)
110 // capacity (total size of chunk) 112 // capacity (total size of chunk)
111 size_t used_word_size(); 113 size_t used_word_size() const;
112 size_t free_word_size(); 114 size_t free_word_size() const;
113 size_t capacity_word_size(); 115 size_t capacity_word_size()const;
114 116
115 // Debug support 117 // Debug support
116 #ifdef ASSERT 118 #ifdef ASSERT
117 void* prev_addr() const { return (void*)&_prev; } 119 void* prev_addr() const { return (void*)&_prev; }
118 void* next_addr() const { return (void*)&_next; } 120 void* next_addr() const { return (void*)&_next; }

mercurial