102 }
103
104 // Current buffer is full or we're ready to walk them, add it to the used list.
105 void MetadataOnStackMark::retire_current_buffer() {
106 retire_buffer(_current_buffer);
107 _current_buffer = NULL;
108 }
109
110 // Get buffer off free list.
111 MetadataOnStackBuffer* MetadataOnStackMark::allocate_buffer() {
112 MetadataOnStackBuffer* allocated = _free_buffers;
113
114 if (allocated != NULL) {
115 _free_buffers = allocated->next_free();
116 }
117
118 if (allocated == NULL) {
119 allocated = new MetadataOnStackBuffer();
120 }
121
122 assert(!allocated->is_full(), err_msg("Should not be full: " PTR_FORMAT, p2i(allocated)));
123
124 return allocated;
125 }
126
127 // Record which objects are marked so we can unmark the same objects.
128 void MetadataOnStackMark::record(Metadata* m) {
129 assert(_is_active, "metadata on stack marking is active");
130
131 MetadataOnStackBuffer* buffer = _current_buffer;
132
133 if (buffer != NULL && buffer->is_full()) {
134 retire_buffer(buffer);
135 buffer = NULL;
136 }
137
138 if (buffer == NULL) {
139 buffer = allocate_buffer();
140 _current_buffer = buffer;
141 }
142
|
102 }
103
104 // Current buffer is full or we're ready to walk them, add it to the used list.
105 void MetadataOnStackMark::retire_current_buffer() {
106 retire_buffer(_current_buffer);
107 _current_buffer = NULL;
108 }
109
110 // Get buffer off free list.
111 MetadataOnStackBuffer* MetadataOnStackMark::allocate_buffer() {
112 MetadataOnStackBuffer* allocated = _free_buffers;
113
114 if (allocated != NULL) {
115 _free_buffers = allocated->next_free();
116 }
117
118 if (allocated == NULL) {
119 allocated = new MetadataOnStackBuffer();
120 }
121
122 assert(!allocated->is_full(), "Should not be full: " PTR_FORMAT, p2i(allocated));
123
124 return allocated;
125 }
126
127 // Record which objects are marked so we can unmark the same objects.
128 void MetadataOnStackMark::record(Metadata* m) {
129 assert(_is_active, "metadata on stack marking is active");
130
131 MetadataOnStackBuffer* buffer = _current_buffer;
132
133 if (buffer != NULL && buffer->is_full()) {
134 retire_buffer(buffer);
135 buffer = NULL;
136 }
137
138 if (buffer == NULL) {
139 buffer = allocate_buffer();
140 _current_buffer = buffer;
141 }
142
|