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