1 /*
2 * Copyright (c) 2001, 2016, 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 *
139 }
140
141 void CollectedHeap::unregister_nmethod(nmethod* nm) {
142 assert_locked_or_safepoint(CodeCache_lock);
143 }
144
145 void CollectedHeap::trace_heap(GCWhen::Type when, const GCTracer* gc_tracer) {
146 const GCHeapSummary& heap_summary = create_heap_summary();
147 gc_tracer->report_gc_heap_summary(when, heap_summary);
148
149 const MetaspaceSummary& metaspace_summary = create_metaspace_summary();
150 gc_tracer->report_metaspace_summary(when, metaspace_summary);
151 }
152
153 void CollectedHeap::trace_heap_before_gc(const GCTracer* gc_tracer) {
154 trace_heap(GCWhen::BeforeGC, gc_tracer);
155 }
156
157 void CollectedHeap::trace_heap_after_gc(const GCTracer* gc_tracer) {
158 trace_heap(GCWhen::AfterGC, gc_tracer);
159 }
160
161 // Memory state functions.
162
163
164 CollectedHeap::CollectedHeap() :
165 _barrier_set(NULL),
166 _is_gc_active(false),
167 _total_collections(0),
168 _total_full_collections(0),
169 _gc_cause(GCCause::_no_gc),
170 _gc_lastcause(GCCause::_no_gc),
171 _defer_initial_card_mark(false) // strengthened by subclass in pre_initialize() below.
172 {
173 const size_t max_len = size_t(arrayOopDesc::max_array_length(T_INT));
174 const size_t elements_per_word = HeapWordSize / sizeof(jint);
175 _filler_array_max_size = align_object_size(filler_array_hdr_size() +
176 max_len / elements_per_word);
177
178 NOT_PRODUCT(_promotion_failure_alot_count = 0;)
|
1 /*
2 * Copyright (c) 2001, 2017, 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 *
139 }
140
141 void CollectedHeap::unregister_nmethod(nmethod* nm) {
142 assert_locked_or_safepoint(CodeCache_lock);
143 }
144
145 void CollectedHeap::trace_heap(GCWhen::Type when, const GCTracer* gc_tracer) {
146 const GCHeapSummary& heap_summary = create_heap_summary();
147 gc_tracer->report_gc_heap_summary(when, heap_summary);
148
149 const MetaspaceSummary& metaspace_summary = create_metaspace_summary();
150 gc_tracer->report_metaspace_summary(when, metaspace_summary);
151 }
152
153 void CollectedHeap::trace_heap_before_gc(const GCTracer* gc_tracer) {
154 trace_heap(GCWhen::BeforeGC, gc_tracer);
155 }
156
157 void CollectedHeap::trace_heap_after_gc(const GCTracer* gc_tracer) {
158 trace_heap(GCWhen::AfterGC, gc_tracer);
159 }
160
161 // WhiteBox API support for concurrent collectors. These are the
162 // default implementations, for collectors which don't support this
163 // feature.
164 bool CollectedHeap::supports_concurrent_phase_control() const {
165 return false;
166 }
167
168 bool CollectedHeap::request_concurrent_phase(const char* phase) {
169 return false;
170 }
171
172 // Memory state functions.
173
174
175 CollectedHeap::CollectedHeap() :
176 _barrier_set(NULL),
177 _is_gc_active(false),
178 _total_collections(0),
179 _total_full_collections(0),
180 _gc_cause(GCCause::_no_gc),
181 _gc_lastcause(GCCause::_no_gc),
182 _defer_initial_card_mark(false) // strengthened by subclass in pre_initialize() below.
183 {
184 const size_t max_len = size_t(arrayOopDesc::max_array_length(T_INT));
185 const size_t elements_per_word = HeapWordSize / sizeof(jint);
186 _filler_array_max_size = align_object_size(filler_array_hdr_size() +
187 max_len / elements_per_word);
188
189 NOT_PRODUCT(_promotion_failure_alot_count = 0;)
|