226 G1StringDedup::enqueue_from_evacuation(from_region->is_young(),
227 to_region->is_young(),
228 queue_num(),
229 obj);
230 }
231
232 size_t* surv_young_words = surviving_young_words();
233 surv_young_words[young_index] += word_sz;
234
235 if (obj->is_objArray() && arrayOop(obj)->length() >= ParGCArrayScanChunk) {
236 // We keep track of the next start index in the length field of
237 // the to-space object. The actual length can be found in the
238 // length field of the from-space object.
239 arrayOop(obj)->set_length(0);
240 oop* old_p = set_partial_array_mask(old);
241 push_on_queue(old_p);
242 } else {
243 // No point in using the slower heap_region_containing() method,
244 // given that we know obj is in the heap.
245 _scanner.set_region(_g1h->heap_region_containing_raw(obj));
246 obj->oop_iterate_backwards(&_scanner);
247 }
248 } else {
249 undo_allocation(alloc_purpose, obj_ptr, word_sz);
250 obj = forward_ptr;
251 }
252 return obj;
253 }
254
255 HeapWord* G1ParScanThreadState::allocate_slow(GCAllocPurpose purpose, size_t word_sz) {
256 HeapWord* obj = NULL;
257 size_t gclab_word_size = _g1h->desired_plab_sz(purpose);
258 if (word_sz * 100 < gclab_word_size * ParallelGCBufferWastePct) {
259 G1ParGCAllocBuffer* alloc_buf = alloc_buffer(purpose);
260 add_to_alloc_buffer_waste(alloc_buf->words_remaining());
261 alloc_buf->retire(false /* end_of_gc */, false /* retain */);
262
263 HeapWord* buf = _g1h->par_allocate_during_gc(purpose, gclab_word_size);
264 if (buf == NULL) {
265 return NULL; // Let caller handle allocation failure.
266 }
|
226 G1StringDedup::enqueue_from_evacuation(from_region->is_young(),
227 to_region->is_young(),
228 queue_num(),
229 obj);
230 }
231
232 size_t* surv_young_words = surviving_young_words();
233 surv_young_words[young_index] += word_sz;
234
235 if (obj->is_objArray() && arrayOop(obj)->length() >= ParGCArrayScanChunk) {
236 // We keep track of the next start index in the length field of
237 // the to-space object. The actual length can be found in the
238 // length field of the from-space object.
239 arrayOop(obj)->set_length(0);
240 oop* old_p = set_partial_array_mask(old);
241 push_on_queue(old_p);
242 } else {
243 // No point in using the slower heap_region_containing() method,
244 // given that we know obj is in the heap.
245 _scanner.set_region(_g1h->heap_region_containing_raw(obj));
246 obj->oop_iterate_backwards<false>(&_scanner);
247 }
248 } else {
249 undo_allocation(alloc_purpose, obj_ptr, word_sz);
250 obj = forward_ptr;
251 }
252 return obj;
253 }
254
255 HeapWord* G1ParScanThreadState::allocate_slow(GCAllocPurpose purpose, size_t word_sz) {
256 HeapWord* obj = NULL;
257 size_t gclab_word_size = _g1h->desired_plab_sz(purpose);
258 if (word_sz * 100 < gclab_word_size * ParallelGCBufferWastePct) {
259 G1ParGCAllocBuffer* alloc_buf = alloc_buffer(purpose);
260 add_to_alloc_buffer_waste(alloc_buf->words_remaining());
261 alloc_buf->retire(false /* end_of_gc */, false /* retain */);
262
263 HeapWord* buf = _g1h->par_allocate_during_gc(purpose, gclab_word_size);
264 if (buf == NULL) {
265 return NULL; // Let caller handle allocation failure.
266 }
|