4347 return survivor_attempt_allocation(word_size); 4348 } 4349 } 4350 4351 ShouldNotReachHere(); 4352 // Trying to keep some compilers happy. 4353 return NULL; 4354 } 4355 4356 G1ParGCAllocBuffer::G1ParGCAllocBuffer(size_t gclab_word_size) : 4357 ParGCAllocBuffer(gclab_word_size), _retired(false) { } 4358 4359 G1ParScanThreadState::G1ParScanThreadState(G1CollectedHeap* g1h, uint queue_num) 4360 : _g1h(g1h), 4361 _refs(g1h->task_queue(queue_num)), 4362 _dcq(&g1h->dirty_card_queue_set()), 4363 _ct_bs((CardTableModRefBS*)_g1h->barrier_set()), 4364 _g1_rem(g1h->g1_rem_set()), 4365 _hash_seed(17), _queue_num(queue_num), 4366 _term_attempts(0), 4367 _surviving_alloc_buffer(g1h->desired_plab_sz(GCAllocForSurvived)), 4368 _tenured_alloc_buffer(g1h->desired_plab_sz(GCAllocForTenured)), 4369 _age_table(false), 4370 _strong_roots_time(0), _term_time(0), 4371 _alloc_buffer_waste(0), _undo_waste(0) { 4372 // we allocate G1YoungSurvRateNumRegions plus one entries, since 4373 // we "sacrifice" entry 0 to keep track of surviving bytes for 4374 // non-young regions (where the age is -1) 4375 // We also add a few elements at the beginning and at the end in 4376 // an attempt to eliminate cache contention 4377 uint real_length = 1 + _g1h->g1_policy()->young_cset_region_length(); 4378 uint array_length = PADDING_ELEM_NUM + 4379 real_length + 4380 PADDING_ELEM_NUM; 4381 _surviving_young_words_base = NEW_C_HEAP_ARRAY(size_t, array_length, mtGC); 4382 if (_surviving_young_words_base == NULL) 4383 vm_exit_out_of_memory(array_length * sizeof(size_t), 4384 "Not enough space for young surv histo."); 4385 _surviving_young_words = _surviving_young_words_base + PADDING_ELEM_NUM; 4386 memset(_surviving_young_words, 0, (size_t) real_length * sizeof(size_t)); 4387 4388 _alloc_buffers[GCAllocForSurvived] = &_surviving_alloc_buffer; 4389 _alloc_buffers[GCAllocForTenured] = &_tenured_alloc_buffer; 4390 4391 _start = os::elapsedTime(); 4392 } 4393 4394 void 4395 G1ParScanThreadState::print_termination_stats_hdr(outputStream* const st) 4396 { 4397 st->print_raw_cr("GC Termination Stats"); 4398 st->print_raw_cr(" elapsed --strong roots-- -------termination-------" 4399 " ------waste (KiB)------"); 4400 st->print_raw_cr("thr ms ms % ms % attempts" 4401 " total alloc undo"); 4402 st->print_raw_cr("--- --------- --------- ------ --------- ------ --------" 4403 " ------- ------- -------"); 4404 } 4405 4406 void 4407 G1ParScanThreadState::print_termination_stats(int i, 4408 outputStream* const st) const 4409 { | 4347 return survivor_attempt_allocation(word_size); 4348 } 4349 } 4350 4351 ShouldNotReachHere(); 4352 // Trying to keep some compilers happy. 4353 return NULL; 4354 } 4355 4356 G1ParGCAllocBuffer::G1ParGCAllocBuffer(size_t gclab_word_size) : 4357 ParGCAllocBuffer(gclab_word_size), _retired(false) { } 4358 4359 G1ParScanThreadState::G1ParScanThreadState(G1CollectedHeap* g1h, uint queue_num) 4360 : _g1h(g1h), 4361 _refs(g1h->task_queue(queue_num)), 4362 _dcq(&g1h->dirty_card_queue_set()), 4363 _ct_bs((CardTableModRefBS*)_g1h->barrier_set()), 4364 _g1_rem(g1h->g1_rem_set()), 4365 _hash_seed(17), _queue_num(queue_num), 4366 _term_attempts(0), 4367 _age_table(false), 4368 _strong_roots_time(0), _term_time(0), 4369 _alloc_buffer_waste(0), _undo_waste(0) { 4370 // we allocate G1YoungSurvRateNumRegions plus one entries, since 4371 // we "sacrifice" entry 0 to keep track of surviving bytes for 4372 // non-young regions (where the age is -1) 4373 // We also add a few elements at the beginning and at the end in 4374 // an attempt to eliminate cache contention 4375 uint real_length = 1 + _g1h->g1_policy()->young_cset_region_length(); 4376 uint array_length = PADDING_ELEM_NUM + 4377 real_length + 4378 PADDING_ELEM_NUM; 4379 _surviving_young_words_base = NEW_C_HEAP_ARRAY(size_t, array_length, mtGC); 4380 if (_surviving_young_words_base == NULL) 4381 vm_exit_out_of_memory(array_length * sizeof(size_t), 4382 "Not enough space for young surv histo."); 4383 _surviving_young_words = _surviving_young_words_base + PADDING_ELEM_NUM; 4384 memset(_surviving_young_words, 0, (size_t) real_length * sizeof(size_t)); 4385 4386 for (int ap = 0; ap < GCAllocPurposeCount; ++ap) 4387 for (int pr = 0; pr < GCAllocPriorityCount; ++pr) { 4388 _alloc_buffers[buf_idx(ap, pr)] = 4389 new G1ParGCAllocBuffer(g1h->desired_plab_sz(GCAllocPurpose(ap))); 4390 } 4391 4392 _start = os::elapsedTime(); 4393 } 4394 4395 void 4396 G1ParScanThreadState::print_termination_stats_hdr(outputStream* const st) 4397 { 4398 st->print_raw_cr("GC Termination Stats"); 4399 st->print_raw_cr(" elapsed --strong roots-- -------termination-------" 4400 " ------waste (KiB)------"); 4401 st->print_raw_cr("thr ms ms % ms % attempts" 4402 " total alloc undo"); 4403 st->print_raw_cr("--- --------- --------- ------ --------- ------ --------" 4404 " ------- ------- -------"); 4405 } 4406 4407 void 4408 G1ParScanThreadState::print_termination_stats(int i, 4409 outputStream* const st) const 4410 { |