48 _age_table(false),
49 _scanner(g1h, this),
50 _old_gen_is_full(false)
51 {
52 // we allocate G1YoungSurvRateNumRegions plus one entries, since
53 // we "sacrifice" entry 0 to keep track of surviving bytes for
54 // non-young regions (where the age is -1)
55 // We also add a few elements at the beginning and at the end in
56 // an attempt to eliminate cache contention
57 size_t real_length = 1 + young_cset_length;
58 size_t array_length = PADDING_ELEM_NUM +
59 real_length +
60 PADDING_ELEM_NUM;
61 _surviving_young_words_base = NEW_C_HEAP_ARRAY(size_t, array_length, mtGC);
62 if (_surviving_young_words_base == NULL)
63 vm_exit_out_of_memory(array_length * sizeof(size_t), OOM_MALLOC_ERROR,
64 "Not enough space for young surv histo.");
65 _surviving_young_words = _surviving_young_words_base + PADDING_ELEM_NUM;
66 memset(_surviving_young_words, 0, real_length * sizeof(size_t));
67
68 _plab_allocator = G1PLABAllocator::create_allocator(_g1h->allocator());
69
70 _dest[InCSetState::NotInCSet] = InCSetState::NotInCSet;
71 // The dest for Young is used when the objects are aged enough to
72 // need to be moved to the next space.
73 _dest[InCSetState::Young] = InCSetState::Old;
74 _dest[InCSetState::Old] = InCSetState::Old;
75
76 _closures = G1EvacuationRootClosures::create_root_closures(this, _g1h);
77 }
78
79 // Pass locally gathered statistics to global state.
80 void G1ParScanThreadState::flush(size_t* surviving_young_words) {
81 _dcq.flush();
82 // Update allocation statistics.
83 _plab_allocator->flush_and_retire_stats();
84 _g1h->g1_policy()->record_age_table(&_age_table);
85
86 uint length = _g1h->collection_set()->young_region_length();
87 for (uint region_index = 0; region_index < length; region_index++) {
88 surviving_young_words[region_index] += _surviving_young_words[region_index];
|
48 _age_table(false),
49 _scanner(g1h, this),
50 _old_gen_is_full(false)
51 {
52 // we allocate G1YoungSurvRateNumRegions plus one entries, since
53 // we "sacrifice" entry 0 to keep track of surviving bytes for
54 // non-young regions (where the age is -1)
55 // We also add a few elements at the beginning and at the end in
56 // an attempt to eliminate cache contention
57 size_t real_length = 1 + young_cset_length;
58 size_t array_length = PADDING_ELEM_NUM +
59 real_length +
60 PADDING_ELEM_NUM;
61 _surviving_young_words_base = NEW_C_HEAP_ARRAY(size_t, array_length, mtGC);
62 if (_surviving_young_words_base == NULL)
63 vm_exit_out_of_memory(array_length * sizeof(size_t), OOM_MALLOC_ERROR,
64 "Not enough space for young surv histo.");
65 _surviving_young_words = _surviving_young_words_base + PADDING_ELEM_NUM;
66 memset(_surviving_young_words, 0, real_length * sizeof(size_t));
67
68 _plab_allocator = new G1DefaultPLABAllocator(_g1h->allocator());
69
70 _dest[InCSetState::NotInCSet] = InCSetState::NotInCSet;
71 // The dest for Young is used when the objects are aged enough to
72 // need to be moved to the next space.
73 _dest[InCSetState::Young] = InCSetState::Old;
74 _dest[InCSetState::Old] = InCSetState::Old;
75
76 _closures = G1EvacuationRootClosures::create_root_closures(this, _g1h);
77 }
78
79 // Pass locally gathered statistics to global state.
80 void G1ParScanThreadState::flush(size_t* surviving_young_words) {
81 _dcq.flush();
82 // Update allocation statistics.
83 _plab_allocator->flush_and_retire_stats();
84 _g1h->g1_policy()->record_age_table(&_age_table);
85
86 uint length = _g1h->collection_set()->young_region_length();
87 for (uint region_index = 0; region_index < length; region_index++) {
88 surviving_young_words[region_index] += _surviving_young_words[region_index];
|