author | chegar |
Thu, 17 Oct 2019 20:53:35 +0100 | |
branch | datagramsocketimpl-branch |
changeset 58678 | 9cf78a70fa4f |
parent 54807 | 33fe50b6d707 |
child 58679 | 9c3209ff7550 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
53191
a257992e1e4d
8216285: Enable inlining of CollectedHeap::obj-/array-/class_allocate
redestad
parents:
52876
diff
changeset
|
2 |
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. |
1 | 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 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5544
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5544
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5544
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
26 |
#include "classfile/systemDictionary.hpp" |
|
30764 | 27 |
#include "gc/shared/allocTracer.hpp" |
49484
ee8fa73b90f9
8198949: Modularize arraycopy stub routine GC barriers
eosterlund
parents:
49468
diff
changeset
|
28 |
#include "gc/shared/barrierSet.hpp" |
30764 | 29 |
#include "gc/shared/collectedHeap.hpp" |
30 |
#include "gc/shared/collectedHeap.inline.hpp" |
|
49045
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
31 |
#include "gc/shared/gcLocker.inline.hpp" |
30764 | 32 |
#include "gc/shared/gcHeapSummary.hpp" |
33 |
#include "gc/shared/gcTrace.hpp" |
|
35061 | 34 |
#include "gc/shared/gcTraceTime.inline.hpp" |
52876
2d17750d41e7
8214791: Consistently name gc files containing VM operations
tschatzl
parents:
52124
diff
changeset
|
35 |
#include "gc/shared/gcVMOperations.hpp" |
30764 | 36 |
#include "gc/shared/gcWhen.hpp" |
50882
80abf702eed8
8205683: Refactor heap allocation to separate concerns
eosterlund
parents:
50578
diff
changeset
|
37 |
#include "gc/shared/memAllocator.hpp" |
35061 | 38 |
#include "logging/log.hpp" |
18025 | 39 |
#include "memory/metaspace.hpp" |
37248 | 40 |
#include "memory/resourceArea.hpp" |
54786 | 41 |
#include "memory/universe.hpp" |
30764 | 42 |
#include "oops/instanceMirrorKlass.hpp" |
7397 | 43 |
#include "oops/oop.inline.hpp" |
49361
1956d0ec092a
8199319: Remove handles.inline.hpp include from reflectionUtils.hpp
stefank
parents:
49045
diff
changeset
|
44 |
#include "runtime/handles.inline.hpp" |
7397 | 45 |
#include "runtime/init.hpp" |
14583
d70ee55535f4
8003935: Simplify the needed includes for using Thread::current()
stefank
parents:
13738
diff
changeset
|
46 |
#include "runtime/thread.inline.hpp" |
48105
8d15b1369c7a
8167108: inconsistent handling of SR_lock can lead to crashes
dcubed
parents:
47998
diff
changeset
|
47 |
#include "runtime/threadSMR.hpp" |
49045
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
48 |
#include "runtime/vmThread.hpp" |
7397 | 49 |
#include "services/heapDumper.hpp" |
46625 | 50 |
#include "utilities/align.hpp" |
50882
80abf702eed8
8205683: Refactor heap allocation to separate concerns
eosterlund
parents:
50578
diff
changeset
|
51 |
#include "utilities/copy.hpp" |
1 | 52 |
|
49045
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
53 |
class ClassLoaderData; |
1 | 54 |
|
1668
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
55 |
size_t CollectedHeap::_filler_array_max_size = 0; |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
56 |
|
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11414
diff
changeset
|
57 |
template <> |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11414
diff
changeset
|
58 |
void EventLogBase<GCMessage>::print(outputStream* st, GCMessage& m) { |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11414
diff
changeset
|
59 |
st->print_cr("GC heap %s", m.is_before ? "before" : "after"); |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11414
diff
changeset
|
60 |
st->print_raw(m); |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11414
diff
changeset
|
61 |
} |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11414
diff
changeset
|
62 |
|
35061 | 63 |
void GCHeapLog::log_heap(CollectedHeap* heap, bool before) { |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11414
diff
changeset
|
64 |
if (!should_log()) { |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11414
diff
changeset
|
65 |
return; |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11414
diff
changeset
|
66 |
} |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11414
diff
changeset
|
67 |
|
11788 | 68 |
double timestamp = fetch_timestamp(); |
54623
1126f0607c70
8222811: Consolidate MutexLockerEx and MutexLocker
coleenp
parents:
54616
diff
changeset
|
69 |
MutexLocker ml(&_mutex, Mutex::_no_safepoint_check_flag); |
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11414
diff
changeset
|
70 |
int index = compute_log_index(); |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11414
diff
changeset
|
71 |
_records[index].thread = NULL; // Its the GC thread so it's not that interesting. |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11414
diff
changeset
|
72 |
_records[index].timestamp = timestamp; |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11414
diff
changeset
|
73 |
_records[index].data.is_before = before; |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11414
diff
changeset
|
74 |
stringStream st(_records[index].data.buffer(), _records[index].data.size()); |
35061 | 75 |
|
76 |
st.print_cr("{Heap %s GC invocations=%u (full %u):", |
|
77 |
before ? "before" : "after", |
|
78 |
heap->total_collections(), |
|
79 |
heap->total_full_collections()); |
|
80 |
||
81 |
heap->print_on(&st); |
|
82 |
st.print_cr("}"); |
|
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11414
diff
changeset
|
83 |
} |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11414
diff
changeset
|
84 |
|
54616 | 85 |
size_t CollectedHeap::unused() const { |
86 |
MutexLocker ml(Heap_lock); |
|
87 |
return capacity() - used(); |
|
88 |
} |
|
89 |
||
18025 | 90 |
VirtualSpaceSummary CollectedHeap::create_heap_space_summary() { |
91 |
size_t capacity_in_words = capacity() / HeapWordSize; |
|
92 |
||
93 |
return VirtualSpaceSummary( |
|
58678 | 94 |
_reserved.start(), _reserved.start() + capacity_in_words, _reserved.end()); |
18025 | 95 |
} |
96 |
||
97 |
GCHeapSummary CollectedHeap::create_heap_summary() { |
|
98 |
VirtualSpaceSummary heap_space = create_heap_space_summary(); |
|
99 |
return GCHeapSummary(heap_space, used()); |
|
100 |
} |
|
101 |
||
102 |
MetaspaceSummary CollectedHeap::create_metaspace_summary() { |
|
103 |
const MetaspaceSizes meta_space( |
|
49389
9ef2eee8ca7c
8199430: Rename MetaspaceAux to something more meaningful
stuefe
parents:
49361
diff
changeset
|
104 |
MetaspaceUtils::committed_bytes(), |
9ef2eee8ca7c
8199430: Rename MetaspaceAux to something more meaningful
stuefe
parents:
49361
diff
changeset
|
105 |
MetaspaceUtils::used_bytes(), |
9ef2eee8ca7c
8199430: Rename MetaspaceAux to something more meaningful
stuefe
parents:
49361
diff
changeset
|
106 |
MetaspaceUtils::reserved_bytes()); |
18025 | 107 |
const MetaspaceSizes data_space( |
49389
9ef2eee8ca7c
8199430: Rename MetaspaceAux to something more meaningful
stuefe
parents:
49361
diff
changeset
|
108 |
MetaspaceUtils::committed_bytes(Metaspace::NonClassType), |
9ef2eee8ca7c
8199430: Rename MetaspaceAux to something more meaningful
stuefe
parents:
49361
diff
changeset
|
109 |
MetaspaceUtils::used_bytes(Metaspace::NonClassType), |
9ef2eee8ca7c
8199430: Rename MetaspaceAux to something more meaningful
stuefe
parents:
49361
diff
changeset
|
110 |
MetaspaceUtils::reserved_bytes(Metaspace::NonClassType)); |
18025 | 111 |
const MetaspaceSizes class_space( |
49389
9ef2eee8ca7c
8199430: Rename MetaspaceAux to something more meaningful
stuefe
parents:
49361
diff
changeset
|
112 |
MetaspaceUtils::committed_bytes(Metaspace::ClassType), |
9ef2eee8ca7c
8199430: Rename MetaspaceAux to something more meaningful
stuefe
parents:
49361
diff
changeset
|
113 |
MetaspaceUtils::used_bytes(Metaspace::ClassType), |
9ef2eee8ca7c
8199430: Rename MetaspaceAux to something more meaningful
stuefe
parents:
49361
diff
changeset
|
114 |
MetaspaceUtils::reserved_bytes(Metaspace::ClassType)); |
18025 | 115 |
|
23470
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
116 |
const MetaspaceChunkFreeListSummary& ms_chunk_free_list_summary = |
49389
9ef2eee8ca7c
8199430: Rename MetaspaceAux to something more meaningful
stuefe
parents:
49361
diff
changeset
|
117 |
MetaspaceUtils::chunk_free_list_summary(Metaspace::NonClassType); |
23470
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
118 |
const MetaspaceChunkFreeListSummary& class_chunk_free_list_summary = |
49389
9ef2eee8ca7c
8199430: Rename MetaspaceAux to something more meaningful
stuefe
parents:
49361
diff
changeset
|
119 |
MetaspaceUtils::chunk_free_list_summary(Metaspace::ClassType); |
23470
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
120 |
|
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
121 |
return MetaspaceSummary(MetaspaceGC::capacity_until_GC(), meta_space, data_space, class_space, |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
122 |
ms_chunk_free_list_summary, class_chunk_free_list_summary); |
18025 | 123 |
} |
124 |
||
125 |
void CollectedHeap::print_heap_before_gc() { |
|
35061 | 126 |
Universe::print_heap_before_gc(); |
18025 | 127 |
if (_gc_heap_log != NULL) { |
35061 | 128 |
_gc_heap_log->log_heap_before(this); |
18025 | 129 |
} |
130 |
} |
|
131 |
||
132 |
void CollectedHeap::print_heap_after_gc() { |
|
35061 | 133 |
Universe::print_heap_after_gc(); |
18025 | 134 |
if (_gc_heap_log != NULL) { |
35061 | 135 |
_gc_heap_log->log_heap_after(this); |
18025 | 136 |
} |
137 |
} |
|
138 |
||
54807 | 139 |
void CollectedHeap::print() const { print_on(tty); } |
140 |
||
29081
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
28940
diff
changeset
|
141 |
void CollectedHeap::print_on_error(outputStream* st) const { |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
28940
diff
changeset
|
142 |
st->print_cr("Heap:"); |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
28940
diff
changeset
|
143 |
print_extended_on(st); |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
28940
diff
changeset
|
144 |
st->cr(); |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
28940
diff
changeset
|
145 |
|
49754 | 146 |
BarrierSet::barrier_set()->print_on(st); |
29081
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
28940
diff
changeset
|
147 |
} |
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
28940
diff
changeset
|
148 |
|
28940
c314cf1db3fa
8066566: Refactor ParNewGeneration to contain ParNewTracer
mlarsson
parents:
26829
diff
changeset
|
149 |
void CollectedHeap::trace_heap(GCWhen::Type when, const GCTracer* gc_tracer) { |
18025 | 150 |
const GCHeapSummary& heap_summary = create_heap_summary(); |
23470
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
151 |
gc_tracer->report_gc_heap_summary(when, heap_summary); |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
152 |
|
18025 | 153 |
const MetaspaceSummary& metaspace_summary = create_metaspace_summary(); |
23470
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
23464
diff
changeset
|
154 |
gc_tracer->report_metaspace_summary(when, metaspace_summary); |
18025 | 155 |
} |
156 |
||
28940
c314cf1db3fa
8066566: Refactor ParNewGeneration to contain ParNewTracer
mlarsson
parents:
26829
diff
changeset
|
157 |
void CollectedHeap::trace_heap_before_gc(const GCTracer* gc_tracer) { |
18025 | 158 |
trace_heap(GCWhen::BeforeGC, gc_tracer); |
159 |
} |
|
160 |
||
28940
c314cf1db3fa
8066566: Refactor ParNewGeneration to contain ParNewTracer
mlarsson
parents:
26829
diff
changeset
|
161 |
void CollectedHeap::trace_heap_after_gc(const GCTracer* gc_tracer) { |
18025 | 162 |
trace_heap(GCWhen::AfterGC, gc_tracer); |
163 |
} |
|
164 |
||
46384
dacebddcdea0
8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
46329
diff
changeset
|
165 |
// WhiteBox API support for concurrent collectors. These are the |
dacebddcdea0
8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
46329
diff
changeset
|
166 |
// default implementations, for collectors which don't support this |
dacebddcdea0
8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
46329
diff
changeset
|
167 |
// feature. |
dacebddcdea0
8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
46329
diff
changeset
|
168 |
bool CollectedHeap::supports_concurrent_phase_control() const { |
dacebddcdea0
8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
46329
diff
changeset
|
169 |
return false; |
dacebddcdea0
8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
46329
diff
changeset
|
170 |
} |
dacebddcdea0
8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
46329
diff
changeset
|
171 |
|
dacebddcdea0
8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
46329
diff
changeset
|
172 |
bool CollectedHeap::request_concurrent_phase(const char* phase) { |
dacebddcdea0
8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
46329
diff
changeset
|
173 |
return false; |
dacebddcdea0
8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
46329
diff
changeset
|
174 |
} |
dacebddcdea0
8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
46329
diff
changeset
|
175 |
|
49851 | 176 |
bool CollectedHeap::is_oop(oop object) const { |
58678 | 177 |
if (!is_object_aligned(object)) { |
49851 | 178 |
return false; |
179 |
} |
|
180 |
||
58678 | 181 |
if (!is_in(object)) { |
49851 | 182 |
return false; |
183 |
} |
|
184 |
||
58678 | 185 |
if (is_in(object->klass_or_null())) { |
49851 | 186 |
return false; |
187 |
} |
|
188 |
||
189 |
return true; |
|
190 |
} |
|
191 |
||
1 | 192 |
// Memory state functions. |
193 |
||
6759
67b1a69ef5aa
6984287: Regularize how GC parallel workers are specified.
jmasa
parents:
5702
diff
changeset
|
194 |
|
32623
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31603
diff
changeset
|
195 |
CollectedHeap::CollectedHeap() : |
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31603
diff
changeset
|
196 |
_is_gc_active(false), |
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31603
diff
changeset
|
197 |
_total_collections(0), |
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31603
diff
changeset
|
198 |
_total_full_collections(0), |
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31603
diff
changeset
|
199 |
_gc_cause(GCCause::_no_gc), |
48961
120b61d50f85
8195103: Refactor out card table from CardTableModRefBS to flatten the BarrierSet hierarchy
eosterlund
parents:
48168
diff
changeset
|
200 |
_gc_lastcause(GCCause::_no_gc) |
32623
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31603
diff
changeset
|
201 |
{ |
1668
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
202 |
const size_t max_len = size_t(arrayOopDesc::max_array_length(T_INT)); |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
203 |
const size_t elements_per_word = HeapWordSize / sizeof(jint); |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
204 |
_filler_array_max_size = align_object_size(filler_array_hdr_size() + |
12229
c34a85c8f5aa
7103665: HeapWord*ParallelScavengeHeap::failed_mem_allocate(unsigned long,bool)+0x97
brutisso
parents:
11788
diff
changeset
|
205 |
max_len / elements_per_word); |
1668
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
206 |
|
1 | 207 |
NOT_PRODUCT(_promotion_failure_alot_count = 0;) |
208 |
NOT_PRODUCT(_promotion_failure_alot_gc_number = 0;) |
|
209 |
||
210 |
if (UsePerfData) { |
|
211 |
EXCEPTION_MARK; |
|
212 |
||
213 |
// create the gc cause jvmstat counters |
|
214 |
_perf_gc_cause = PerfDataManager::create_string_variable(SUN_GC, "cause", |
|
215 |
80, GCCause::to_string(_gc_cause), CHECK); |
|
216 |
||
217 |
_perf_gc_lastcause = |
|
218 |
PerfDataManager::create_string_variable(SUN_GC, "lastCause", |
|
219 |
80, GCCause::to_string(_gc_lastcause), CHECK); |
|
220 |
} |
|
32623
390a27af5657
8134626: Misc cleanups after generation array removal
jwilhelm
parents:
31603
diff
changeset
|
221 |
|
11636
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11414
diff
changeset
|
222 |
// Create the ring log |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11414
diff
changeset
|
223 |
if (LogEvents) { |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11414
diff
changeset
|
224 |
_gc_heap_log = new GCHeapLog(); |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11414
diff
changeset
|
225 |
} else { |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11414
diff
changeset
|
226 |
_gc_heap_log = NULL; |
3c07b54482a5
7141200: log some interesting information in ring buffers for crashes
never
parents:
11414
diff
changeset
|
227 |
} |
1 | 228 |
} |
229 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12236
diff
changeset
|
230 |
// This interface assumes that it's being called by the |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12236
diff
changeset
|
231 |
// vm thread. It collects the heap assuming that the |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12236
diff
changeset
|
232 |
// heap lock is already held and that we are executing in |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12236
diff
changeset
|
233 |
// the context of the vm thread. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12236
diff
changeset
|
234 |
void CollectedHeap::collect_as_vm_thread(GCCause::Cause cause) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12236
diff
changeset
|
235 |
assert(Thread::current()->is_VM_thread(), "Precondition#1"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12236
diff
changeset
|
236 |
assert(Heap_lock->is_locked(), "Precondition#2"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12236
diff
changeset
|
237 |
GCCauseSetter gcs(this, cause); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12236
diff
changeset
|
238 |
switch (cause) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12236
diff
changeset
|
239 |
case GCCause::_heap_inspection: |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12236
diff
changeset
|
240 |
case GCCause::_heap_dump: |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12236
diff
changeset
|
241 |
case GCCause::_metadata_GC_threshold : { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12236
diff
changeset
|
242 |
HandleMark hm; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12236
diff
changeset
|
243 |
do_full_collection(false); // don't clear all soft refs |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12236
diff
changeset
|
244 |
break; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12236
diff
changeset
|
245 |
} |
37149
f025738bbada
8152113: Remove _last_ditch_collection GC-cause and avoid expanding heap on Metaspace OOM
sjohanss
parents:
36363
diff
changeset
|
246 |
case GCCause::_metadata_GC_clear_soft_refs: { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12236
diff
changeset
|
247 |
HandleMark hm; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12236
diff
changeset
|
248 |
do_full_collection(true); // do clear all soft refs |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12236
diff
changeset
|
249 |
break; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12236
diff
changeset
|
250 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12236
diff
changeset
|
251 |
default: |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12236
diff
changeset
|
252 |
ShouldNotReachHere(); // Unexpected use of this function |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12236
diff
changeset
|
253 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12236
diff
changeset
|
254 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12236
diff
changeset
|
255 |
|
49045
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
256 |
MetaWord* CollectedHeap::satisfy_failed_metadata_allocation(ClassLoaderData* loader_data, |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
257 |
size_t word_size, |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
258 |
Metaspace::MetadataType mdtype) { |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
259 |
uint loop_count = 0; |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
260 |
uint gc_count = 0; |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
261 |
uint full_gc_count = 0; |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
262 |
|
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
263 |
assert(!Heap_lock->owned_by_self(), "Should not be holding the Heap_lock"); |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
264 |
|
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
265 |
do { |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
266 |
MetaWord* result = loader_data->metaspace_non_null()->allocate(word_size, mdtype); |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
267 |
if (result != NULL) { |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
268 |
return result; |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
269 |
} |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
270 |
|
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
271 |
if (GCLocker::is_active_and_needs_gc()) { |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
272 |
// If the GCLocker is active, just expand and allocate. |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
273 |
// If that does not succeed, wait if this thread is not |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
274 |
// in a critical section itself. |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
275 |
result = loader_data->metaspace_non_null()->expand_and_allocate(word_size, mdtype); |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
276 |
if (result != NULL) { |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
277 |
return result; |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
278 |
} |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
279 |
JavaThread* jthr = JavaThread::current(); |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
280 |
if (!jthr->in_critical()) { |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
281 |
// Wait for JNI critical section to be exited |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
282 |
GCLocker::stall_until_clear(); |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
283 |
// The GC invoked by the last thread leaving the critical |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
284 |
// section will be a young collection and a full collection |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
285 |
// is (currently) needed for unloading classes so continue |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
286 |
// to the next iteration to get a full GC. |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
287 |
continue; |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
288 |
} else { |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
289 |
if (CheckJNICalls) { |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
290 |
fatal("Possible deadlock due to allocating while" |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
291 |
" in jni critical section"); |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
292 |
} |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
293 |
return NULL; |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
294 |
} |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
295 |
} |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
296 |
|
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
297 |
{ // Need lock to get self consistent gc_count's |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
298 |
MutexLocker ml(Heap_lock); |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
299 |
gc_count = Universe::heap()->total_collections(); |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
300 |
full_gc_count = Universe::heap()->total_full_collections(); |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
301 |
} |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
302 |
|
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
303 |
// Generate a VM operation |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
304 |
VM_CollectForMetadataAllocation op(loader_data, |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
305 |
word_size, |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
306 |
mdtype, |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
307 |
gc_count, |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
308 |
full_gc_count, |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
309 |
GCCause::_metadata_GC_threshold); |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
310 |
VMThread::execute(&op); |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
311 |
|
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
312 |
// If GC was locked out, try again. Check before checking success because the |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
313 |
// prologue could have succeeded and the GC still have been locked out. |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
314 |
if (op.gc_locked()) { |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
315 |
continue; |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
316 |
} |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
317 |
|
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
318 |
if (op.prologue_succeeded()) { |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
319 |
return op.result(); |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
320 |
} |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
321 |
loop_count++; |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
322 |
if ((QueuedAllocationWarningCount > 0) && |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
323 |
(loop_count % QueuedAllocationWarningCount == 0)) { |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
324 |
log_warning(gc, ergo)("satisfy_failed_metadata_allocation() retries %d times," |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
325 |
" size=" SIZE_FORMAT, loop_count, word_size); |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
326 |
} |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
327 |
} while (true); // Until a GC is done |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
328 |
} |
9b556b613a07
8198509: Move satisfy_failed_metadata_allocation out from CollectorPolicy
stefank
parents:
48961
diff
changeset
|
329 |
|
51625
c265860d5d45
8207200: Committed > max memory usage when getting MemoryUsage
tschatzl
parents:
50882
diff
changeset
|
330 |
MemoryUsage CollectedHeap::memory_usage() { |
c265860d5d45
8207200: Committed > max memory usage when getting MemoryUsage
tschatzl
parents:
50882
diff
changeset
|
331 |
return MemoryUsage(InitialHeapSize, used(), capacity(), max_capacity()); |
c265860d5d45
8207200: Committed > max memory usage when getting MemoryUsage
tschatzl
parents:
50882
diff
changeset
|
332 |
} |
c265860d5d45
8207200: Committed > max memory usage when getting MemoryUsage
tschatzl
parents:
50882
diff
changeset
|
333 |
|
c265860d5d45
8207200: Committed > max memory usage when getting MemoryUsage
tschatzl
parents:
50882
diff
changeset
|
334 |
|
1 | 335 |
#ifndef PRODUCT |
8296
b1c2163e4e59
6912621: iCMS: Error: assert(_markBitMap.isMarked(addr + 1),"Missing Printezis bit?")
ysr
parents:
7397
diff
changeset
|
336 |
void CollectedHeap::check_for_non_bad_heap_word_value(HeapWord* addr, size_t size) { |
1 | 337 |
if (CheckMemoryInitialization && ZapUnusedHeapArea) { |
338 |
for (size_t slot = 0; slot < size; slot += 1) { |
|
339 |
assert((*(intptr_t*) (addr + slot)) == ((intptr_t) badHeapWordVal), |
|
340 |
"Found non badHeapWordValue in pre-allocation check"); |
|
341 |
} |
|
342 |
} |
|
343 |
} |
|
344 |
#endif // PRODUCT |
|
345 |
||
22552 | 346 |
size_t CollectedHeap::max_tlab_size() const { |
347 |
// TLABs can't be bigger than we can fill with a int[Integer.MAX_VALUE]. |
|
348 |
// This restriction could be removed by enabling filling with multiple arrays. |
|
349 |
// If we compute that the reasonable way as |
|
350 |
// header_size + ((sizeof(jint) * max_jint) / HeapWordSize) |
|
351 |
// we'll overflow on the multiply, so we do the divide first. |
|
352 |
// We actually lose a little by dividing first, |
|
353 |
// but that just makes the TLAB somewhat smaller than the biggest array, |
|
354 |
// which is fine, since we'll be able to fill that. |
|
355 |
size_t max_int_size = typeArrayOopDesc::header_size(T_INT) + |
|
356 |
sizeof(jint) * |
|
357 |
((juint) max_jint / (size_t) HeapWordSize); |
|
46619
a3919f5e8d2b
8178499: Remove _ptr_ and _size_ infixes from align functions
stefank
parents:
46618
diff
changeset
|
358 |
return align_down(max_int_size, MinObjAlignment); |
22552 | 359 |
} |
360 |
||
1668
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
361 |
size_t CollectedHeap::filler_array_hdr_size() { |
46618
d503911aa948
8178489: Make align functions more type safe and consistent
stefank
parents:
46384
diff
changeset
|
362 |
return align_object_offset(arrayOopDesc::header_size(T_INT)); // align to Long |
1668
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
363 |
} |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
364 |
|
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
365 |
size_t CollectedHeap::filler_array_min_size() { |
5694
1e0532a6abff
6916623: Align object to 16 bytes to use Compressed Oops with java heap up to 64Gb
kvn
parents:
5544
diff
changeset
|
366 |
return align_object_size(filler_array_hdr_size()); // align to MinObjAlignment |
1668
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
367 |
} |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
368 |
|
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
369 |
#ifdef ASSERT |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
370 |
void CollectedHeap::fill_args_check(HeapWord* start, size_t words) |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
371 |
{ |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
372 |
assert(words >= min_fill_size(), "too small to fill"); |
46683
33808f7eadd5
8184753: Asserts against MinObjectAlignment should avoid integer division
shade
parents:
46625
diff
changeset
|
373 |
assert(is_object_aligned(words), "unaligned size"); |
1668
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
374 |
} |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
375 |
|
4636
90e004691873
6902115: G1:assert(ignore_max_completed||thread->is_Java_thread()||SafepointSynchronize::is_at_safepoint())
johnc
parents:
4571
diff
changeset
|
376 |
void CollectedHeap::zap_filler_array(HeapWord* start, size_t words, bool zap) |
1668
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
377 |
{ |
4636
90e004691873
6902115: G1:assert(ignore_max_completed||thread->is_Java_thread()||SafepointSynchronize::is_at_safepoint())
johnc
parents:
4571
diff
changeset
|
378 |
if (ZapFillerObjects && zap) { |
1668
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
379 |
Copy::fill_to_words(start + filler_array_hdr_size(), |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
380 |
words - filler_array_hdr_size(), 0XDEAFBABE); |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
381 |
} |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
382 |
} |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
383 |
#endif // ASSERT |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
384 |
|
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
385 |
void |
4636
90e004691873
6902115: G1:assert(ignore_max_completed||thread->is_Java_thread()||SafepointSynchronize::is_at_safepoint())
johnc
parents:
4571
diff
changeset
|
386 |
CollectedHeap::fill_with_array(HeapWord* start, size_t words, bool zap) |
1668
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
387 |
{ |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
388 |
assert(words >= filler_array_min_size(), "too small for an array"); |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
389 |
assert(words <= filler_array_max_size(), "too big for a single object"); |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
390 |
|
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
391 |
const size_t payload_size = words - filler_array_hdr_size(); |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
392 |
const size_t len = payload_size * HeapWordSize / sizeof(jint); |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32623
diff
changeset
|
393 |
assert((int)len >= 0, "size too large " SIZE_FORMAT " becomes %d", words, (int)len); |
1668
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
394 |
|
50882
80abf702eed8
8205683: Refactor heap allocation to separate concerns
eosterlund
parents:
50578
diff
changeset
|
395 |
ObjArrayAllocator allocator(Universe::intArrayKlassObj(), words, (int)len, /* do_zero */ false); |
80abf702eed8
8205683: Refactor heap allocation to separate concerns
eosterlund
parents:
50578
diff
changeset
|
396 |
allocator.initialize(start); |
4636
90e004691873
6902115: G1:assert(ignore_max_completed||thread->is_Java_thread()||SafepointSynchronize::is_at_safepoint())
johnc
parents:
4571
diff
changeset
|
397 |
DEBUG_ONLY(zap_filler_array(start, words, zap);) |
1668
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
398 |
} |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
399 |
|
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
400 |
void |
4636
90e004691873
6902115: G1:assert(ignore_max_completed||thread->is_Java_thread()||SafepointSynchronize::is_at_safepoint())
johnc
parents:
4571
diff
changeset
|
401 |
CollectedHeap::fill_with_object_impl(HeapWord* start, size_t words, bool zap) |
1668
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
402 |
{ |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
403 |
assert(words <= filler_array_max_size(), "too big for a single object"); |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
404 |
|
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
405 |
if (words >= filler_array_min_size()) { |
4636
90e004691873
6902115: G1:assert(ignore_max_completed||thread->is_Java_thread()||SafepointSynchronize::is_at_safepoint())
johnc
parents:
4571
diff
changeset
|
406 |
fill_with_array(start, words, zap); |
1668
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
407 |
} else if (words > 0) { |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
408 |
assert(words == min_fill_size(), "unaligned size"); |
50882
80abf702eed8
8205683: Refactor heap allocation to separate concerns
eosterlund
parents:
50578
diff
changeset
|
409 |
ObjAllocator allocator(SystemDictionary::Object_klass(), words); |
80abf702eed8
8205683: Refactor heap allocation to separate concerns
eosterlund
parents:
50578
diff
changeset
|
410 |
allocator.initialize(start); |
1668
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
411 |
} |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
412 |
} |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
413 |
|
4636
90e004691873
6902115: G1:assert(ignore_max_completed||thread->is_Java_thread()||SafepointSynchronize::is_at_safepoint())
johnc
parents:
4571
diff
changeset
|
414 |
void CollectedHeap::fill_with_object(HeapWord* start, size_t words, bool zap) |
1668
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
415 |
{ |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
416 |
DEBUG_ONLY(fill_args_check(start, words);) |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
417 |
HandleMark hm; // Free handles before leaving. |
4636
90e004691873
6902115: G1:assert(ignore_max_completed||thread->is_Java_thread()||SafepointSynchronize::is_at_safepoint())
johnc
parents:
4571
diff
changeset
|
418 |
fill_with_object_impl(start, words, zap); |
1668
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
419 |
} |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
420 |
|
4636
90e004691873
6902115: G1:assert(ignore_max_completed||thread->is_Java_thread()||SafepointSynchronize::is_at_safepoint())
johnc
parents:
4571
diff
changeset
|
421 |
void CollectedHeap::fill_with_objects(HeapWord* start, size_t words, bool zap) |
1668
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
422 |
{ |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
423 |
DEBUG_ONLY(fill_args_check(start, words);) |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
424 |
HandleMark hm; // Free handles before leaving. |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
425 |
|
31603
4bd3b4863e10
8129573: CollectedHeap::fill_with_objects() needs to use multiple arrays in 32 bit mode too
tschatzl
parents:
30870
diff
changeset
|
426 |
// Multiple objects may be required depending on the filler array maximum size. Fill |
4bd3b4863e10
8129573: CollectedHeap::fill_with_objects() needs to use multiple arrays in 32 bit mode too
tschatzl
parents:
30870
diff
changeset
|
427 |
// the range up to that with objects that are filler_array_max_size sized. The |
4bd3b4863e10
8129573: CollectedHeap::fill_with_objects() needs to use multiple arrays in 32 bit mode too
tschatzl
parents:
30870
diff
changeset
|
428 |
// remainder is filled with a single object. |
1668
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
429 |
const size_t min = min_fill_size(); |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
430 |
const size_t max = filler_array_max_size(); |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
431 |
while (words > max) { |
31603
4bd3b4863e10
8129573: CollectedHeap::fill_with_objects() needs to use multiple arrays in 32 bit mode too
tschatzl
parents:
30870
diff
changeset
|
432 |
const size_t cur = (words - max) >= min ? max : max - min; |
4636
90e004691873
6902115: G1:assert(ignore_max_completed||thread->is_Java_thread()||SafepointSynchronize::is_at_safepoint())
johnc
parents:
4571
diff
changeset
|
433 |
fill_with_array(start, cur, zap); |
1668
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
434 |
start += cur; |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
435 |
words -= cur; |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
436 |
} |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
437 |
|
4636
90e004691873
6902115: G1:assert(ignore_max_completed||thread->is_Java_thread()||SafepointSynchronize::is_at_safepoint())
johnc
parents:
4571
diff
changeset
|
438 |
fill_with_object_impl(start, words, zap); |
1668
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
439 |
} |
8ec481b8f514
6578152: fill_region_with_object has usability and safety issues
jcoomes
parents:
1388
diff
changeset
|
440 |
|
50537 | 441 |
void CollectedHeap::fill_with_dummy_object(HeapWord* start, HeapWord* end, bool zap) { |
442 |
CollectedHeap::fill_with_object(start, end, zap); |
|
443 |
} |
|
444 |
||
52124 | 445 |
size_t CollectedHeap::min_dummy_object_size() const { |
446 |
return oopDesc::header_size(); |
|
447 |
} |
|
448 |
||
449 |
size_t CollectedHeap::tlab_alloc_reserve() const { |
|
450 |
size_t min_size = min_dummy_object_size(); |
|
451 |
return min_size > (size_t)MinObjAlignment ? align_object_size(min_size) : 0; |
|
452 |
} |
|
453 |
||
49945 | 454 |
HeapWord* CollectedHeap::allocate_new_tlab(size_t min_size, |
455 |
size_t requested_size, |
|
456 |
size_t* actual_size) { |
|
1 | 457 |
guarantee(false, "thread-local allocation buffers not supported"); |
458 |
return NULL; |
|
459 |
} |
|
460 |
||
461 |
void CollectedHeap::ensure_parsability(bool retire_tlabs) { |
|
51801
09e8e51c948a
8210713: Let CollectedHeap::ensure_parsability() take care of TLAB statistics gathering
pliden
parents:
51794
diff
changeset
|
462 |
assert(SafepointSynchronize::is_at_safepoint() || !is_init_completed(), |
51817
46eac084082d
8210857: Allow retiring TLABs and collecting statistics in parallel
pliden
parents:
51801
diff
changeset
|
463 |
"Should only be called at a safepoint or at start-up"); |
46eac084082d
8210857: Allow retiring TLABs and collecting statistics in parallel
pliden
parents:
51801
diff
changeset
|
464 |
|
46eac084082d
8210857: Allow retiring TLABs and collecting statistics in parallel
pliden
parents:
51801
diff
changeset
|
465 |
ThreadLocalAllocStats stats; |
51801
09e8e51c948a
8210713: Let CollectedHeap::ensure_parsability() take care of TLAB statistics gathering
pliden
parents:
51794
diff
changeset
|
466 |
|
51817
46eac084082d
8210857: Allow retiring TLABs and collecting statistics in parallel
pliden
parents:
51801
diff
changeset
|
467 |
for (JavaThreadIteratorWithHandle jtiwh; JavaThread *thread = jtiwh.next();) { |
46eac084082d
8210857: Allow retiring TLABs and collecting statistics in parallel
pliden
parents:
51801
diff
changeset
|
468 |
BarrierSet::barrier_set()->make_parsable(thread); |
46eac084082d
8210857: Allow retiring TLABs and collecting statistics in parallel
pliden
parents:
51801
diff
changeset
|
469 |
if (UseTLAB) { |
46eac084082d
8210857: Allow retiring TLABs and collecting statistics in parallel
pliden
parents:
51801
diff
changeset
|
470 |
if (retire_tlabs) { |
46eac084082d
8210857: Allow retiring TLABs and collecting statistics in parallel
pliden
parents:
51801
diff
changeset
|
471 |
thread->tlab().retire(&stats); |
46eac084082d
8210857: Allow retiring TLABs and collecting statistics in parallel
pliden
parents:
51801
diff
changeset
|
472 |
} else { |
46eac084082d
8210857: Allow retiring TLABs and collecting statistics in parallel
pliden
parents:
51801
diff
changeset
|
473 |
thread->tlab().make_parsable(); |
46eac084082d
8210857: Allow retiring TLABs and collecting statistics in parallel
pliden
parents:
51801
diff
changeset
|
474 |
} |
46eac084082d
8210857: Allow retiring TLABs and collecting statistics in parallel
pliden
parents:
51801
diff
changeset
|
475 |
} |
51801
09e8e51c948a
8210713: Let CollectedHeap::ensure_parsability() take care of TLAB statistics gathering
pliden
parents:
51794
diff
changeset
|
476 |
} |
09e8e51c948a
8210713: Let CollectedHeap::ensure_parsability() take care of TLAB statistics gathering
pliden
parents:
51794
diff
changeset
|
477 |
|
51817
46eac084082d
8210857: Allow retiring TLABs and collecting statistics in parallel
pliden
parents:
51801
diff
changeset
|
478 |
stats.publish(); |
1 | 479 |
} |
480 |
||
481 |
void CollectedHeap::resize_all_tlabs() { |
|
51794
4129f43607cb
8210753: Make ThreadLocalAllocBuffer::resize() public
pliden
parents:
51625
diff
changeset
|
482 |
assert(SafepointSynchronize::is_at_safepoint() || !is_init_completed(), |
4129f43607cb
8210753: Make ThreadLocalAllocBuffer::resize() public
pliden
parents:
51625
diff
changeset
|
483 |
"Should only resize tlabs at safepoint"); |
1 | 484 |
|
51794
4129f43607cb
8210753: Make ThreadLocalAllocBuffer::resize() public
pliden
parents:
51625
diff
changeset
|
485 |
if (UseTLAB && ResizeTLAB) { |
4129f43607cb
8210753: Make ThreadLocalAllocBuffer::resize() public
pliden
parents:
51625
diff
changeset
|
486 |
for (JavaThreadIteratorWithHandle jtiwh; JavaThread *thread = jtiwh.next(); ) { |
4129f43607cb
8210753: Make ThreadLocalAllocBuffer::resize() public
pliden
parents:
51625
diff
changeset
|
487 |
thread->tlab().resize(); |
4129f43607cb
8210753: Make ThreadLocalAllocBuffer::resize() public
pliden
parents:
51625
diff
changeset
|
488 |
} |
1 | 489 |
} |
490 |
} |
|
2141
e9a644aaff87
6797870: Add -XX:+{HeapDump,PrintClassHistogram}{Before,After}FullGC
ysr
parents:
1681
diff
changeset
|
491 |
|
35915
5808cd93abfc
8148755: -XX:+HeapDumpAfterFullGC creates heap dump both before and after Full GC
redestad
parents:
35529
diff
changeset
|
492 |
void CollectedHeap::full_gc_dump(GCTimer* timer, bool before) { |
35939
05df7e64ecfc
8149035: Make the full_gc_dump() calls be recorded as part of the GC
brutisso
parents:
35915
diff
changeset
|
493 |
assert(timer != NULL, "timer is null"); |
35915
5808cd93abfc
8148755: -XX:+HeapDumpAfterFullGC creates heap dump both before and after Full GC
redestad
parents:
35529
diff
changeset
|
494 |
if ((HeapDumpBeforeFullGC && before) || (HeapDumpAfterFullGC && !before)) { |
35939
05df7e64ecfc
8149035: Make the full_gc_dump() calls be recorded as part of the GC
brutisso
parents:
35915
diff
changeset
|
495 |
GCTraceTime(Info, gc) tm(before ? "Heap Dump (before full gc)" : "Heap Dump (after full gc)", timer); |
2141
e9a644aaff87
6797870: Add -XX:+{HeapDump,PrintClassHistogram}{Before,After}FullGC
ysr
parents:
1681
diff
changeset
|
496 |
HeapDumper::dump_heap(); |
e9a644aaff87
6797870: Add -XX:+{HeapDump,PrintClassHistogram}{Before,After}FullGC
ysr
parents:
1681
diff
changeset
|
497 |
} |
35939
05df7e64ecfc
8149035: Make the full_gc_dump() calls be recorded as part of the GC
brutisso
parents:
35915
diff
changeset
|
498 |
|
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46683
diff
changeset
|
499 |
LogTarget(Trace, gc, classhisto) lt; |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46683
diff
changeset
|
500 |
if (lt.is_enabled()) { |
35939
05df7e64ecfc
8149035: Make the full_gc_dump() calls be recorded as part of the GC
brutisso
parents:
35915
diff
changeset
|
501 |
GCTraceTime(Trace, gc, classhisto) tm(before ? "Class Histogram (before full gc)" : "Class Histogram (after full gc)", timer); |
35061 | 502 |
ResourceMark rm; |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46683
diff
changeset
|
503 |
LogStream ls(lt); |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46683
diff
changeset
|
504 |
VM_GC_HeapInspection inspector(&ls, false /* ! full gc */); |
2141
e9a644aaff87
6797870: Add -XX:+{HeapDump,PrintClassHistogram}{Before,After}FullGC
ysr
parents:
1681
diff
changeset
|
505 |
inspector.doit(); |
e9a644aaff87
6797870: Add -XX:+{HeapDump,PrintClassHistogram}{Before,After}FullGC
ysr
parents:
1681
diff
changeset
|
506 |
} |
e9a644aaff87
6797870: Add -XX:+{HeapDump,PrintClassHistogram}{Before,After}FullGC
ysr
parents:
1681
diff
changeset
|
507 |
} |
e9a644aaff87
6797870: Add -XX:+{HeapDump,PrintClassHistogram}{Before,After}FullGC
ysr
parents:
1681
diff
changeset
|
508 |
|
35061 | 509 |
void CollectedHeap::pre_full_gc_dump(GCTimer* timer) { |
35915
5808cd93abfc
8148755: -XX:+HeapDumpAfterFullGC creates heap dump both before and after Full GC
redestad
parents:
35529
diff
changeset
|
510 |
full_gc_dump(timer, true); |
35061 | 511 |
} |
512 |
||
18025 | 513 |
void CollectedHeap::post_full_gc_dump(GCTimer* timer) { |
35915
5808cd93abfc
8148755: -XX:+HeapDumpAfterFullGC creates heap dump both before and after Full GC
redestad
parents:
35529
diff
changeset
|
514 |
full_gc_dump(timer, false); |
2141
e9a644aaff87
6797870: Add -XX:+{HeapDump,PrintClassHistogram}{Before,After}FullGC
ysr
parents:
1681
diff
changeset
|
515 |
} |
10742 | 516 |
|
58678 | 517 |
void CollectedHeap::initialize_reserved_region(const ReservedHeapSpace& rs) { |
26829
26315213bab8
8055091: CollectedHeap::_reserved usage should be cleaned up
mlarsson
parents:
25350
diff
changeset
|
518 |
// It is important to do this in a way such that concurrent readers can't |
26315213bab8
8055091: CollectedHeap::_reserved usage should be cleaned up
mlarsson
parents:
25350
diff
changeset
|
519 |
// temporarily think something is in the heap. (Seen this happen in asserts.) |
26315213bab8
8055091: CollectedHeap::_reserved usage should be cleaned up
mlarsson
parents:
25350
diff
changeset
|
520 |
_reserved.set_word_size(0); |
58678 | 521 |
_reserved.set_start((HeapWord*)rs.base()); |
522 |
_reserved.set_end((HeapWord*)rs.end()); |
|
26829
26315213bab8
8055091: CollectedHeap::_reserved usage should be cleaned up
mlarsson
parents:
25350
diff
changeset
|
523 |
} |
48168
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
48105
diff
changeset
|
524 |
|
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
48105
diff
changeset
|
525 |
void CollectedHeap::post_initialize() { |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
48105
diff
changeset
|
526 |
initialize_serviceability(); |
cb5d2d4453d0
8191564: Refactor GC related servicability code into GC specific subclasses
rkennke
parents:
48105
diff
changeset
|
527 |
} |
49466 | 528 |
|
49593
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
529 |
#ifndef PRODUCT |
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
530 |
|
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
531 |
bool CollectedHeap::promotion_should_fail(volatile size_t* count) { |
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
532 |
// Access to count is not atomic; the value does not have to be exact. |
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
533 |
if (PromotionFailureALot) { |
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
534 |
const size_t gc_num = total_collections(); |
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
535 |
const size_t elapsed_gcs = gc_num - _promotion_failure_alot_gc_number; |
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
536 |
if (elapsed_gcs >= PromotionFailureALotInterval) { |
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
537 |
// Test for unsigned arithmetic wrap-around. |
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
538 |
if (++*count >= PromotionFailureALotCount) { |
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
539 |
*count = 0; |
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
540 |
return true; |
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
541 |
} |
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
542 |
} |
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
543 |
} |
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
544 |
return false; |
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
545 |
} |
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
546 |
|
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
547 |
bool CollectedHeap::promotion_should_fail() { |
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
548 |
return promotion_should_fail(&_promotion_failure_alot_count); |
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
549 |
} |
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
550 |
|
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
551 |
void CollectedHeap::reset_promotion_should_fail(volatile size_t* count) { |
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
552 |
if (PromotionFailureALot) { |
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
553 |
_promotion_failure_alot_gc_number = total_collections(); |
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
554 |
*count = 0; |
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
555 |
} |
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
556 |
} |
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
557 |
|
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
558 |
void CollectedHeap::reset_promotion_should_fail() { |
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
559 |
reset_promotion_should_fail(&_promotion_failure_alot_count); |
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
560 |
} |
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
561 |
|
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
562 |
#endif // #ifndef PRODUCT |
4dd58ecc9912
8200105: Remove cyclic dependency between oop.inline.hpp and collectedHeap.inline.hpp
stefank
parents:
49484
diff
changeset
|
563 |
|
49669
3569b528972e
8200429: Adjust object pinning interface on CollectedHeap
pliden
parents:
49593
diff
changeset
|
564 |
bool CollectedHeap::supports_object_pinning() const { |
3569b528972e
8200429: Adjust object pinning interface on CollectedHeap
pliden
parents:
49593
diff
changeset
|
565 |
return false; |
49466 | 566 |
} |
567 |
||
49669
3569b528972e
8200429: Adjust object pinning interface on CollectedHeap
pliden
parents:
49593
diff
changeset
|
568 |
oop CollectedHeap::pin_object(JavaThread* thread, oop obj) { |
3569b528972e
8200429: Adjust object pinning interface on CollectedHeap
pliden
parents:
49593
diff
changeset
|
569 |
ShouldNotReachHere(); |
3569b528972e
8200429: Adjust object pinning interface on CollectedHeap
pliden
parents:
49593
diff
changeset
|
570 |
return NULL; |
49466 | 571 |
} |
49669
3569b528972e
8200429: Adjust object pinning interface on CollectedHeap
pliden
parents:
49593
diff
changeset
|
572 |
|
3569b528972e
8200429: Adjust object pinning interface on CollectedHeap
pliden
parents:
49593
diff
changeset
|
573 |
void CollectedHeap::unpin_object(JavaThread* thread, oop obj) { |
3569b528972e
8200429: Adjust object pinning interface on CollectedHeap
pliden
parents:
49593
diff
changeset
|
574 |
ShouldNotReachHere(); |
3569b528972e
8200429: Adjust object pinning interface on CollectedHeap
pliden
parents:
49593
diff
changeset
|
575 |
} |
50057
f945444fabc3
8202647: Add deduplicate_string function to CollectedHeap
stefank
parents:
49945
diff
changeset
|
576 |
|
f945444fabc3
8202647: Add deduplicate_string function to CollectedHeap
stefank
parents:
49945
diff
changeset
|
577 |
void CollectedHeap::deduplicate_string(oop str) { |
f945444fabc3
8202647: Add deduplicate_string function to CollectedHeap
stefank
parents:
49945
diff
changeset
|
578 |
// Do nothing, unless overridden in subclass. |
f945444fabc3
8202647: Add deduplicate_string function to CollectedHeap
stefank
parents:
49945
diff
changeset
|
579 |
} |
52071
c4a39588a075
8211270: GC abstraction to get real object and headers size
rkennke
parents:
51817
diff
changeset
|
580 |
|
c4a39588a075
8211270: GC abstraction to get real object and headers size
rkennke
parents:
51817
diff
changeset
|
581 |
size_t CollectedHeap::obj_size(oop obj) const { |
c4a39588a075
8211270: GC abstraction to get real object and headers size
rkennke
parents:
51817
diff
changeset
|
582 |
return obj->size(); |
c4a39588a075
8211270: GC abstraction to get real object and headers size
rkennke
parents:
51817
diff
changeset
|
583 |
} |
54376 | 584 |
|
585 |
uint32_t CollectedHeap::hash_oop(oop obj) const { |
|
586 |
const uintptr_t addr = cast_from_oop<uintptr_t>(obj); |
|
587 |
return static_cast<uint32_t>(addr >> LogMinObjAlignment); |
|
588 |
} |