1 /*
2 * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
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->g1_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];
99 }
100 }
101
102 G1ParScanThreadState::~G1ParScanThreadState() {
103 delete _plab_allocator;
104 delete _closures;
105 FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_base);
106 delete[] _oops_into_optional_regions;
107 }
108
109 size_t G1ParScanThreadState::lab_waste() const {
110 return _plab_allocator->waste() * HeapWordSize;
111 }
112
113 size_t G1ParScanThreadState::lab_undo_waste() const {
114 return _plab_allocator->undo_waste() * HeapWordSize;
115 }
116
117 #ifdef ASSERT
118 bool G1ParScanThreadState::verify_ref(narrowOop* ref) const {
119 assert(ref != NULL, "invariant");
120 assert(UseCompressedOops, "sanity");
121 assert(!has_partial_array_mask(ref), "ref=" PTR_FORMAT, p2i(ref));
122 oop p = RawAccess<>::oop_load(ref);
123 assert(_g1h->is_in_g1_reserved(p),
124 "ref=" PTR_FORMAT " p=" PTR_FORMAT, p2i(ref), p2i(p));
125 return true;
126 }
127
128 bool G1ParScanThreadState::verify_ref(oop* ref) const {
129 assert(ref != NULL, "invariant");
130 if (has_partial_array_mask(ref)) {
131 // Must be in the collection set--it's already been copied.
132 oop p = clear_partial_array_mask(ref);
133 assert(_g1h->is_in_cset(p),
134 "ref=" PTR_FORMAT " p=" PTR_FORMAT, p2i(ref), p2i(p));
|
1 /*
2 * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
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->g1_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];
99 }
100 }
101
102 G1ParScanThreadState::~G1ParScanThreadState() {
103 delete _plab_allocator;
104 delete _closures;
105 FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_base);
106 delete[] _oops_into_optional_regions;
107 }
108
109 size_t G1ParScanThreadState::lab_waste_words() const {
110 return _plab_allocator->waste();
111 }
112
113 size_t G1ParScanThreadState::lab_undo_waste_words() const {
114 return _plab_allocator->undo_waste();
115 }
116
117 #ifdef ASSERT
118 bool G1ParScanThreadState::verify_ref(narrowOop* ref) const {
119 assert(ref != NULL, "invariant");
120 assert(UseCompressedOops, "sanity");
121 assert(!has_partial_array_mask(ref), "ref=" PTR_FORMAT, p2i(ref));
122 oop p = RawAccess<>::oop_load(ref);
123 assert(_g1h->is_in_g1_reserved(p),
124 "ref=" PTR_FORMAT " p=" PTR_FORMAT, p2i(ref), p2i(p));
125 return true;
126 }
127
128 bool G1ParScanThreadState::verify_ref(oop* ref) const {
129 assert(ref != NULL, "invariant");
130 if (has_partial_array_mask(ref)) {
131 // Must be in the collection set--it's already been copied.
132 oop p = clear_partial_array_mask(ref);
133 assert(_g1h->is_in_cset(p),
134 "ref=" PTR_FORMAT " p=" PTR_FORMAT, p2i(ref), p2i(p));
|