142 bool G1CMMarkStack::resize(size_t new_capacity) { |
142 bool G1CMMarkStack::resize(size_t new_capacity) { |
143 assert(is_empty(), "Only resize when stack is empty."); |
143 assert(is_empty(), "Only resize when stack is empty."); |
144 assert(new_capacity <= _max_chunk_capacity, |
144 assert(new_capacity <= _max_chunk_capacity, |
145 "Trying to resize stack to " SIZE_FORMAT " chunks when the maximum is " SIZE_FORMAT, new_capacity, _max_chunk_capacity); |
145 "Trying to resize stack to " SIZE_FORMAT " chunks when the maximum is " SIZE_FORMAT, new_capacity, _max_chunk_capacity); |
146 |
146 |
147 TaskQueueEntryChunk* new_base = MmapArrayAllocator<TaskQueueEntryChunk, mtGC>::allocate_or_null(new_capacity); |
147 TaskQueueEntryChunk* new_base = MmapArrayAllocator<TaskQueueEntryChunk>::allocate_or_null(new_capacity, mtGC); |
148 |
148 |
149 if (new_base == NULL) { |
149 if (new_base == NULL) { |
150 log_warning(gc)("Failed to reserve memory for new overflow mark stack with " SIZE_FORMAT " chunks and size " SIZE_FORMAT "B.", new_capacity, new_capacity * sizeof(TaskQueueEntryChunk)); |
150 log_warning(gc)("Failed to reserve memory for new overflow mark stack with " SIZE_FORMAT " chunks and size " SIZE_FORMAT "B.", new_capacity, new_capacity * sizeof(TaskQueueEntryChunk)); |
151 return false; |
151 return false; |
152 } |
152 } |
153 // Release old mapping. |
153 // Release old mapping. |
154 if (_base != NULL) { |
154 if (_base != NULL) { |
155 MmapArrayAllocator<TaskQueueEntryChunk, mtGC>::free(_base, _chunk_capacity); |
155 MmapArrayAllocator<TaskQueueEntryChunk>::free(_base, _chunk_capacity); |
156 } |
156 } |
157 |
157 |
158 _base = new_base; |
158 _base = new_base; |
159 _chunk_capacity = new_capacity; |
159 _chunk_capacity = new_capacity; |
160 set_empty(); |
160 set_empty(); |