author | zgu |
Mon, 15 Apr 2019 13:07:06 -0400 | |
changeset 54536 | fb53a1c25903 |
parent 54522 | 60bc754b9744 |
child 54605 | f6f95cb8643e |
permissions | -rw-r--r-- |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1 |
/* |
53276
72fdf46a274e
8215549: Shenandoah deduplication cleans up table/queue twice
zgu
parents:
52925
diff
changeset
|
2 |
* Copyright (c) 2013, 2019, Red Hat, Inc. All rights reserved. |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
3 |
* |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
4 |
* This code is free software; you can redistribute it and/or modify it |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
5 |
* under the terms of the GNU General Public License version 2 only, as |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
6 |
* published by the Free Software Foundation. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
7 |
* |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
8 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
9 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
10 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
11 |
* version 2 for more details (a copy is included in the LICENSE file that |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
12 |
* accompanied this code). |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
13 |
* |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License version |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
15 |
* 2 along with this work; if not, write to the Free Software Foundation, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
16 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
17 |
* |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
18 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
19 |
* or visit www.oracle.com if you need additional information or have any |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
20 |
* questions. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
21 |
* |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
22 |
*/ |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
23 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
24 |
#include "precompiled.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
25 |
#include "memory/allocation.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
26 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
27 |
#include "gc/shared/gcTimer.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
28 |
#include "gc/shared/gcTraceTime.inline.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
29 |
#include "gc/shared/memAllocator.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
30 |
#include "gc/shared/parallelCleaning.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
31 |
#include "gc/shared/plab.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
32 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
33 |
#include "gc/shenandoah/shenandoahAllocTracker.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
34 |
#include "gc/shenandoah/shenandoahBarrierSet.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
35 |
#include "gc/shenandoah/shenandoahBrooksPointer.hpp" |
54536
fb53a1c25903
8222425: Shenandoah: Move commonly used closures to separate files
zgu
parents:
54522
diff
changeset
|
36 |
#include "gc/shenandoah/shenandoahClosures.inline.hpp" |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
37 |
#include "gc/shenandoah/shenandoahCollectionSet.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
38 |
#include "gc/shenandoah/shenandoahCollectorPolicy.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
39 |
#include "gc/shenandoah/shenandoahConcurrentMark.inline.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
40 |
#include "gc/shenandoah/shenandoahControlThread.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
41 |
#include "gc/shenandoah/shenandoahFreeSet.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
42 |
#include "gc/shenandoah/shenandoahPhaseTimings.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
43 |
#include "gc/shenandoah/shenandoahHeap.inline.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
44 |
#include "gc/shenandoah/shenandoahHeapRegion.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
45 |
#include "gc/shenandoah/shenandoahHeapRegionSet.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
46 |
#include "gc/shenandoah/shenandoahMarkCompact.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
47 |
#include "gc/shenandoah/shenandoahMarkingContext.inline.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
48 |
#include "gc/shenandoah/shenandoahMemoryPool.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
49 |
#include "gc/shenandoah/shenandoahMetrics.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
50 |
#include "gc/shenandoah/shenandoahMonitoringSupport.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
51 |
#include "gc/shenandoah/shenandoahOopClosures.inline.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
52 |
#include "gc/shenandoah/shenandoahPacer.inline.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
53 |
#include "gc/shenandoah/shenandoahRootProcessor.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
54 |
#include "gc/shenandoah/shenandoahStringDedup.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
55 |
#include "gc/shenandoah/shenandoahUtils.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
56 |
#include "gc/shenandoah/shenandoahVerifier.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
57 |
#include "gc/shenandoah/shenandoahCodeRoots.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
58 |
#include "gc/shenandoah/shenandoahVMOperations.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
59 |
#include "gc/shenandoah/shenandoahWorkGroup.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
60 |
#include "gc/shenandoah/shenandoahWorkerPolicy.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
61 |
#include "gc/shenandoah/heuristics/shenandoahAdaptiveHeuristics.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
62 |
#include "gc/shenandoah/heuristics/shenandoahAggressiveHeuristics.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
63 |
#include "gc/shenandoah/heuristics/shenandoahCompactHeuristics.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
64 |
#include "gc/shenandoah/heuristics/shenandoahPassiveHeuristics.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
65 |
#include "gc/shenandoah/heuristics/shenandoahStaticHeuristics.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
66 |
#include "gc/shenandoah/heuristics/shenandoahTraversalHeuristics.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
67 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
68 |
#include "memory/metaspace.hpp" |
53582 | 69 |
#include "runtime/interfaceSupport.inline.hpp" |
70 |
#include "runtime/safepointMechanism.hpp" |
|
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
71 |
#include "runtime/vmThread.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
72 |
#include "services/mallocTracker.hpp" |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
73 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
74 |
#ifdef ASSERT |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
75 |
template <class T> |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
76 |
void ShenandoahAssertToSpaceClosure::do_oop_work(T* p) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
77 |
T o = RawAccess<>::oop_load(p); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
78 |
if (! CompressedOops::is_null(o)) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
79 |
oop obj = CompressedOops::decode_not_null(o); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
80 |
shenandoah_assert_not_forwarded(p, obj); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
81 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
82 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
83 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
84 |
void ShenandoahAssertToSpaceClosure::do_oop(narrowOop* p) { do_oop_work(p); } |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
85 |
void ShenandoahAssertToSpaceClosure::do_oop(oop* p) { do_oop_work(p); } |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
86 |
#endif |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
87 |
|
54046
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
88 |
class ShenandoahPretouchHeapTask : public AbstractGangTask { |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
89 |
private: |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
90 |
ShenandoahRegionIterator _regions; |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
91 |
const size_t _page_size; |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
92 |
public: |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
93 |
ShenandoahPretouchHeapTask(size_t page_size) : |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
94 |
AbstractGangTask("Shenandoah Pretouch Heap"), |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
95 |
_page_size(page_size) {} |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
96 |
|
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
97 |
virtual void work(uint worker_id) { |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
98 |
ShenandoahHeapRegion* r = _regions.next(); |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
99 |
while (r != NULL) { |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
100 |
os::pretouch_memory(r->bottom(), r->end(), _page_size); |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
101 |
r = _regions.next(); |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
102 |
} |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
103 |
} |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
104 |
}; |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
105 |
|
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
106 |
class ShenandoahPretouchBitmapTask : public AbstractGangTask { |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
107 |
private: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
108 |
ShenandoahRegionIterator _regions; |
54045 | 109 |
char* _bitmap_base; |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
110 |
const size_t _bitmap_size; |
54046
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
111 |
const size_t _page_size; |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
112 |
public: |
54046
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
113 |
ShenandoahPretouchBitmapTask(char* bitmap_base, size_t bitmap_size, size_t page_size) : |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
114 |
AbstractGangTask("Shenandoah Pretouch Bitmap"), |
54045 | 115 |
_bitmap_base(bitmap_base), |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
116 |
_bitmap_size(bitmap_size), |
54046
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
117 |
_page_size(page_size) {} |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
118 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
119 |
virtual void work(uint worker_id) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
120 |
ShenandoahHeapRegion* r = _regions.next(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
121 |
while (r != NULL) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
122 |
size_t start = r->region_number() * ShenandoahHeapRegion::region_size_bytes() / MarkBitMap::heap_map_factor(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
123 |
size_t end = (r->region_number() + 1) * ShenandoahHeapRegion::region_size_bytes() / MarkBitMap::heap_map_factor(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
124 |
assert (end <= _bitmap_size, "end is sane: " SIZE_FORMAT " < " SIZE_FORMAT, end, _bitmap_size); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
125 |
|
54046
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
126 |
os::pretouch_memory(_bitmap_base + start, _bitmap_base + end, _page_size); |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
127 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
128 |
r = _regions.next(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
129 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
130 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
131 |
}; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
132 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
133 |
jint ShenandoahHeap::initialize() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
134 |
ShenandoahBrooksPointer::initial_checks(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
135 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
136 |
initialize_heuristics(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
137 |
|
54045 | 138 |
// |
139 |
// Figure out heap sizing |
|
140 |
// |
|
141 |
||
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
142 |
size_t init_byte_size = collector_policy()->initial_heap_byte_size(); |
54478
cdc54443fee5
8222186: Shenandoah should not uncommit below minimum heap size
shade
parents:
54477
diff
changeset
|
143 |
size_t min_byte_size = collector_policy()->min_heap_byte_size(); |
54045 | 144 |
size_t max_byte_size = collector_policy()->max_heap_byte_size(); |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
145 |
size_t heap_alignment = collector_policy()->heap_alignment(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
146 |
|
54045 | 147 |
size_t reg_size_bytes = ShenandoahHeapRegion::region_size_bytes(); |
148 |
||
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
149 |
if (ShenandoahAlwaysPreTouch) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
150 |
// Enabled pre-touch means the entire heap is committed right away. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
151 |
init_byte_size = max_byte_size; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
152 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
153 |
|
54045 | 154 |
Universe::check_alignment(max_byte_size, reg_size_bytes, "Shenandoah heap"); |
155 |
Universe::check_alignment(init_byte_size, reg_size_bytes, "Shenandoah heap"); |
|
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
156 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
157 |
_num_regions = ShenandoahHeapRegion::region_count(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
158 |
|
54045 | 159 |
size_t num_committed_regions = init_byte_size / reg_size_bytes; |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
160 |
num_committed_regions = MIN2(num_committed_regions, _num_regions); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
161 |
assert(num_committed_regions <= _num_regions, "sanity"); |
54045 | 162 |
_initial_size = num_committed_regions * reg_size_bytes; |
54478
cdc54443fee5
8222186: Shenandoah should not uncommit below minimum heap size
shade
parents:
54477
diff
changeset
|
163 |
|
cdc54443fee5
8222186: Shenandoah should not uncommit below minimum heap size
shade
parents:
54477
diff
changeset
|
164 |
size_t num_min_regions = min_byte_size / reg_size_bytes; |
cdc54443fee5
8222186: Shenandoah should not uncommit below minimum heap size
shade
parents:
54477
diff
changeset
|
165 |
num_min_regions = MIN2(num_min_regions, _num_regions); |
cdc54443fee5
8222186: Shenandoah should not uncommit below minimum heap size
shade
parents:
54477
diff
changeset
|
166 |
assert(num_min_regions <= _num_regions, "sanity"); |
cdc54443fee5
8222186: Shenandoah should not uncommit below minimum heap size
shade
parents:
54477
diff
changeset
|
167 |
_minimum_size = num_min_regions * reg_size_bytes; |
cdc54443fee5
8222186: Shenandoah should not uncommit below minimum heap size
shade
parents:
54477
diff
changeset
|
168 |
|
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
169 |
_committed = _initial_size; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
170 |
|
54045 | 171 |
size_t heap_page_size = UseLargePages ? (size_t)os::large_page_size() : (size_t)os::vm_page_size(); |
172 |
size_t bitmap_page_size = UseLargePages ? (size_t)os::large_page_size() : (size_t)os::vm_page_size(); |
|
173 |
||
174 |
// |
|
175 |
// Reserve and commit memory for heap |
|
176 |
// |
|
177 |
||
178 |
ReservedSpace heap_rs = Universe::reserve_heap(max_byte_size, heap_alignment); |
|
179 |
initialize_reserved_region((HeapWord*)heap_rs.base(), (HeapWord*) (heap_rs.base() + heap_rs.size())); |
|
180 |
_heap_region = MemRegion((HeapWord*)heap_rs.base(), heap_rs.size() / HeapWordSize); |
|
54047
0a9cb99a98a0
8220162: Shenandoah should not commit HugeTLBFS memory
shade
parents:
54046
diff
changeset
|
181 |
_heap_region_special = heap_rs.special(); |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
182 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
183 |
assert((((size_t) base()) & ShenandoahHeapRegion::region_size_bytes_mask()) == 0, |
54045 | 184 |
"Misaligned heap: " PTR_FORMAT, p2i(base())); |
185 |
||
186 |
ReservedSpace sh_rs = heap_rs.first_part(max_byte_size); |
|
54047
0a9cb99a98a0
8220162: Shenandoah should not commit HugeTLBFS memory
shade
parents:
54046
diff
changeset
|
187 |
if (!_heap_region_special) { |
0a9cb99a98a0
8220162: Shenandoah should not commit HugeTLBFS memory
shade
parents:
54046
diff
changeset
|
188 |
os::commit_memory_or_exit(sh_rs.base(), _initial_size, heap_alignment, false, |
0a9cb99a98a0
8220162: Shenandoah should not commit HugeTLBFS memory
shade
parents:
54046
diff
changeset
|
189 |
"Cannot commit heap memory"); |
0a9cb99a98a0
8220162: Shenandoah should not commit HugeTLBFS memory
shade
parents:
54046
diff
changeset
|
190 |
} |
54045 | 191 |
|
192 |
// |
|
193 |
// Reserve and commit memory for bitmap(s) |
|
194 |
// |
|
195 |
||
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
196 |
_bitmap_size = MarkBitMap::compute_size(heap_rs.size()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
197 |
_bitmap_size = align_up(_bitmap_size, bitmap_page_size); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
198 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
199 |
size_t bitmap_bytes_per_region = reg_size_bytes / MarkBitMap::heap_map_factor(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
200 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
201 |
guarantee(bitmap_bytes_per_region != 0, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
202 |
"Bitmap bytes per region should not be zero"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
203 |
guarantee(is_power_of_2(bitmap_bytes_per_region), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
204 |
"Bitmap bytes per region should be power of two: " SIZE_FORMAT, bitmap_bytes_per_region); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
205 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
206 |
if (bitmap_page_size > bitmap_bytes_per_region) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
207 |
_bitmap_regions_per_slice = bitmap_page_size / bitmap_bytes_per_region; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
208 |
_bitmap_bytes_per_slice = bitmap_page_size; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
209 |
} else { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
210 |
_bitmap_regions_per_slice = 1; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
211 |
_bitmap_bytes_per_slice = bitmap_bytes_per_region; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
212 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
213 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
214 |
guarantee(_bitmap_regions_per_slice >= 1, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
215 |
"Should have at least one region per slice: " SIZE_FORMAT, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
216 |
_bitmap_regions_per_slice); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
217 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
218 |
guarantee(((_bitmap_bytes_per_slice) % bitmap_page_size) == 0, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
219 |
"Bitmap slices should be page-granular: bps = " SIZE_FORMAT ", page size = " SIZE_FORMAT, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
220 |
_bitmap_bytes_per_slice, bitmap_page_size); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
221 |
|
54045 | 222 |
ReservedSpace bitmap(_bitmap_size, bitmap_page_size); |
223 |
MemTracker::record_virtual_memory_type(bitmap.base(), mtGC); |
|
224 |
_bitmap_region = MemRegion((HeapWord*) bitmap.base(), bitmap.size() / HeapWordSize); |
|
54047
0a9cb99a98a0
8220162: Shenandoah should not commit HugeTLBFS memory
shade
parents:
54046
diff
changeset
|
225 |
_bitmap_region_special = bitmap.special(); |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
226 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
227 |
size_t bitmap_init_commit = _bitmap_bytes_per_slice * |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
228 |
align_up(num_committed_regions, _bitmap_regions_per_slice) / _bitmap_regions_per_slice; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
229 |
bitmap_init_commit = MIN2(_bitmap_size, bitmap_init_commit); |
54047
0a9cb99a98a0
8220162: Shenandoah should not commit HugeTLBFS memory
shade
parents:
54046
diff
changeset
|
230 |
if (!_bitmap_region_special) { |
0a9cb99a98a0
8220162: Shenandoah should not commit HugeTLBFS memory
shade
parents:
54046
diff
changeset
|
231 |
os::commit_memory_or_exit((char *) _bitmap_region.start(), bitmap_init_commit, bitmap_page_size, false, |
0a9cb99a98a0
8220162: Shenandoah should not commit HugeTLBFS memory
shade
parents:
54046
diff
changeset
|
232 |
"Cannot commit bitmap memory"); |
0a9cb99a98a0
8220162: Shenandoah should not commit HugeTLBFS memory
shade
parents:
54046
diff
changeset
|
233 |
} |
54045 | 234 |
|
235 |
_marking_context = new ShenandoahMarkingContext(_heap_region, _bitmap_region, _num_regions); |
|
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
236 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
237 |
if (ShenandoahVerify) { |
54045 | 238 |
ReservedSpace verify_bitmap(_bitmap_size, bitmap_page_size); |
54047
0a9cb99a98a0
8220162: Shenandoah should not commit HugeTLBFS memory
shade
parents:
54046
diff
changeset
|
239 |
if (!verify_bitmap.special()) { |
0a9cb99a98a0
8220162: Shenandoah should not commit HugeTLBFS memory
shade
parents:
54046
diff
changeset
|
240 |
os::commit_memory_or_exit(verify_bitmap.base(), verify_bitmap.size(), bitmap_page_size, false, |
0a9cb99a98a0
8220162: Shenandoah should not commit HugeTLBFS memory
shade
parents:
54046
diff
changeset
|
241 |
"Cannot commit verification bitmap memory"); |
0a9cb99a98a0
8220162: Shenandoah should not commit HugeTLBFS memory
shade
parents:
54046
diff
changeset
|
242 |
} |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
243 |
MemTracker::record_virtual_memory_type(verify_bitmap.base(), mtGC); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
244 |
MemRegion verify_bitmap_region = MemRegion((HeapWord *) verify_bitmap.base(), verify_bitmap.size() / HeapWordSize); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
245 |
_verification_bit_map.initialize(_heap_region, verify_bitmap_region); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
246 |
_verifier = new ShenandoahVerifier(this, &_verification_bit_map); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
247 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
248 |
|
54045 | 249 |
// Reserve aux bitmap for use in object_iterate(). We don't commit it here. |
250 |
ReservedSpace aux_bitmap(_bitmap_size, bitmap_page_size); |
|
251 |
MemTracker::record_virtual_memory_type(aux_bitmap.base(), mtGC); |
|
252 |
_aux_bitmap_region = MemRegion((HeapWord*) aux_bitmap.base(), aux_bitmap.size() / HeapWordSize); |
|
54047
0a9cb99a98a0
8220162: Shenandoah should not commit HugeTLBFS memory
shade
parents:
54046
diff
changeset
|
253 |
_aux_bitmap_region_special = aux_bitmap.special(); |
54045 | 254 |
_aux_bit_map.initialize(_heap_region, _aux_bitmap_region); |
255 |
||
256 |
// |
|
257 |
// Create regions and region sets |
|
258 |
// |
|
259 |
||
260 |
_regions = NEW_C_HEAP_ARRAY(ShenandoahHeapRegion*, _num_regions, mtGC); |
|
261 |
_free_set = new ShenandoahFreeSet(this, _num_regions); |
|
262 |
_collection_set = new ShenandoahCollectionSet(this, (HeapWord*)sh_rs.base()); |
|
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
263 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
264 |
{ |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
265 |
ShenandoahHeapLocker locker(lock()); |
54045 | 266 |
|
267 |
size_t size_words = ShenandoahHeapRegion::region_size_words(); |
|
268 |
||
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
269 |
for (size_t i = 0; i < _num_regions; i++) { |
54045 | 270 |
HeapWord* start = (HeapWord*)sh_rs.base() + size_words * i; |
271 |
bool is_committed = i < num_committed_regions; |
|
272 |
ShenandoahHeapRegion* r = new ShenandoahHeapRegion(this, start, size_words, i, is_committed); |
|
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
273 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
274 |
_marking_context->initialize_top_at_mark_start(r); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
275 |
_regions[i] = r; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
276 |
assert(!collection_set()->is_in(i), "New region should not be in collection set"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
277 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
278 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
279 |
// Initialize to complete |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
280 |
_marking_context->mark_complete(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
281 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
282 |
_free_set->rebuild(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
283 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
284 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
285 |
if (ShenandoahAlwaysPreTouch) { |
54045 | 286 |
assert(!AlwaysPreTouch, "Should have been overridden"); |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
287 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
288 |
// For NUMA, it is important to pre-touch the storage under bitmaps with worker threads, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
289 |
// before initialize() below zeroes it with initializing thread. For any given region, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
290 |
// we touch the region and the corresponding bitmaps from the same thread. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
291 |
ShenandoahPushWorkerScope scope(workers(), _max_workers, false); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
292 |
|
54046
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
293 |
size_t pretouch_heap_page_size = heap_page_size; |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
294 |
size_t pretouch_bitmap_page_size = bitmap_page_size; |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
295 |
|
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
296 |
#ifdef LINUX |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
297 |
// UseTransparentHugePages would madvise that backing memory can be coalesced into huge |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
298 |
// pages. But, the kernel needs to know that every small page is used, in order to coalesce |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
299 |
// them into huge one. Therefore, we need to pretouch with smaller pages. |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
300 |
if (UseTransparentHugePages) { |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
301 |
pretouch_heap_page_size = (size_t)os::vm_page_size(); |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
302 |
pretouch_bitmap_page_size = (size_t)os::vm_page_size(); |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
303 |
} |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
304 |
#endif |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
305 |
|
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
306 |
// OS memory managers may want to coalesce back-to-back pages. Make their jobs |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
307 |
// simpler by pre-touching continuous spaces (heap and bitmap) separately. |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
308 |
|
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
309 |
log_info(gc, init)("Pretouch bitmap: " SIZE_FORMAT " regions, " SIZE_FORMAT " bytes page", |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
310 |
_num_regions, pretouch_bitmap_page_size); |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
311 |
ShenandoahPretouchBitmapTask bcl(bitmap.base(), _bitmap_size, pretouch_bitmap_page_size); |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
312 |
_workers->run_task(&bcl); |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
313 |
|
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
314 |
log_info(gc, init)("Pretouch heap: " SIZE_FORMAT " regions, " SIZE_FORMAT " bytes page", |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
315 |
_num_regions, pretouch_heap_page_size); |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
316 |
ShenandoahPretouchHeapTask hcl(pretouch_heap_page_size); |
f02c6b980c04
8220153: Shenandoah does not work with TransparentHugePages properly
shade
parents:
54045
diff
changeset
|
317 |
_workers->run_task(&hcl); |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
318 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
319 |
|
54045 | 320 |
// |
321 |
// Initialize the rest of GC subsystems |
|
322 |
// |
|
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
323 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
324 |
_liveness_cache = NEW_C_HEAP_ARRAY(jushort*, _max_workers, mtGC); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
325 |
for (uint worker = 0; worker < _max_workers; worker++) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
326 |
_liveness_cache[worker] = NEW_C_HEAP_ARRAY(jushort, _num_regions, mtGC); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
327 |
Copy::fill_to_bytes(_liveness_cache[worker], _num_regions * sizeof(jushort)); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
328 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
329 |
|
54045 | 330 |
// The call below uses stuff (the SATB* things) that are in G1, but probably |
331 |
// belong into a shared location. |
|
332 |
ShenandoahBarrierSet::satb_mark_queue_set().initialize(this, |
|
333 |
SATB_Q_CBL_mon, |
|
334 |
20 /* G1SATBProcessCompletedThreshold */, |
|
335 |
60 /* G1SATBBufferEnqueueingThresholdPercent */); |
|
336 |
||
337 |
_monitoring_support = new ShenandoahMonitoringSupport(this); |
|
338 |
_phase_timings = new ShenandoahPhaseTimings(); |
|
339 |
ShenandoahStringDedup::initialize(); |
|
340 |
ShenandoahCodeRoots::initialize(); |
|
341 |
||
342 |
if (ShenandoahAllocationTrace) { |
|
343 |
_alloc_tracker = new ShenandoahAllocTracker(); |
|
344 |
} |
|
345 |
||
346 |
if (ShenandoahPacing) { |
|
347 |
_pacer = new ShenandoahPacer(this); |
|
348 |
_pacer->setup_for_idle(); |
|
349 |
} else { |
|
350 |
_pacer = NULL; |
|
351 |
} |
|
352 |
||
353 |
_traversal_gc = heuristics()->can_do_traversal_gc() ? |
|
354 |
new ShenandoahTraversalGC(this, _num_regions) : |
|
355 |
NULL; |
|
356 |
||
357 |
_control_thread = new ShenandoahControlThread(); |
|
358 |
||
54478
cdc54443fee5
8222186: Shenandoah should not uncommit below minimum heap size
shade
parents:
54477
diff
changeset
|
359 |
log_info(gc, init)("Initialize Shenandoah heap: " SIZE_FORMAT "%s initial, " SIZE_FORMAT "%s min, " SIZE_FORMAT "%s max", |
cdc54443fee5
8222186: Shenandoah should not uncommit below minimum heap size
shade
parents:
54477
diff
changeset
|
360 |
byte_size_in_proper_unit(_initial_size), proper_unit_for_byte_size(_initial_size), |
cdc54443fee5
8222186: Shenandoah should not uncommit below minimum heap size
shade
parents:
54477
diff
changeset
|
361 |
byte_size_in_proper_unit(_minimum_size), proper_unit_for_byte_size(_minimum_size), |
cdc54443fee5
8222186: Shenandoah should not uncommit below minimum heap size
shade
parents:
54477
diff
changeset
|
362 |
byte_size_in_proper_unit(max_capacity()), proper_unit_for_byte_size(max_capacity()) |
cdc54443fee5
8222186: Shenandoah should not uncommit below minimum heap size
shade
parents:
54477
diff
changeset
|
363 |
); |
54045 | 364 |
|
365 |
log_info(gc, init)("Safepointing mechanism: %s", |
|
366 |
SafepointMechanism::uses_thread_local_poll() ? "thread-local poll" : |
|
367 |
(SafepointMechanism::uses_global_page_poll() ? "global-page poll" : "unknown")); |
|
368 |
||
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
369 |
return JNI_OK; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
370 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
371 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
372 |
void ShenandoahHeap::initialize_heuristics() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
373 |
if (ShenandoahGCHeuristics != NULL) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
374 |
if (strcmp(ShenandoahGCHeuristics, "aggressive") == 0) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
375 |
_heuristics = new ShenandoahAggressiveHeuristics(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
376 |
} else if (strcmp(ShenandoahGCHeuristics, "static") == 0) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
377 |
_heuristics = new ShenandoahStaticHeuristics(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
378 |
} else if (strcmp(ShenandoahGCHeuristics, "adaptive") == 0) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
379 |
_heuristics = new ShenandoahAdaptiveHeuristics(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
380 |
} else if (strcmp(ShenandoahGCHeuristics, "passive") == 0) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
381 |
_heuristics = new ShenandoahPassiveHeuristics(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
382 |
} else if (strcmp(ShenandoahGCHeuristics, "compact") == 0) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
383 |
_heuristics = new ShenandoahCompactHeuristics(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
384 |
} else if (strcmp(ShenandoahGCHeuristics, "traversal") == 0) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
385 |
_heuristics = new ShenandoahTraversalHeuristics(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
386 |
} else { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
387 |
vm_exit_during_initialization("Unknown -XX:ShenandoahGCHeuristics option"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
388 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
389 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
390 |
if (_heuristics->is_diagnostic() && !UnlockDiagnosticVMOptions) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
391 |
vm_exit_during_initialization( |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
392 |
err_msg("Heuristics \"%s\" is diagnostic, and must be enabled via -XX:+UnlockDiagnosticVMOptions.", |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
393 |
_heuristics->name())); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
394 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
395 |
if (_heuristics->is_experimental() && !UnlockExperimentalVMOptions) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
396 |
vm_exit_during_initialization( |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
397 |
err_msg("Heuristics \"%s\" is experimental, and must be enabled via -XX:+UnlockExperimentalVMOptions.", |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
398 |
_heuristics->name())); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
399 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
400 |
log_info(gc, init)("Shenandoah heuristics: %s", |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
401 |
_heuristics->name()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
402 |
} else { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
403 |
ShouldNotReachHere(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
404 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
405 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
406 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
407 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
408 |
#ifdef _MSC_VER |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
409 |
#pragma warning( push ) |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
410 |
#pragma warning( disable:4355 ) // 'this' : used in base member initializer list |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
411 |
#endif |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
412 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
413 |
ShenandoahHeap::ShenandoahHeap(ShenandoahCollectorPolicy* policy) : |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
414 |
CollectedHeap(), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
415 |
_initial_size(0), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
416 |
_used(0), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
417 |
_committed(0), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
418 |
_bytes_allocated_since_gc_start(0), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
419 |
_max_workers(MAX2(ConcGCThreads, ParallelGCThreads)), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
420 |
_workers(NULL), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
421 |
_safepoint_workers(NULL), |
54047
0a9cb99a98a0
8220162: Shenandoah should not commit HugeTLBFS memory
shade
parents:
54046
diff
changeset
|
422 |
_heap_region_special(false), |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
423 |
_num_regions(0), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
424 |
_regions(NULL), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
425 |
_update_refs_iterator(this), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
426 |
_control_thread(NULL), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
427 |
_shenandoah_policy(policy), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
428 |
_heuristics(NULL), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
429 |
_free_set(NULL), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
430 |
_scm(new ShenandoahConcurrentMark()), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
431 |
_traversal_gc(NULL), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
432 |
_full_gc(new ShenandoahMarkCompact()), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
433 |
_pacer(NULL), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
434 |
_verifier(NULL), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
435 |
_alloc_tracker(NULL), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
436 |
_phase_timings(NULL), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
437 |
_monitoring_support(NULL), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
438 |
_memory_pool(NULL), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
439 |
_stw_memory_manager("Shenandoah Pauses", "end of GC pause"), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
440 |
_cycle_memory_manager("Shenandoah Cycles", "end of GC cycle"), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
441 |
_gc_timer(new (ResourceObj::C_HEAP, mtGC) ConcurrentGCTimer()), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
442 |
_soft_ref_policy(), |
54388
a1acc800c87a
8220602: Shenandoah-SA: Enable best-effort implementation of heap walk
zgu
parents:
54338
diff
changeset
|
443 |
_log_min_obj_alignment_in_bytes(LogMinObjAlignmentInBytes), |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
444 |
_ref_processor(NULL), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
445 |
_marking_context(NULL), |
54045 | 446 |
_bitmap_size(0), |
447 |
_bitmap_regions_per_slice(0), |
|
448 |
_bitmap_bytes_per_slice(0), |
|
54047
0a9cb99a98a0
8220162: Shenandoah should not commit HugeTLBFS memory
shade
parents:
54046
diff
changeset
|
449 |
_bitmap_region_special(false), |
0a9cb99a98a0
8220162: Shenandoah should not commit HugeTLBFS memory
shade
parents:
54046
diff
changeset
|
450 |
_aux_bitmap_region_special(false), |
54045 | 451 |
_liveness_cache(NULL), |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
452 |
_collection_set(NULL) |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
453 |
{ |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
454 |
log_info(gc, init)("GC threads: " UINT32_FORMAT " parallel, " UINT32_FORMAT " concurrent", ParallelGCThreads, ConcGCThreads); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
455 |
log_info(gc, init)("Reference processing: %s", ParallelRefProcEnabled ? "parallel" : "serial"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
456 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
457 |
BarrierSet::set_barrier_set(new ShenandoahBarrierSet(this)); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
458 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
459 |
_max_workers = MAX2(_max_workers, 1U); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
460 |
_workers = new ShenandoahWorkGang("Shenandoah GC Threads", _max_workers, |
54522
60bc754b9744
8222188: Shenandoah: Adjust Shenandoah work gang types
zgu
parents:
54478
diff
changeset
|
461 |
/* are_GC_task_threads */ true, |
60bc754b9744
8222188: Shenandoah: Adjust Shenandoah work gang types
zgu
parents:
54478
diff
changeset
|
462 |
/* are_ConcurrentGC_threads */ true); |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
463 |
if (_workers == NULL) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
464 |
vm_exit_during_initialization("Failed necessary allocation."); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
465 |
} else { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
466 |
_workers->initialize_workers(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
467 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
468 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
469 |
if (ShenandoahParallelSafepointThreads > 1) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
470 |
_safepoint_workers = new ShenandoahWorkGang("Safepoint Cleanup Thread", |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
471 |
ShenandoahParallelSafepointThreads, |
54522
60bc754b9744
8222188: Shenandoah: Adjust Shenandoah work gang types
zgu
parents:
54478
diff
changeset
|
472 |
/* are_GC_task_threads */ false, |
60bc754b9744
8222188: Shenandoah: Adjust Shenandoah work gang types
zgu
parents:
54478
diff
changeset
|
473 |
/* are_ConcurrentGC_threads */ false); |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
474 |
_safepoint_workers->initialize_workers(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
475 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
476 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
477 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
478 |
#ifdef _MSC_VER |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
479 |
#pragma warning( pop ) |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
480 |
#endif |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
481 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
482 |
class ShenandoahResetBitmapTask : public AbstractGangTask { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
483 |
private: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
484 |
ShenandoahRegionIterator _regions; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
485 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
486 |
public: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
487 |
ShenandoahResetBitmapTask() : |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
488 |
AbstractGangTask("Parallel Reset Bitmap Task") {} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
489 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
490 |
void work(uint worker_id) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
491 |
ShenandoahHeapRegion* region = _regions.next(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
492 |
ShenandoahHeap* heap = ShenandoahHeap::heap(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
493 |
ShenandoahMarkingContext* const ctx = heap->marking_context(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
494 |
while (region != NULL) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
495 |
if (heap->is_bitmap_slice_committed(region)) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
496 |
ctx->clear_bitmap(region); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
497 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
498 |
region = _regions.next(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
499 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
500 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
501 |
}; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
502 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
503 |
void ShenandoahHeap::reset_mark_bitmap() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
504 |
assert_gc_workers(_workers->active_workers()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
505 |
mark_incomplete_marking_context(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
506 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
507 |
ShenandoahResetBitmapTask task; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
508 |
_workers->run_task(&task); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
509 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
510 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
511 |
void ShenandoahHeap::print_on(outputStream* st) const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
512 |
st->print_cr("Shenandoah Heap"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
513 |
st->print_cr(" " SIZE_FORMAT "K total, " SIZE_FORMAT "K committed, " SIZE_FORMAT "K used", |
54477
511be32f3863
8222185: Shenandoah should report "committed" as capacity
shade
parents:
54463
diff
changeset
|
514 |
max_capacity() / K, committed() / K, used() / K); |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
515 |
st->print_cr(" " SIZE_FORMAT " x " SIZE_FORMAT"K regions", |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
516 |
num_regions(), ShenandoahHeapRegion::region_size_bytes() / K); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
517 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
518 |
st->print("Status: "); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
519 |
if (has_forwarded_objects()) st->print("has forwarded objects, "); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
520 |
if (is_concurrent_mark_in_progress()) st->print("marking, "); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
521 |
if (is_evacuation_in_progress()) st->print("evacuating, "); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
522 |
if (is_update_refs_in_progress()) st->print("updating refs, "); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
523 |
if (is_concurrent_traversal_in_progress()) st->print("traversal, "); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
524 |
if (is_degenerated_gc_in_progress()) st->print("degenerated gc, "); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
525 |
if (is_full_gc_in_progress()) st->print("full gc, "); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
526 |
if (is_full_gc_move_in_progress()) st->print("full gc move, "); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
527 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
528 |
if (cancelled_gc()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
529 |
st->print("cancelled"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
530 |
} else { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
531 |
st->print("not cancelled"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
532 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
533 |
st->cr(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
534 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
535 |
st->print_cr("Reserved region:"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
536 |
st->print_cr(" - [" PTR_FORMAT ", " PTR_FORMAT ") ", |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
537 |
p2i(reserved_region().start()), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
538 |
p2i(reserved_region().end())); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
539 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
540 |
st->cr(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
541 |
MetaspaceUtils::print_on(st); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
542 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
543 |
if (Verbose) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
544 |
print_heap_regions_on(st); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
545 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
546 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
547 |
|
54000
3158fae17e80
8220161: Shenandoah does not need to initialize PLABs for safepoint workers
zgu
parents:
53953
diff
changeset
|
548 |
class ShenandoahInitWorkerGCLABClosure : public ThreadClosure { |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
549 |
public: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
550 |
void do_thread(Thread* thread) { |
53953
235b0e817c32
8219857: Shenandoah GC may initialize thread's gclab twice
zgu
parents:
53873
diff
changeset
|
551 |
assert(thread != NULL, "Sanity"); |
54000
3158fae17e80
8220161: Shenandoah does not need to initialize PLABs for safepoint workers
zgu
parents:
53953
diff
changeset
|
552 |
assert(thread->is_Worker_thread(), "Only worker thread expected"); |
3158fae17e80
8220161: Shenandoah does not need to initialize PLABs for safepoint workers
zgu
parents:
53953
diff
changeset
|
553 |
ShenandoahThreadLocalData::initialize_gclab(thread); |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
554 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
555 |
}; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
556 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
557 |
void ShenandoahHeap::post_initialize() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
558 |
CollectedHeap::post_initialize(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
559 |
MutexLocker ml(Threads_lock); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
560 |
|
54000
3158fae17e80
8220161: Shenandoah does not need to initialize PLABs for safepoint workers
zgu
parents:
53953
diff
changeset
|
561 |
ShenandoahInitWorkerGCLABClosure init_gclabs; |
3158fae17e80
8220161: Shenandoah does not need to initialize PLABs for safepoint workers
zgu
parents:
53953
diff
changeset
|
562 |
_workers->threads_do(&init_gclabs); |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
563 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
564 |
// gclab can not be initialized early during VM startup, as it can not determinate its max_size. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
565 |
// Now, we will let WorkGang to initialize gclab when new worker is created. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
566 |
_workers->set_initialize_gclab(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
567 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
568 |
_scm->initialize(_max_workers); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
569 |
_full_gc->initialize(_gc_timer); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
570 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
571 |
ref_processing_init(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
572 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
573 |
_heuristics->initialize(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
574 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
575 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
576 |
size_t ShenandoahHeap::used() const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
577 |
return OrderAccess::load_acquire(&_used); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
578 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
579 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
580 |
size_t ShenandoahHeap::committed() const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
581 |
OrderAccess::acquire(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
582 |
return _committed; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
583 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
584 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
585 |
void ShenandoahHeap::increase_committed(size_t bytes) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
586 |
assert_heaplock_or_safepoint(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
587 |
_committed += bytes; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
588 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
589 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
590 |
void ShenandoahHeap::decrease_committed(size_t bytes) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
591 |
assert_heaplock_or_safepoint(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
592 |
_committed -= bytes; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
593 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
594 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
595 |
void ShenandoahHeap::increase_used(size_t bytes) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
596 |
Atomic::add(bytes, &_used); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
597 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
598 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
599 |
void ShenandoahHeap::set_used(size_t bytes) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
600 |
OrderAccess::release_store_fence(&_used, bytes); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
601 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
602 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
603 |
void ShenandoahHeap::decrease_used(size_t bytes) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
604 |
assert(used() >= bytes, "never decrease heap size by more than we've left"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
605 |
Atomic::sub(bytes, &_used); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
606 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
607 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
608 |
void ShenandoahHeap::increase_allocated(size_t bytes) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
609 |
Atomic::add(bytes, &_bytes_allocated_since_gc_start); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
610 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
611 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
612 |
void ShenandoahHeap::notify_mutator_alloc_words(size_t words, bool waste) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
613 |
size_t bytes = words * HeapWordSize; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
614 |
if (!waste) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
615 |
increase_used(bytes); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
616 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
617 |
increase_allocated(bytes); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
618 |
if (ShenandoahPacing) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
619 |
control_thread()->pacing_notify_alloc(words); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
620 |
if (waste) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
621 |
pacer()->claim_for_alloc(words, true); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
622 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
623 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
624 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
625 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
626 |
size_t ShenandoahHeap::capacity() const { |
54477
511be32f3863
8222185: Shenandoah should report "committed" as capacity
shade
parents:
54463
diff
changeset
|
627 |
return committed(); |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
628 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
629 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
630 |
size_t ShenandoahHeap::max_capacity() const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
631 |
return _num_regions * ShenandoahHeapRegion::region_size_bytes(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
632 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
633 |
|
54478
cdc54443fee5
8222186: Shenandoah should not uncommit below minimum heap size
shade
parents:
54477
diff
changeset
|
634 |
size_t ShenandoahHeap::min_capacity() const { |
cdc54443fee5
8222186: Shenandoah should not uncommit below minimum heap size
shade
parents:
54477
diff
changeset
|
635 |
return _minimum_size; |
cdc54443fee5
8222186: Shenandoah should not uncommit below minimum heap size
shade
parents:
54477
diff
changeset
|
636 |
} |
cdc54443fee5
8222186: Shenandoah should not uncommit below minimum heap size
shade
parents:
54477
diff
changeset
|
637 |
|
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
638 |
size_t ShenandoahHeap::initial_capacity() const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
639 |
return _initial_size; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
640 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
641 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
642 |
bool ShenandoahHeap::is_in(const void* p) const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
643 |
HeapWord* heap_base = (HeapWord*) base(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
644 |
HeapWord* last_region_end = heap_base + ShenandoahHeapRegion::region_size_words() * num_regions(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
645 |
return p >= heap_base && p < last_region_end; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
646 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
647 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
648 |
void ShenandoahHeap::op_uncommit(double shrink_before) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
649 |
assert (ShenandoahUncommit, "should be enabled"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
650 |
|
54478
cdc54443fee5
8222186: Shenandoah should not uncommit below minimum heap size
shade
parents:
54477
diff
changeset
|
651 |
// Application allocates from the beginning of the heap, and GC allocates at |
cdc54443fee5
8222186: Shenandoah should not uncommit below minimum heap size
shade
parents:
54477
diff
changeset
|
652 |
// the end of it. It is more efficient to uncommit from the end, so that applications |
cdc54443fee5
8222186: Shenandoah should not uncommit below minimum heap size
shade
parents:
54477
diff
changeset
|
653 |
// could enjoy the near committed regions. GC allocations are much less frequent, |
cdc54443fee5
8222186: Shenandoah should not uncommit below minimum heap size
shade
parents:
54477
diff
changeset
|
654 |
// and therefore can accept the committing costs. |
cdc54443fee5
8222186: Shenandoah should not uncommit below minimum heap size
shade
parents:
54477
diff
changeset
|
655 |
|
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
656 |
size_t count = 0; |
54478
cdc54443fee5
8222186: Shenandoah should not uncommit below minimum heap size
shade
parents:
54477
diff
changeset
|
657 |
for (size_t i = num_regions(); i > 0; i--) { // care about size_t underflow |
cdc54443fee5
8222186: Shenandoah should not uncommit below minimum heap size
shade
parents:
54477
diff
changeset
|
658 |
ShenandoahHeapRegion* r = get_region(i - 1); |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
659 |
if (r->is_empty_committed() && (r->empty_time() < shrink_before)) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
660 |
ShenandoahHeapLocker locker(lock()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
661 |
if (r->is_empty_committed()) { |
54478
cdc54443fee5
8222186: Shenandoah should not uncommit below minimum heap size
shade
parents:
54477
diff
changeset
|
662 |
// Do not uncommit below minimal capacity |
cdc54443fee5
8222186: Shenandoah should not uncommit below minimum heap size
shade
parents:
54477
diff
changeset
|
663 |
if (committed() < min_capacity() + ShenandoahHeapRegion::region_size_bytes()) { |
cdc54443fee5
8222186: Shenandoah should not uncommit below minimum heap size
shade
parents:
54477
diff
changeset
|
664 |
break; |
cdc54443fee5
8222186: Shenandoah should not uncommit below minimum heap size
shade
parents:
54477
diff
changeset
|
665 |
} |
cdc54443fee5
8222186: Shenandoah should not uncommit below minimum heap size
shade
parents:
54477
diff
changeset
|
666 |
|
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
667 |
r->make_uncommitted(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
668 |
count++; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
669 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
670 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
671 |
SpinPause(); // allow allocators to take the lock |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
672 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
673 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
674 |
if (count > 0) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
675 |
control_thread()->notify_heap_changed(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
676 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
677 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
678 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
679 |
HeapWord* ShenandoahHeap::allocate_from_gclab_slow(Thread* thread, size_t size) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
680 |
// New object should fit the GCLAB size |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
681 |
size_t min_size = MAX2(size, PLAB::min_size()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
682 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
683 |
// Figure out size of new GCLAB, looking back at heuristics. Expand aggressively. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
684 |
size_t new_size = ShenandoahThreadLocalData::gclab_size(thread) * 2; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
685 |
new_size = MIN2(new_size, PLAB::max_size()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
686 |
new_size = MAX2(new_size, PLAB::min_size()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
687 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
688 |
// Record new heuristic value even if we take any shortcut. This captures |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
689 |
// the case when moderately-sized objects always take a shortcut. At some point, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
690 |
// heuristics should catch up with them. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
691 |
ShenandoahThreadLocalData::set_gclab_size(thread, new_size); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
692 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
693 |
if (new_size < size) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
694 |
// New size still does not fit the object. Fall back to shared allocation. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
695 |
// This avoids retiring perfectly good GCLABs, when we encounter a large object. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
696 |
return NULL; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
697 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
698 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
699 |
// Retire current GCLAB, and allocate a new one. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
700 |
PLAB* gclab = ShenandoahThreadLocalData::gclab(thread); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
701 |
gclab->retire(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
702 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
703 |
size_t actual_size = 0; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
704 |
HeapWord* gclab_buf = allocate_new_gclab(min_size, new_size, &actual_size); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
705 |
if (gclab_buf == NULL) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
706 |
return NULL; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
707 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
708 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
709 |
assert (size <= actual_size, "allocation should fit"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
710 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
711 |
if (ZeroTLAB) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
712 |
// ..and clear it. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
713 |
Copy::zero_to_words(gclab_buf, actual_size); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
714 |
} else { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
715 |
// ...and zap just allocated object. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
716 |
#ifdef ASSERT |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
717 |
// Skip mangling the space corresponding to the object header to |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
718 |
// ensure that the returned space is not considered parsable by |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
719 |
// any concurrent GC thread. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
720 |
size_t hdr_size = oopDesc::header_size(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
721 |
Copy::fill_to_words(gclab_buf + hdr_size, actual_size - hdr_size, badHeapWordVal); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
722 |
#endif // ASSERT |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
723 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
724 |
gclab->set_buf(gclab_buf, actual_size); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
725 |
return gclab->allocate(size); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
726 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
727 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
728 |
HeapWord* ShenandoahHeap::allocate_new_tlab(size_t min_size, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
729 |
size_t requested_size, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
730 |
size_t* actual_size) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
731 |
ShenandoahAllocRequest req = ShenandoahAllocRequest::for_tlab(min_size, requested_size); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
732 |
HeapWord* res = allocate_memory(req); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
733 |
if (res != NULL) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
734 |
*actual_size = req.actual_size(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
735 |
} else { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
736 |
*actual_size = 0; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
737 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
738 |
return res; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
739 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
740 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
741 |
HeapWord* ShenandoahHeap::allocate_new_gclab(size_t min_size, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
742 |
size_t word_size, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
743 |
size_t* actual_size) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
744 |
ShenandoahAllocRequest req = ShenandoahAllocRequest::for_gclab(min_size, word_size); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
745 |
HeapWord* res = allocate_memory(req); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
746 |
if (res != NULL) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
747 |
*actual_size = req.actual_size(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
748 |
} else { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
749 |
*actual_size = 0; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
750 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
751 |
return res; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
752 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
753 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
754 |
ShenandoahHeap* ShenandoahHeap::heap() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
755 |
CollectedHeap* heap = Universe::heap(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
756 |
assert(heap != NULL, "Unitialized access to ShenandoahHeap::heap()"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
757 |
assert(heap->kind() == CollectedHeap::Shenandoah, "not a shenandoah heap"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
758 |
return (ShenandoahHeap*) heap; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
759 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
760 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
761 |
ShenandoahHeap* ShenandoahHeap::heap_no_check() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
762 |
CollectedHeap* heap = Universe::heap(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
763 |
return (ShenandoahHeap*) heap; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
764 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
765 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
766 |
HeapWord* ShenandoahHeap::allocate_memory(ShenandoahAllocRequest& req) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
767 |
ShenandoahAllocTrace trace_alloc(req.size(), req.type()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
768 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
769 |
intptr_t pacer_epoch = 0; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
770 |
bool in_new_region = false; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
771 |
HeapWord* result = NULL; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
772 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
773 |
if (req.is_mutator_alloc()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
774 |
if (ShenandoahPacing) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
775 |
pacer()->pace_for_alloc(req.size()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
776 |
pacer_epoch = pacer()->epoch(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
777 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
778 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
779 |
if (!ShenandoahAllocFailureALot || !should_inject_alloc_failure()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
780 |
result = allocate_memory_under_lock(req, in_new_region); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
781 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
782 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
783 |
// Allocation failed, block until control thread reacted, then retry allocation. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
784 |
// |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
785 |
// It might happen that one of the threads requesting allocation would unblock |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
786 |
// way later after GC happened, only to fail the second allocation, because |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
787 |
// other threads have already depleted the free storage. In this case, a better |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
788 |
// strategy is to try again, as long as GC makes progress. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
789 |
// |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
790 |
// Then, we need to make sure the allocation was retried after at least one |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
791 |
// Full GC, which means we want to try more than ShenandoahFullGCThreshold times. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
792 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
793 |
size_t tries = 0; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
794 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
795 |
while (result == NULL && _progress_last_gc.is_set()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
796 |
tries++; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
797 |
control_thread()->handle_alloc_failure(req.size()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
798 |
result = allocate_memory_under_lock(req, in_new_region); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
799 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
800 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
801 |
while (result == NULL && tries <= ShenandoahFullGCThreshold) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
802 |
tries++; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
803 |
control_thread()->handle_alloc_failure(req.size()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
804 |
result = allocate_memory_under_lock(req, in_new_region); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
805 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
806 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
807 |
} else { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
808 |
assert(req.is_gc_alloc(), "Can only accept GC allocs here"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
809 |
result = allocate_memory_under_lock(req, in_new_region); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
810 |
// Do not call handle_alloc_failure() here, because we cannot block. |
54423 | 811 |
// The allocation failure would be handled by the LRB slowpath with handle_alloc_failure_evac(). |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
812 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
813 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
814 |
if (in_new_region) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
815 |
control_thread()->notify_heap_changed(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
816 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
817 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
818 |
if (result != NULL) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
819 |
size_t requested = req.size(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
820 |
size_t actual = req.actual_size(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
821 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
822 |
assert (req.is_lab_alloc() || (requested == actual), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
823 |
"Only LAB allocations are elastic: %s, requested = " SIZE_FORMAT ", actual = " SIZE_FORMAT, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
824 |
ShenandoahAllocRequest::alloc_type_to_string(req.type()), requested, actual); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
825 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
826 |
if (req.is_mutator_alloc()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
827 |
notify_mutator_alloc_words(actual, false); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
828 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
829 |
// If we requested more than we were granted, give the rest back to pacer. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
830 |
// This only matters if we are in the same pacing epoch: do not try to unpace |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
831 |
// over the budget for the other phase. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
832 |
if (ShenandoahPacing && (pacer_epoch > 0) && (requested > actual)) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
833 |
pacer()->unpace_for_alloc(pacer_epoch, requested - actual); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
834 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
835 |
} else { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
836 |
increase_used(actual*HeapWordSize); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
837 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
838 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
839 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
840 |
return result; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
841 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
842 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
843 |
HeapWord* ShenandoahHeap::allocate_memory_under_lock(ShenandoahAllocRequest& req, bool& in_new_region) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
844 |
ShenandoahHeapLocker locker(lock()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
845 |
return _free_set->allocate(req, in_new_region); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
846 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
847 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
848 |
class ShenandoahMemAllocator : public MemAllocator { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
849 |
private: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
850 |
MemAllocator& _initializer; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
851 |
public: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
852 |
ShenandoahMemAllocator(MemAllocator& initializer, Klass* klass, size_t word_size, Thread* thread) : |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
853 |
MemAllocator(klass, word_size + ShenandoahBrooksPointer::word_size(), thread), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
854 |
_initializer(initializer) {} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
855 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
856 |
protected: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
857 |
virtual HeapWord* mem_allocate(Allocation& allocation) const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
858 |
HeapWord* result = MemAllocator::mem_allocate(allocation); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
859 |
// Initialize brooks-pointer |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
860 |
if (result != NULL) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
861 |
result += ShenandoahBrooksPointer::word_size(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
862 |
ShenandoahBrooksPointer::initialize(oop(result)); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
863 |
assert(! ShenandoahHeap::heap()->in_collection_set(result), "never allocate in targetted region"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
864 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
865 |
return result; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
866 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
867 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
868 |
virtual oop initialize(HeapWord* mem) const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
869 |
return _initializer.initialize(mem); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
870 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
871 |
}; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
872 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
873 |
oop ShenandoahHeap::obj_allocate(Klass* klass, int size, TRAPS) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
874 |
ObjAllocator initializer(klass, size, THREAD); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
875 |
ShenandoahMemAllocator allocator(initializer, klass, size, THREAD); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
876 |
return allocator.allocate(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
877 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
878 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
879 |
oop ShenandoahHeap::array_allocate(Klass* klass, int size, int length, bool do_zero, TRAPS) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
880 |
ObjArrayAllocator initializer(klass, size, length, do_zero, THREAD); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
881 |
ShenandoahMemAllocator allocator(initializer, klass, size, THREAD); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
882 |
return allocator.allocate(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
883 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
884 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
885 |
oop ShenandoahHeap::class_allocate(Klass* klass, int size, TRAPS) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
886 |
ClassAllocator initializer(klass, size, THREAD); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
887 |
ShenandoahMemAllocator allocator(initializer, klass, size, THREAD); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
888 |
return allocator.allocate(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
889 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
890 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
891 |
HeapWord* ShenandoahHeap::mem_allocate(size_t size, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
892 |
bool* gc_overhead_limit_was_exceeded) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
893 |
ShenandoahAllocRequest req = ShenandoahAllocRequest::for_shared(size); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
894 |
return allocate_memory(req); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
895 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
896 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
897 |
MetaWord* ShenandoahHeap::satisfy_failed_metadata_allocation(ClassLoaderData* loader_data, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
898 |
size_t size, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
899 |
Metaspace::MetadataType mdtype) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
900 |
MetaWord* result; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
901 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
902 |
// Inform metaspace OOM to GC heuristics if class unloading is possible. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
903 |
if (heuristics()->can_unload_classes()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
904 |
ShenandoahHeuristics* h = heuristics(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
905 |
h->record_metaspace_oom(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
906 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
907 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
908 |
// Expand and retry allocation |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
909 |
result = loader_data->metaspace_non_null()->expand_and_allocate(size, mdtype); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
910 |
if (result != NULL) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
911 |
return result; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
912 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
913 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
914 |
// Start full GC |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
915 |
collect(GCCause::_metadata_GC_clear_soft_refs); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
916 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
917 |
// Retry allocation |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
918 |
result = loader_data->metaspace_non_null()->allocate(size, mdtype); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
919 |
if (result != NULL) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
920 |
return result; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
921 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
922 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
923 |
// Expand and retry allocation |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
924 |
result = loader_data->metaspace_non_null()->expand_and_allocate(size, mdtype); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
925 |
if (result != NULL) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
926 |
return result; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
927 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
928 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
929 |
// Out of memory |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
930 |
return NULL; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
931 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
932 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
933 |
void ShenandoahHeap::fill_with_dummy_object(HeapWord* start, HeapWord* end, bool zap) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
934 |
HeapWord* obj = tlab_post_allocation_setup(start); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
935 |
CollectedHeap::fill_with_object(obj, end); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
936 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
937 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
938 |
size_t ShenandoahHeap::min_dummy_object_size() const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
939 |
return CollectedHeap::min_dummy_object_size() + ShenandoahBrooksPointer::word_size(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
940 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
941 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
942 |
class ShenandoahConcurrentEvacuateRegionObjectClosure : public ObjectClosure { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
943 |
private: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
944 |
ShenandoahHeap* const _heap; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
945 |
Thread* const _thread; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
946 |
public: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
947 |
ShenandoahConcurrentEvacuateRegionObjectClosure(ShenandoahHeap* heap) : |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
948 |
_heap(heap), _thread(Thread::current()) {} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
949 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
950 |
void do_object(oop p) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
951 |
shenandoah_assert_marked(NULL, p); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
952 |
if (oopDesc::equals_raw(p, ShenandoahBarrierSet::resolve_forwarded_not_null(p))) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
953 |
_heap->evacuate_object(p, _thread); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
954 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
955 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
956 |
}; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
957 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
958 |
class ShenandoahEvacuationTask : public AbstractGangTask { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
959 |
private: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
960 |
ShenandoahHeap* const _sh; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
961 |
ShenandoahCollectionSet* const _cs; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
962 |
bool _concurrent; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
963 |
public: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
964 |
ShenandoahEvacuationTask(ShenandoahHeap* sh, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
965 |
ShenandoahCollectionSet* cs, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
966 |
bool concurrent) : |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
967 |
AbstractGangTask("Parallel Evacuation Task"), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
968 |
_sh(sh), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
969 |
_cs(cs), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
970 |
_concurrent(concurrent) |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
971 |
{} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
972 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
973 |
void work(uint worker_id) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
974 |
if (_concurrent) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
975 |
ShenandoahConcurrentWorkerSession worker_session(worker_id); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
976 |
ShenandoahSuspendibleThreadSetJoiner stsj(ShenandoahSuspendibleWorkers); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
977 |
ShenandoahEvacOOMScope oom_evac_scope; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
978 |
do_work(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
979 |
} else { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
980 |
ShenandoahParallelWorkerSession worker_session(worker_id); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
981 |
ShenandoahEvacOOMScope oom_evac_scope; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
982 |
do_work(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
983 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
984 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
985 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
986 |
private: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
987 |
void do_work() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
988 |
ShenandoahConcurrentEvacuateRegionObjectClosure cl(_sh); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
989 |
ShenandoahHeapRegion* r; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
990 |
while ((r =_cs->claim_next()) != NULL) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
991 |
assert(r->has_live(), "all-garbage regions are reclaimed early"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
992 |
_sh->marked_object_iterate(r, &cl); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
993 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
994 |
if (ShenandoahPacing) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
995 |
_sh->pacer()->report_evac(r->used() >> LogHeapWordSize); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
996 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
997 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
998 |
if (_sh->check_cancelled_gc_and_yield(_concurrent)) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
999 |
break; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1000 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1001 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1002 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1003 |
}; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1004 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1005 |
void ShenandoahHeap::trash_cset_regions() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1006 |
ShenandoahHeapLocker locker(lock()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1007 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1008 |
ShenandoahCollectionSet* set = collection_set(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1009 |
ShenandoahHeapRegion* r; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1010 |
set->clear_current_index(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1011 |
while ((r = set->next()) != NULL) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1012 |
r->make_trash(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1013 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1014 |
collection_set()->clear(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1015 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1016 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1017 |
void ShenandoahHeap::print_heap_regions_on(outputStream* st) const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1018 |
st->print_cr("Heap Regions:"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1019 |
st->print_cr("EU=empty-uncommitted, EC=empty-committed, R=regular, H=humongous start, HC=humongous continuation, CS=collection set, T=trash, P=pinned"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1020 |
st->print_cr("BTE=bottom/top/end, U=used, T=TLAB allocs, G=GCLAB allocs, S=shared allocs, L=live data"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1021 |
st->print_cr("R=root, CP=critical pins, TAMS=top-at-mark-start (previous, next)"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1022 |
st->print_cr("SN=alloc sequence numbers (first mutator, last mutator, first gc, last gc)"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1023 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1024 |
for (size_t i = 0; i < num_regions(); i++) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1025 |
get_region(i)->print_on(st); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1026 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1027 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1028 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1029 |
void ShenandoahHeap::trash_humongous_region_at(ShenandoahHeapRegion* start) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1030 |
assert(start->is_humongous_start(), "reclaim regions starting with the first one"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1031 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1032 |
oop humongous_obj = oop(start->bottom() + ShenandoahBrooksPointer::word_size()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1033 |
size_t size = humongous_obj->size() + ShenandoahBrooksPointer::word_size(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1034 |
size_t required_regions = ShenandoahHeapRegion::required_regions(size * HeapWordSize); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1035 |
size_t index = start->region_number() + required_regions - 1; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1036 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1037 |
assert(!start->has_live(), "liveness must be zero"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1038 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1039 |
for(size_t i = 0; i < required_regions; i++) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1040 |
// Reclaim from tail. Otherwise, assertion fails when printing region to trace log, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1041 |
// as it expects that every region belongs to a humongous region starting with a humongous start region. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1042 |
ShenandoahHeapRegion* region = get_region(index --); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1043 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1044 |
assert(region->is_humongous(), "expect correct humongous start or continuation"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1045 |
assert(!region->is_cset(), "Humongous region should not be in collection set"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1046 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1047 |
region->make_trash_immediate(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1048 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1049 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1050 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1051 |
class ShenandoahRetireGCLABClosure : public ThreadClosure { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1052 |
public: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1053 |
void do_thread(Thread* thread) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1054 |
PLAB* gclab = ShenandoahThreadLocalData::gclab(thread); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1055 |
assert(gclab != NULL, "GCLAB should be initialized for %s", thread->name()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1056 |
gclab->retire(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1057 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1058 |
}; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1059 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1060 |
void ShenandoahHeap::make_parsable(bool retire_tlabs) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1061 |
if (UseTLAB) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1062 |
CollectedHeap::ensure_parsability(retire_tlabs); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1063 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1064 |
ShenandoahRetireGCLABClosure cl; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1065 |
for (JavaThreadIteratorWithHandle jtiwh; JavaThread *t = jtiwh.next(); ) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1066 |
cl.do_thread(t); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1067 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1068 |
workers()->threads_do(&cl); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1069 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1070 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1071 |
void ShenandoahHeap::resize_tlabs() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1072 |
CollectedHeap::resize_all_tlabs(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1073 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1074 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1075 |
class ShenandoahEvacuateUpdateRootsTask : public AbstractGangTask { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1076 |
private: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1077 |
ShenandoahRootEvacuator* _rp; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1078 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1079 |
public: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1080 |
ShenandoahEvacuateUpdateRootsTask(ShenandoahRootEvacuator* rp) : |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1081 |
AbstractGangTask("Shenandoah evacuate and update roots"), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1082 |
_rp(rp) {} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1083 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1084 |
void work(uint worker_id) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1085 |
ShenandoahParallelWorkerSession worker_session(worker_id); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1086 |
ShenandoahEvacOOMScope oom_evac_scope; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1087 |
ShenandoahEvacuateUpdateRootsClosure cl; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1088 |
MarkingCodeBlobClosure blobsCl(&cl, CodeBlobToOopClosure::FixRelocations); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1089 |
_rp->process_evacuate_roots(&cl, &blobsCl, worker_id); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1090 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1091 |
}; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1092 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1093 |
void ShenandoahHeap::evacuate_and_update_roots() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1094 |
#if defined(COMPILER2) || INCLUDE_JVMCI |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1095 |
DerivedPointerTable::clear(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1096 |
#endif |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1097 |
assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Only iterate roots while world is stopped"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1098 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1099 |
{ |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1100 |
ShenandoahRootEvacuator rp(this, workers()->active_workers(), ShenandoahPhaseTimings::init_evac); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1101 |
ShenandoahEvacuateUpdateRootsTask roots_task(&rp); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1102 |
workers()->run_task(&roots_task); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1103 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1104 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1105 |
#if defined(COMPILER2) || INCLUDE_JVMCI |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1106 |
DerivedPointerTable::update_pointers(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1107 |
#endif |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1108 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1109 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1110 |
// Returns size in bytes |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1111 |
size_t ShenandoahHeap::unsafe_max_tlab_alloc(Thread *thread) const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1112 |
if (ShenandoahElasticTLAB) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1113 |
// With Elastic TLABs, return the max allowed size, and let the allocation path |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1114 |
// figure out the safe size for current allocation. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1115 |
return ShenandoahHeapRegion::max_tlab_size_bytes(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1116 |
} else { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1117 |
return MIN2(_free_set->unsafe_peek_free(), ShenandoahHeapRegion::max_tlab_size_bytes()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1118 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1119 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1120 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1121 |
size_t ShenandoahHeap::max_tlab_size() const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1122 |
// Returns size in words |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1123 |
return ShenandoahHeapRegion::max_tlab_size_words(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1124 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1125 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1126 |
class ShenandoahRetireAndResetGCLABClosure : public ThreadClosure { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1127 |
public: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1128 |
void do_thread(Thread* thread) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1129 |
PLAB* gclab = ShenandoahThreadLocalData::gclab(thread); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1130 |
gclab->retire(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1131 |
if (ShenandoahThreadLocalData::gclab_size(thread) > 0) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1132 |
ShenandoahThreadLocalData::set_gclab_size(thread, 0); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1133 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1134 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1135 |
}; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1136 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1137 |
void ShenandoahHeap::retire_and_reset_gclabs() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1138 |
ShenandoahRetireAndResetGCLABClosure cl; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1139 |
for (JavaThreadIteratorWithHandle jtiwh; JavaThread *t = jtiwh.next(); ) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1140 |
cl.do_thread(t); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1141 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1142 |
workers()->threads_do(&cl); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1143 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1144 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1145 |
void ShenandoahHeap::collect(GCCause::Cause cause) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1146 |
control_thread()->request_gc(cause); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1147 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1148 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1149 |
void ShenandoahHeap::do_full_collection(bool clear_all_soft_refs) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1150 |
//assert(false, "Shouldn't need to do full collections"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1151 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1152 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1153 |
CollectorPolicy* ShenandoahHeap::collector_policy() const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1154 |
return _shenandoah_policy; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1155 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1156 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1157 |
HeapWord* ShenandoahHeap::block_start(const void* addr) const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1158 |
Space* sp = heap_region_containing(addr); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1159 |
if (sp != NULL) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1160 |
return sp->block_start(addr); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1161 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1162 |
return NULL; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1163 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1164 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1165 |
bool ShenandoahHeap::block_is_obj(const HeapWord* addr) const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1166 |
Space* sp = heap_region_containing(addr); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1167 |
return sp->block_is_obj(addr); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1168 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1169 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1170 |
jlong ShenandoahHeap::millis_since_last_gc() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1171 |
double v = heuristics()->time_since_last_gc() * 1000; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1172 |
assert(0 <= v && v <= max_jlong, "value should fit: %f", v); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1173 |
return (jlong)v; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1174 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1175 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1176 |
void ShenandoahHeap::prepare_for_verify() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1177 |
if (SafepointSynchronize::is_at_safepoint() || ! UseTLAB) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1178 |
make_parsable(false); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1179 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1180 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1181 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1182 |
void ShenandoahHeap::print_gc_threads_on(outputStream* st) const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1183 |
workers()->print_worker_threads_on(st); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1184 |
if (ShenandoahStringDedup::is_enabled()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1185 |
ShenandoahStringDedup::print_worker_threads_on(st); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1186 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1187 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1188 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1189 |
void ShenandoahHeap::gc_threads_do(ThreadClosure* tcl) const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1190 |
workers()->threads_do(tcl); |
54457
40dc805f4709
8222125: Shenandoah: Crash when running with ShenandoahParallelSafepointThreads=1
rkennke
parents:
54425
diff
changeset
|
1191 |
if (_safepoint_workers != NULL) { |
40dc805f4709
8222125: Shenandoah: Crash when running with ShenandoahParallelSafepointThreads=1
rkennke
parents:
54425
diff
changeset
|
1192 |
_safepoint_workers->threads_do(tcl); |
40dc805f4709
8222125: Shenandoah: Crash when running with ShenandoahParallelSafepointThreads=1
rkennke
parents:
54425
diff
changeset
|
1193 |
} |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1194 |
if (ShenandoahStringDedup::is_enabled()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1195 |
ShenandoahStringDedup::threads_do(tcl); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1196 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1197 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1198 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1199 |
void ShenandoahHeap::print_tracing_info() const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1200 |
LogTarget(Info, gc, stats) lt; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1201 |
if (lt.is_enabled()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1202 |
ResourceMark rm; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1203 |
LogStream ls(lt); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1204 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1205 |
phase_timings()->print_on(&ls); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1206 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1207 |
ls.cr(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1208 |
ls.cr(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1209 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1210 |
shenandoah_policy()->print_gc_stats(&ls); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1211 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1212 |
ls.cr(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1213 |
ls.cr(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1214 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1215 |
if (ShenandoahPacing) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1216 |
pacer()->print_on(&ls); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1217 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1218 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1219 |
ls.cr(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1220 |
ls.cr(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1221 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1222 |
if (ShenandoahAllocationTrace) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1223 |
assert(alloc_tracker() != NULL, "Must be"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1224 |
alloc_tracker()->print_on(&ls); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1225 |
} else { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1226 |
ls.print_cr(" Allocation tracing is disabled, use -XX:+ShenandoahAllocationTrace to enable."); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1227 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1228 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1229 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1230 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1231 |
void ShenandoahHeap::verify(VerifyOption vo) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1232 |
if (ShenandoahSafepoint::is_at_shenandoah_safepoint()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1233 |
if (ShenandoahVerify) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1234 |
verifier()->verify_generic(vo); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1235 |
} else { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1236 |
// TODO: Consider allocating verification bitmaps on demand, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1237 |
// and turn this on unconditionally. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1238 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1239 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1240 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1241 |
size_t ShenandoahHeap::tlab_capacity(Thread *thr) const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1242 |
return _free_set->capacity(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1243 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1244 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1245 |
class ObjectIterateScanRootClosure : public BasicOopIterateClosure { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1246 |
private: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1247 |
MarkBitMap* _bitmap; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1248 |
Stack<oop,mtGC>* _oop_stack; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1249 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1250 |
template <class T> |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1251 |
void do_oop_work(T* p) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1252 |
T o = RawAccess<>::oop_load(p); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1253 |
if (!CompressedOops::is_null(o)) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1254 |
oop obj = CompressedOops::decode_not_null(o); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1255 |
obj = ShenandoahBarrierSet::resolve_forwarded_not_null(obj); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1256 |
assert(oopDesc::is_oop(obj), "must be a valid oop"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1257 |
if (!_bitmap->is_marked((HeapWord*) obj)) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1258 |
_bitmap->mark((HeapWord*) obj); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1259 |
_oop_stack->push(obj); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1260 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1261 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1262 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1263 |
public: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1264 |
ObjectIterateScanRootClosure(MarkBitMap* bitmap, Stack<oop,mtGC>* oop_stack) : |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1265 |
_bitmap(bitmap), _oop_stack(oop_stack) {} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1266 |
void do_oop(oop* p) { do_oop_work(p); } |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1267 |
void do_oop(narrowOop* p) { do_oop_work(p); } |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1268 |
}; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1269 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1270 |
/* |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1271 |
* This is public API, used in preparation of object_iterate(). |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1272 |
* Since we don't do linear scan of heap in object_iterate() (see comment below), we don't |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1273 |
* need to make the heap parsable. For Shenandoah-internal linear heap scans that we can |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1274 |
* control, we call SH::make_tlabs_parsable(). |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1275 |
*/ |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1276 |
void ShenandoahHeap::ensure_parsability(bool retire_tlabs) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1277 |
// No-op. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1278 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1279 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1280 |
/* |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1281 |
* Iterates objects in the heap. This is public API, used for, e.g., heap dumping. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1282 |
* |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1283 |
* We cannot safely iterate objects by doing a linear scan at random points in time. Linear |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1284 |
* scanning needs to deal with dead objects, which may have dead Klass* pointers (e.g. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1285 |
* calling oopDesc::size() would crash) or dangling reference fields (crashes) etc. Linear |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1286 |
* scanning therefore depends on having a valid marking bitmap to support it. However, we only |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1287 |
* have a valid marking bitmap after successful marking. In particular, we *don't* have a valid |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1288 |
* marking bitmap during marking, after aborted marking or during/after cleanup (when we just |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1289 |
* wiped the bitmap in preparation for next marking). |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1290 |
* |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1291 |
* For all those reasons, we implement object iteration as a single marking traversal, reporting |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1292 |
* objects as we mark+traverse through the heap, starting from GC roots. JVMTI IterateThroughHeap |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1293 |
* is allowed to report dead objects, but is not required to do so. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1294 |
*/ |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1295 |
void ShenandoahHeap::object_iterate(ObjectClosure* cl) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1296 |
assert(SafepointSynchronize::is_at_safepoint(), "safe iteration is only available during safepoints"); |
54047
0a9cb99a98a0
8220162: Shenandoah should not commit HugeTLBFS memory
shade
parents:
54046
diff
changeset
|
1297 |
if (!_aux_bitmap_region_special && !os::commit_memory((char*)_aux_bitmap_region.start(), _aux_bitmap_region.byte_size(), false)) { |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1298 |
log_warning(gc)("Could not commit native memory for auxiliary marking bitmap for heap iteration"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1299 |
return; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1300 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1301 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1302 |
// Reset bitmap |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1303 |
_aux_bit_map.clear(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1304 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1305 |
Stack<oop,mtGC> oop_stack; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1306 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1307 |
// First, we process all GC roots. This populates the work stack with initial objects. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1308 |
ShenandoahRootProcessor rp(this, 1, ShenandoahPhaseTimings::_num_phases); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1309 |
ObjectIterateScanRootClosure oops(&_aux_bit_map, &oop_stack); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1310 |
CLDToOopClosure clds(&oops, ClassLoaderData::_claim_none); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1311 |
CodeBlobToOopClosure blobs(&oops, false); |
54338
7a34a3270270
8221435: Shenandoah should not mark through weak roots
zgu
parents:
54093
diff
changeset
|
1312 |
rp.process_all_roots(&oops, &clds, &blobs, NULL, 0); |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1313 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1314 |
// Work through the oop stack to traverse heap. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1315 |
while (! oop_stack.is_empty()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1316 |
oop obj = oop_stack.pop(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1317 |
assert(oopDesc::is_oop(obj), "must be a valid oop"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1318 |
cl->do_object(obj); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1319 |
obj->oop_iterate(&oops); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1320 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1321 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1322 |
assert(oop_stack.is_empty(), "should be empty"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1323 |
|
54047
0a9cb99a98a0
8220162: Shenandoah should not commit HugeTLBFS memory
shade
parents:
54046
diff
changeset
|
1324 |
if (!_aux_bitmap_region_special && !os::uncommit_memory((char*)_aux_bitmap_region.start(), _aux_bitmap_region.byte_size())) { |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1325 |
log_warning(gc)("Could not uncommit native memory for auxiliary marking bitmap for heap iteration"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1326 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1327 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1328 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1329 |
void ShenandoahHeap::safe_object_iterate(ObjectClosure* cl) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1330 |
assert(SafepointSynchronize::is_at_safepoint(), "safe iteration is only available during safepoints"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1331 |
object_iterate(cl); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1332 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1333 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1334 |
void ShenandoahHeap::heap_region_iterate(ShenandoahHeapRegionClosure* blk) const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1335 |
for (size_t i = 0; i < num_regions(); i++) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1336 |
ShenandoahHeapRegion* current = get_region(i); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1337 |
blk->heap_region_do(current); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1338 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1339 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1340 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1341 |
class ShenandoahParallelHeapRegionTask : public AbstractGangTask { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1342 |
private: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1343 |
ShenandoahHeap* const _heap; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1344 |
ShenandoahHeapRegionClosure* const _blk; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1345 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1346 |
DEFINE_PAD_MINUS_SIZE(0, DEFAULT_CACHE_LINE_SIZE, sizeof(volatile size_t)); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1347 |
volatile size_t _index; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1348 |
DEFINE_PAD_MINUS_SIZE(1, DEFAULT_CACHE_LINE_SIZE, 0); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1349 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1350 |
public: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1351 |
ShenandoahParallelHeapRegionTask(ShenandoahHeapRegionClosure* blk) : |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1352 |
AbstractGangTask("Parallel Region Task"), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1353 |
_heap(ShenandoahHeap::heap()), _blk(blk), _index(0) {} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1354 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1355 |
void work(uint worker_id) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1356 |
size_t stride = ShenandoahParallelRegionStride; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1357 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1358 |
size_t max = _heap->num_regions(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1359 |
while (_index < max) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1360 |
size_t cur = Atomic::add(stride, &_index) - stride; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1361 |
size_t start = cur; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1362 |
size_t end = MIN2(cur + stride, max); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1363 |
if (start >= max) break; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1364 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1365 |
for (size_t i = cur; i < end; i++) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1366 |
ShenandoahHeapRegion* current = _heap->get_region(i); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1367 |
_blk->heap_region_do(current); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1368 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1369 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1370 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1371 |
}; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1372 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1373 |
void ShenandoahHeap::parallel_heap_region_iterate(ShenandoahHeapRegionClosure* blk) const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1374 |
assert(blk->is_thread_safe(), "Only thread-safe closures here"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1375 |
if (num_regions() > ShenandoahParallelRegionStride) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1376 |
ShenandoahParallelHeapRegionTask task(blk); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1377 |
workers()->run_task(&task); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1378 |
} else { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1379 |
heap_region_iterate(blk); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1380 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1381 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1382 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1383 |
class ShenandoahClearLivenessClosure : public ShenandoahHeapRegionClosure { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1384 |
private: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1385 |
ShenandoahMarkingContext* const _ctx; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1386 |
public: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1387 |
ShenandoahClearLivenessClosure() : _ctx(ShenandoahHeap::heap()->marking_context()) {} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1388 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1389 |
void heap_region_do(ShenandoahHeapRegion* r) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1390 |
if (r->is_active()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1391 |
r->clear_live_data(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1392 |
_ctx->capture_top_at_mark_start(r); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1393 |
} else { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1394 |
assert(!r->has_live(), "Region " SIZE_FORMAT " should have no live data", r->region_number()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1395 |
assert(_ctx->top_at_mark_start(r) == r->top(), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1396 |
"Region " SIZE_FORMAT " should already have correct TAMS", r->region_number()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1397 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1398 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1399 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1400 |
bool is_thread_safe() { return true; } |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1401 |
}; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1402 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1403 |
void ShenandoahHeap::op_init_mark() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1404 |
assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Should be at safepoint"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1405 |
assert(Thread::current()->is_VM_thread(), "can only do this in VMThread"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1406 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1407 |
assert(marking_context()->is_bitmap_clear(), "need clear marking bitmap"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1408 |
assert(!marking_context()->is_complete(), "should not be complete"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1409 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1410 |
if (ShenandoahVerify) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1411 |
verifier()->verify_before_concmark(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1412 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1413 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1414 |
if (VerifyBeforeGC) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1415 |
Universe::verify(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1416 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1417 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1418 |
set_concurrent_mark_in_progress(true); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1419 |
// We need to reset all TLABs because we'd lose marks on all objects allocated in them. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1420 |
{ |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1421 |
ShenandoahGCPhase phase(ShenandoahPhaseTimings::make_parsable); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1422 |
make_parsable(true); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1423 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1424 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1425 |
{ |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1426 |
ShenandoahGCPhase phase(ShenandoahPhaseTimings::clear_liveness); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1427 |
ShenandoahClearLivenessClosure clc; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1428 |
parallel_heap_region_iterate(&clc); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1429 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1430 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1431 |
// Make above changes visible to worker threads |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1432 |
OrderAccess::fence(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1433 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1434 |
concurrent_mark()->mark_roots(ShenandoahPhaseTimings::scan_roots); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1435 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1436 |
if (UseTLAB) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1437 |
ShenandoahGCPhase phase(ShenandoahPhaseTimings::resize_tlabs); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1438 |
resize_tlabs(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1439 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1440 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1441 |
if (ShenandoahPacing) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1442 |
pacer()->setup_for_mark(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1443 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1444 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1445 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1446 |
void ShenandoahHeap::op_mark() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1447 |
concurrent_mark()->mark_from_roots(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1448 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1449 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1450 |
class ShenandoahCompleteLivenessClosure : public ShenandoahHeapRegionClosure { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1451 |
private: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1452 |
ShenandoahMarkingContext* const _ctx; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1453 |
public: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1454 |
ShenandoahCompleteLivenessClosure() : _ctx(ShenandoahHeap::heap()->complete_marking_context()) {} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1455 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1456 |
void heap_region_do(ShenandoahHeapRegion* r) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1457 |
if (r->is_active()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1458 |
HeapWord *tams = _ctx->top_at_mark_start(r); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1459 |
HeapWord *top = r->top(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1460 |
if (top > tams) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1461 |
r->increase_live_data_alloc_words(pointer_delta(top, tams)); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1462 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1463 |
} else { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1464 |
assert(!r->has_live(), "Region " SIZE_FORMAT " should have no live data", r->region_number()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1465 |
assert(_ctx->top_at_mark_start(r) == r->top(), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1466 |
"Region " SIZE_FORMAT " should have correct TAMS", r->region_number()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1467 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1468 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1469 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1470 |
bool is_thread_safe() { return true; } |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1471 |
}; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1472 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1473 |
void ShenandoahHeap::op_final_mark() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1474 |
assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Should be at safepoint"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1475 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1476 |
// It is critical that we |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1477 |
// evacuate roots right after finishing marking, so that we don't |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1478 |
// get unmarked objects in the roots. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1479 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1480 |
if (!cancelled_gc()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1481 |
concurrent_mark()->finish_mark_from_roots(/* full_gc = */ false); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1482 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1483 |
if (has_forwarded_objects()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1484 |
concurrent_mark()->update_roots(ShenandoahPhaseTimings::update_roots); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1485 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1486 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1487 |
stop_concurrent_marking(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1488 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1489 |
{ |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1490 |
ShenandoahGCPhase phase(ShenandoahPhaseTimings::complete_liveness); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1491 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1492 |
// All allocations past TAMS are implicitly live, adjust the region data. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1493 |
// Bitmaps/TAMS are swapped at this point, so we need to poll complete bitmap. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1494 |
ShenandoahCompleteLivenessClosure cl; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1495 |
parallel_heap_region_iterate(&cl); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1496 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1497 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1498 |
{ |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1499 |
ShenandoahGCPhase prepare_evac(ShenandoahPhaseTimings::prepare_evac); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1500 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1501 |
make_parsable(true); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1502 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1503 |
trash_cset_regions(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1504 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1505 |
{ |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1506 |
ShenandoahHeapLocker locker(lock()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1507 |
_collection_set->clear(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1508 |
_free_set->clear(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1509 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1510 |
heuristics()->choose_collection_set(_collection_set); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1511 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1512 |
_free_set->rebuild(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1513 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1514 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1515 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1516 |
// If collection set has candidates, start evacuation. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1517 |
// Otherwise, bypass the rest of the cycle. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1518 |
if (!collection_set()->is_empty()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1519 |
ShenandoahGCPhase init_evac(ShenandoahPhaseTimings::init_evac); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1520 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1521 |
if (ShenandoahVerify) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1522 |
verifier()->verify_before_evacuation(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1523 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1524 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1525 |
set_evacuation_in_progress(true); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1526 |
// From here on, we need to update references. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1527 |
set_has_forwarded_objects(true); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1528 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1529 |
evacuate_and_update_roots(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1530 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1531 |
if (ShenandoahPacing) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1532 |
pacer()->setup_for_evac(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1533 |
} |
54463
b9c461c02f7c
8222130: Shenandoah should verify roots after pre-evacuation
shade
parents:
54457
diff
changeset
|
1534 |
|
b9c461c02f7c
8222130: Shenandoah should verify roots after pre-evacuation
shade
parents:
54457
diff
changeset
|
1535 |
if (ShenandoahVerify) { |
b9c461c02f7c
8222130: Shenandoah should verify roots after pre-evacuation
shade
parents:
54457
diff
changeset
|
1536 |
verifier()->verify_during_evacuation(); |
b9c461c02f7c
8222130: Shenandoah should verify roots after pre-evacuation
shade
parents:
54457
diff
changeset
|
1537 |
} |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1538 |
} else { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1539 |
if (ShenandoahVerify) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1540 |
verifier()->verify_after_concmark(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1541 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1542 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1543 |
if (VerifyAfterGC) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1544 |
Universe::verify(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1545 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1546 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1547 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1548 |
} else { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1549 |
concurrent_mark()->cancel(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1550 |
stop_concurrent_marking(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1551 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1552 |
if (process_references()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1553 |
// Abandon reference processing right away: pre-cleaning must have failed. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1554 |
ReferenceProcessor *rp = ref_processor(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1555 |
rp->disable_discovery(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1556 |
rp->abandon_partial_discovery(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1557 |
rp->verify_no_references_recorded(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1558 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1559 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1560 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1561 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1562 |
void ShenandoahHeap::op_final_evac() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1563 |
assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Should be at safepoint"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1564 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1565 |
set_evacuation_in_progress(false); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1566 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1567 |
retire_and_reset_gclabs(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1568 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1569 |
if (ShenandoahVerify) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1570 |
verifier()->verify_after_evacuation(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1571 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1572 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1573 |
if (VerifyAfterGC) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1574 |
Universe::verify(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1575 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1576 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1577 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1578 |
void ShenandoahHeap::op_conc_evac() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1579 |
ShenandoahEvacuationTask task(this, _collection_set, true); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1580 |
workers()->run_task(&task); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1581 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1582 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1583 |
void ShenandoahHeap::op_stw_evac() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1584 |
ShenandoahEvacuationTask task(this, _collection_set, false); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1585 |
workers()->run_task(&task); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1586 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1587 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1588 |
void ShenandoahHeap::op_updaterefs() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1589 |
update_heap_references(true); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1590 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1591 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1592 |
void ShenandoahHeap::op_cleanup() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1593 |
free_set()->recycle_trash(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1594 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1595 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1596 |
void ShenandoahHeap::op_reset() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1597 |
reset_mark_bitmap(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1598 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1599 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1600 |
void ShenandoahHeap::op_preclean() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1601 |
concurrent_mark()->preclean_weak_refs(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1602 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1603 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1604 |
void ShenandoahHeap::op_init_traversal() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1605 |
traversal_gc()->init_traversal_collection(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1606 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1607 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1608 |
void ShenandoahHeap::op_traversal() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1609 |
traversal_gc()->concurrent_traversal_collection(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1610 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1611 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1612 |
void ShenandoahHeap::op_final_traversal() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1613 |
traversal_gc()->final_traversal_collection(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1614 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1615 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1616 |
void ShenandoahHeap::op_full(GCCause::Cause cause) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1617 |
ShenandoahMetricsSnapshot metrics; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1618 |
metrics.snap_before(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1619 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1620 |
full_gc()->do_it(cause); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1621 |
if (UseTLAB) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1622 |
ShenandoahGCPhase phase(ShenandoahPhaseTimings::full_gc_resize_tlabs); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1623 |
resize_all_tlabs(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1624 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1625 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1626 |
metrics.snap_after(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1627 |
metrics.print(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1628 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1629 |
if (metrics.is_good_progress("Full GC")) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1630 |
_progress_last_gc.set(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1631 |
} else { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1632 |
// Nothing to do. Tell the allocation path that we have failed to make |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1633 |
// progress, and it can finally fail. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1634 |
_progress_last_gc.unset(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1635 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1636 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1637 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1638 |
void ShenandoahHeap::op_degenerated(ShenandoahDegenPoint point) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1639 |
// Degenerated GC is STW, but it can also fail. Current mechanics communicates |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1640 |
// GC failure via cancelled_concgc() flag. So, if we detect the failure after |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1641 |
// some phase, we have to upgrade the Degenerate GC to Full GC. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1642 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1643 |
clear_cancelled_gc(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1644 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1645 |
ShenandoahMetricsSnapshot metrics; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1646 |
metrics.snap_before(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1647 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1648 |
switch (point) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1649 |
case _degenerated_traversal: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1650 |
{ |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1651 |
// Drop the collection set. Note: this leaves some already forwarded objects |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1652 |
// behind, which may be problematic, see comments for ShenandoahEvacAssist |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1653 |
// workarounds in ShenandoahTraversalHeuristics. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1654 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1655 |
ShenandoahHeapLocker locker(lock()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1656 |
collection_set()->clear_current_index(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1657 |
for (size_t i = 0; i < collection_set()->count(); i++) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1658 |
ShenandoahHeapRegion* r = collection_set()->next(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1659 |
r->make_regular_bypass(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1660 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1661 |
collection_set()->clear(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1662 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1663 |
op_final_traversal(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1664 |
op_cleanup(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1665 |
return; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1666 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1667 |
// The cases below form the Duff's-like device: it describes the actual GC cycle, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1668 |
// but enters it at different points, depending on which concurrent phase had |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1669 |
// degenerated. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1670 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1671 |
case _degenerated_outside_cycle: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1672 |
// We have degenerated from outside the cycle, which means something is bad with |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1673 |
// the heap, most probably heavy humongous fragmentation, or we are very low on free |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1674 |
// space. It makes little sense to wait for Full GC to reclaim as much as it can, when |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1675 |
// we can do the most aggressive degen cycle, which includes processing references and |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1676 |
// class unloading, unless those features are explicitly disabled. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1677 |
// |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1678 |
// Note that we can only do this for "outside-cycle" degens, otherwise we would risk |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1679 |
// changing the cycle parameters mid-cycle during concurrent -> degenerated handover. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1680 |
set_process_references(heuristics()->can_process_references()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1681 |
set_unload_classes(heuristics()->can_unload_classes()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1682 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1683 |
if (heuristics()->can_do_traversal_gc()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1684 |
// Not possible to degenerate from here, upgrade to Full GC right away. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1685 |
cancel_gc(GCCause::_shenandoah_upgrade_to_full_gc); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1686 |
op_degenerated_fail(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1687 |
return; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1688 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1689 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1690 |
op_reset(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1691 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1692 |
op_init_mark(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1693 |
if (cancelled_gc()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1694 |
op_degenerated_fail(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1695 |
return; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1696 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1697 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1698 |
case _degenerated_mark: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1699 |
op_final_mark(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1700 |
if (cancelled_gc()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1701 |
op_degenerated_fail(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1702 |
return; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1703 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1704 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1705 |
op_cleanup(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1706 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1707 |
case _degenerated_evac: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1708 |
// If heuristics thinks we should do the cycle, this flag would be set, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1709 |
// and we can do evacuation. Otherwise, it would be the shortcut cycle. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1710 |
if (is_evacuation_in_progress()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1711 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1712 |
// Degeneration under oom-evac protocol might have left some objects in |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1713 |
// collection set un-evacuated. Restart evacuation from the beginning to |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1714 |
// capture all objects. For all the objects that are already evacuated, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1715 |
// it would be a simple check, which is supposed to be fast. This is also |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1716 |
// safe to do even without degeneration, as CSet iterator is at beginning |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1717 |
// in preparation for evacuation anyway. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1718 |
collection_set()->clear_current_index(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1719 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1720 |
op_stw_evac(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1721 |
if (cancelled_gc()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1722 |
op_degenerated_fail(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1723 |
return; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1724 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1725 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1726 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1727 |
// If heuristics thinks we should do the cycle, this flag would be set, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1728 |
// and we need to do update-refs. Otherwise, it would be the shortcut cycle. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1729 |
if (has_forwarded_objects()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1730 |
op_init_updaterefs(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1731 |
if (cancelled_gc()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1732 |
op_degenerated_fail(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1733 |
return; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1734 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1735 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1736 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1737 |
case _degenerated_updaterefs: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1738 |
if (has_forwarded_objects()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1739 |
op_final_updaterefs(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1740 |
if (cancelled_gc()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1741 |
op_degenerated_fail(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1742 |
return; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1743 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1744 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1745 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1746 |
op_cleanup(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1747 |
break; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1748 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1749 |
default: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1750 |
ShouldNotReachHere(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1751 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1752 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1753 |
if (ShenandoahVerify) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1754 |
verifier()->verify_after_degenerated(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1755 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1756 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1757 |
if (VerifyAfterGC) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1758 |
Universe::verify(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1759 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1760 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1761 |
metrics.snap_after(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1762 |
metrics.print(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1763 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1764 |
// Check for futility and fail. There is no reason to do several back-to-back Degenerated cycles, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1765 |
// because that probably means the heap is overloaded and/or fragmented. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1766 |
if (!metrics.is_good_progress("Degenerated GC")) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1767 |
_progress_last_gc.unset(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1768 |
cancel_gc(GCCause::_shenandoah_upgrade_to_full_gc); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1769 |
op_degenerated_futile(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1770 |
} else { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1771 |
_progress_last_gc.set(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1772 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1773 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1774 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1775 |
void ShenandoahHeap::op_degenerated_fail() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1776 |
log_info(gc)("Cannot finish degeneration, upgrading to Full GC"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1777 |
shenandoah_policy()->record_degenerated_upgrade_to_full(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1778 |
op_full(GCCause::_shenandoah_upgrade_to_full_gc); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1779 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1780 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1781 |
void ShenandoahHeap::op_degenerated_futile() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1782 |
shenandoah_policy()->record_degenerated_upgrade_to_full(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1783 |
op_full(GCCause::_shenandoah_upgrade_to_full_gc); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1784 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1785 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1786 |
void ShenandoahHeap::stop_concurrent_marking() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1787 |
assert(is_concurrent_mark_in_progress(), "How else could we get here?"); |
54425
13c02cc7a6e5
8221848: Shenandoah: ArrayCopy post-barrier improvements
rkennke
parents:
54423
diff
changeset
|
1788 |
set_concurrent_mark_in_progress(false); |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1789 |
if (!cancelled_gc()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1790 |
// If we needed to update refs, and concurrent marking has been cancelled, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1791 |
// we need to finish updating references. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1792 |
set_has_forwarded_objects(false); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1793 |
mark_complete_marking_context(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1794 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1795 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1796 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1797 |
void ShenandoahHeap::force_satb_flush_all_threads() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1798 |
if (!is_concurrent_mark_in_progress() && !is_concurrent_traversal_in_progress()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1799 |
// No need to flush SATBs |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1800 |
return; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1801 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1802 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1803 |
for (JavaThreadIteratorWithHandle jtiwh; JavaThread *t = jtiwh.next(); ) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1804 |
ShenandoahThreadLocalData::set_force_satb_flush(t, true); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1805 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1806 |
// The threads are not "acquiring" their thread-local data, but it does not |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1807 |
// hurt to "release" the updates here anyway. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1808 |
OrderAccess::fence(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1809 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1810 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1811 |
void ShenandoahHeap::set_gc_state_all_threads(char state) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1812 |
for (JavaThreadIteratorWithHandle jtiwh; JavaThread *t = jtiwh.next(); ) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1813 |
ShenandoahThreadLocalData::set_gc_state(t, state); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1814 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1815 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1816 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1817 |
void ShenandoahHeap::set_gc_state_mask(uint mask, bool value) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1818 |
assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Should really be Shenandoah safepoint"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1819 |
_gc_state.set_cond(mask, value); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1820 |
set_gc_state_all_threads(_gc_state.raw_value()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1821 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1822 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1823 |
void ShenandoahHeap::set_concurrent_mark_in_progress(bool in_progress) { |
54425
13c02cc7a6e5
8221848: Shenandoah: ArrayCopy post-barrier improvements
rkennke
parents:
54423
diff
changeset
|
1824 |
if (has_forwarded_objects()) { |
13c02cc7a6e5
8221848: Shenandoah: ArrayCopy post-barrier improvements
rkennke
parents:
54423
diff
changeset
|
1825 |
set_gc_state_mask(MARKING | UPDATEREFS, in_progress); |
13c02cc7a6e5
8221848: Shenandoah: ArrayCopy post-barrier improvements
rkennke
parents:
54423
diff
changeset
|
1826 |
} else { |
13c02cc7a6e5
8221848: Shenandoah: ArrayCopy post-barrier improvements
rkennke
parents:
54423
diff
changeset
|
1827 |
set_gc_state_mask(MARKING, in_progress); |
13c02cc7a6e5
8221848: Shenandoah: ArrayCopy post-barrier improvements
rkennke
parents:
54423
diff
changeset
|
1828 |
} |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1829 |
ShenandoahBarrierSet::satb_mark_queue_set().set_active_all_threads(in_progress, !in_progress); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1830 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1831 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1832 |
void ShenandoahHeap::set_concurrent_traversal_in_progress(bool in_progress) { |
54425
13c02cc7a6e5
8221848: Shenandoah: ArrayCopy post-barrier improvements
rkennke
parents:
54423
diff
changeset
|
1833 |
set_gc_state_mask(TRAVERSAL | HAS_FORWARDED | UPDATEREFS, in_progress); |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1834 |
ShenandoahBarrierSet::satb_mark_queue_set().set_active_all_threads(in_progress, !in_progress); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1835 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1836 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1837 |
void ShenandoahHeap::set_evacuation_in_progress(bool in_progress) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1838 |
assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Only call this at safepoint"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1839 |
set_gc_state_mask(EVACUATION, in_progress); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1840 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1841 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1842 |
HeapWord* ShenandoahHeap::tlab_post_allocation_setup(HeapWord* obj) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1843 |
// Initialize Brooks pointer for the next object |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1844 |
HeapWord* result = obj + ShenandoahBrooksPointer::word_size(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1845 |
ShenandoahBrooksPointer::initialize(oop(result)); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1846 |
return result; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1847 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1848 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1849 |
void ShenandoahHeap::ref_processing_init() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1850 |
assert(_max_workers > 0, "Sanity"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1851 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1852 |
_ref_processor = |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1853 |
new ReferenceProcessor(&_subject_to_discovery, // is_subject_to_discovery |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1854 |
ParallelRefProcEnabled, // MT processing |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1855 |
_max_workers, // Degree of MT processing |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1856 |
true, // MT discovery |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1857 |
_max_workers, // Degree of MT discovery |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1858 |
false, // Reference discovery is not atomic |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1859 |
NULL, // No closure, should be installed before use |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1860 |
true); // Scale worker threads |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1861 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1862 |
shenandoah_assert_rp_isalive_not_installed(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1863 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1864 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1865 |
GCTracer* ShenandoahHeap::tracer() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1866 |
return shenandoah_policy()->tracer(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1867 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1868 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1869 |
size_t ShenandoahHeap::tlab_used(Thread* thread) const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1870 |
return _free_set->used(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1871 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1872 |
|
53582 | 1873 |
bool ShenandoahHeap::try_cancel_gc() { |
1874 |
while (true) { |
|
1875 |
jbyte prev = _cancelled_gc.cmpxchg(CANCELLED, CANCELLABLE); |
|
1876 |
if (prev == CANCELLABLE) return true; |
|
1877 |
else if (prev == CANCELLED) return false; |
|
1878 |
assert(ShenandoahSuspendibleWorkers, "should not get here when not using suspendible workers"); |
|
1879 |
assert(prev == NOT_CANCELLED, "must be NOT_CANCELLED"); |
|
1880 |
{ |
|
1881 |
// We need to provide a safepoint here, otherwise we might |
|
1882 |
// spin forever if a SP is pending. |
|
1883 |
ThreadBlockInVM sp(JavaThread::current()); |
|
1884 |
SpinPause(); |
|
1885 |
} |
|
1886 |
} |
|
1887 |
} |
|
1888 |
||
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1889 |
void ShenandoahHeap::cancel_gc(GCCause::Cause cause) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1890 |
if (try_cancel_gc()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1891 |
FormatBuffer<> msg("Cancelling GC: %s", GCCause::to_string(cause)); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1892 |
log_info(gc)("%s", msg.buffer()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1893 |
Events::log(Thread::current(), "%s", msg.buffer()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1894 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1895 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1896 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1897 |
uint ShenandoahHeap::max_workers() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1898 |
return _max_workers; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1899 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1900 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1901 |
void ShenandoahHeap::stop() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1902 |
// The shutdown sequence should be able to terminate when GC is running. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1903 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1904 |
// Step 0. Notify policy to disable event recording. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1905 |
_shenandoah_policy->record_shutdown(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1906 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1907 |
// Step 1. Notify control thread that we are in shutdown. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1908 |
// Note that we cannot do that with stop(), because stop() is blocking and waits for the actual shutdown. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1909 |
// Doing stop() here would wait for the normal GC cycle to complete, never falling through to cancel below. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1910 |
control_thread()->prepare_for_graceful_shutdown(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1911 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1912 |
// Step 2. Notify GC workers that we are cancelling GC. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1913 |
cancel_gc(GCCause::_shenandoah_stop_vm); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1914 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1915 |
// Step 3. Wait until GC worker exits normally. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1916 |
control_thread()->stop(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1917 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1918 |
// Step 4. Stop String Dedup thread if it is active |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1919 |
if (ShenandoahStringDedup::is_enabled()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1920 |
ShenandoahStringDedup::stop(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1921 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1922 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1923 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1924 |
void ShenandoahHeap::unload_classes_and_cleanup_tables(bool full_gc) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1925 |
assert(heuristics()->can_unload_classes(), "Class unloading should be enabled"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1926 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1927 |
ShenandoahGCPhase root_phase(full_gc ? |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1928 |
ShenandoahPhaseTimings::full_gc_purge : |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1929 |
ShenandoahPhaseTimings::purge); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1930 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1931 |
ShenandoahIsAliveSelector alive; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1932 |
BoolObjectClosure* is_alive = alive.is_alive_closure(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1933 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1934 |
bool purged_class; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1935 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1936 |
// Unload classes and purge SystemDictionary. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1937 |
{ |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1938 |
ShenandoahGCPhase phase(full_gc ? |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1939 |
ShenandoahPhaseTimings::full_gc_purge_class_unload : |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1940 |
ShenandoahPhaseTimings::purge_class_unload); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1941 |
purged_class = SystemDictionary::do_unloading(gc_timer()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1942 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1943 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1944 |
{ |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1945 |
ShenandoahGCPhase phase(full_gc ? |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1946 |
ShenandoahPhaseTimings::full_gc_purge_par : |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1947 |
ShenandoahPhaseTimings::purge_par); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1948 |
uint active = _workers->active_workers(); |
53536
482109fae02b
8213229: Investigate treating StringTable as weak in young collections
tschatzl
parents:
53383
diff
changeset
|
1949 |
ParallelCleaningTask unlink_task(is_alive, active, purged_class, true); |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1950 |
_workers->run_task(&unlink_task); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1951 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1952 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1953 |
{ |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1954 |
ShenandoahGCPhase phase(full_gc ? |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1955 |
ShenandoahPhaseTimings::full_gc_purge_cldg : |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1956 |
ShenandoahPhaseTimings::purge_cldg); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1957 |
ClassLoaderDataGraph::purge(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1958 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1959 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1960 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1961 |
void ShenandoahHeap::set_has_forwarded_objects(bool cond) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1962 |
set_gc_state_mask(HAS_FORWARDED, cond); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1963 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1964 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1965 |
void ShenandoahHeap::set_process_references(bool pr) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1966 |
_process_references.set_cond(pr); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1967 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1968 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1969 |
void ShenandoahHeap::set_unload_classes(bool uc) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1970 |
_unload_classes.set_cond(uc); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1971 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1972 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1973 |
bool ShenandoahHeap::process_references() const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1974 |
return _process_references.is_set(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1975 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1976 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1977 |
bool ShenandoahHeap::unload_classes() const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1978 |
return _unload_classes.is_set(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1979 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1980 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1981 |
address ShenandoahHeap::in_cset_fast_test_addr() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1982 |
ShenandoahHeap* heap = ShenandoahHeap::heap(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1983 |
assert(heap->collection_set() != NULL, "Sanity"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1984 |
return (address) heap->collection_set()->biased_map_address(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1985 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1986 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1987 |
address ShenandoahHeap::cancelled_gc_addr() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1988 |
return (address) ShenandoahHeap::heap()->_cancelled_gc.addr_of(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1989 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1990 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1991 |
address ShenandoahHeap::gc_state_addr() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1992 |
return (address) ShenandoahHeap::heap()->_gc_state.addr_of(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1993 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1994 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1995 |
size_t ShenandoahHeap::bytes_allocated_since_gc_start() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1996 |
return OrderAccess::load_acquire(&_bytes_allocated_since_gc_start); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1997 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1998 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
1999 |
void ShenandoahHeap::reset_bytes_allocated_since_gc_start() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2000 |
OrderAccess::release_store_fence(&_bytes_allocated_since_gc_start, (size_t)0); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2001 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2002 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2003 |
void ShenandoahHeap::set_degenerated_gc_in_progress(bool in_progress) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2004 |
_degenerated_gc_in_progress.set_cond(in_progress); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2005 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2006 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2007 |
void ShenandoahHeap::set_full_gc_in_progress(bool in_progress) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2008 |
_full_gc_in_progress.set_cond(in_progress); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2009 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2010 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2011 |
void ShenandoahHeap::set_full_gc_move_in_progress(bool in_progress) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2012 |
assert (is_full_gc_in_progress(), "should be"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2013 |
_full_gc_move_in_progress.set_cond(in_progress); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2014 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2015 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2016 |
void ShenandoahHeap::set_update_refs_in_progress(bool in_progress) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2017 |
set_gc_state_mask(UPDATEREFS, in_progress); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2018 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2019 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2020 |
void ShenandoahHeap::register_nmethod(nmethod* nm) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2021 |
ShenandoahCodeRoots::add_nmethod(nm); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2022 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2023 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2024 |
void ShenandoahHeap::unregister_nmethod(nmethod* nm) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2025 |
ShenandoahCodeRoots::remove_nmethod(nm); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2026 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2027 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2028 |
oop ShenandoahHeap::pin_object(JavaThread* thr, oop o) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2029 |
ShenandoahHeapLocker locker(lock()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2030 |
heap_region_containing(o)->make_pinned(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2031 |
return o; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2032 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2033 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2034 |
void ShenandoahHeap::unpin_object(JavaThread* thr, oop o) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2035 |
ShenandoahHeapLocker locker(lock()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2036 |
heap_region_containing(o)->make_unpinned(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2037 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2038 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2039 |
GCTimer* ShenandoahHeap::gc_timer() const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2040 |
return _gc_timer; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2041 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2042 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2043 |
#ifdef ASSERT |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2044 |
void ShenandoahHeap::assert_gc_workers(uint nworkers) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2045 |
assert(nworkers > 0 && nworkers <= max_workers(), "Sanity"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2046 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2047 |
if (ShenandoahSafepoint::is_at_shenandoah_safepoint()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2048 |
if (UseDynamicNumberOfGCThreads || |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2049 |
(FLAG_IS_DEFAULT(ParallelGCThreads) && ForceDynamicNumberOfGCThreads)) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2050 |
assert(nworkers <= ParallelGCThreads, "Cannot use more than it has"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2051 |
} else { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2052 |
// Use ParallelGCThreads inside safepoints |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2053 |
assert(nworkers == ParallelGCThreads, "Use ParalleGCThreads within safepoints"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2054 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2055 |
} else { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2056 |
if (UseDynamicNumberOfGCThreads || |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2057 |
(FLAG_IS_DEFAULT(ConcGCThreads) && ForceDynamicNumberOfGCThreads)) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2058 |
assert(nworkers <= ConcGCThreads, "Cannot use more than it has"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2059 |
} else { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2060 |
// Use ConcGCThreads outside safepoints |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2061 |
assert(nworkers == ConcGCThreads, "Use ConcGCThreads outside safepoints"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2062 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2063 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2064 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2065 |
#endif |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2066 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2067 |
ShenandoahVerifier* ShenandoahHeap::verifier() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2068 |
guarantee(ShenandoahVerify, "Should be enabled"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2069 |
assert (_verifier != NULL, "sanity"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2070 |
return _verifier; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2071 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2072 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2073 |
template<class T> |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2074 |
class ShenandoahUpdateHeapRefsTask : public AbstractGangTask { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2075 |
private: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2076 |
T cl; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2077 |
ShenandoahHeap* _heap; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2078 |
ShenandoahRegionIterator* _regions; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2079 |
bool _concurrent; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2080 |
public: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2081 |
ShenandoahUpdateHeapRefsTask(ShenandoahRegionIterator* regions, bool concurrent) : |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2082 |
AbstractGangTask("Concurrent Update References Task"), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2083 |
cl(T()), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2084 |
_heap(ShenandoahHeap::heap()), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2085 |
_regions(regions), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2086 |
_concurrent(concurrent) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2087 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2088 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2089 |
void work(uint worker_id) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2090 |
if (_concurrent) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2091 |
ShenandoahConcurrentWorkerSession worker_session(worker_id); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2092 |
ShenandoahSuspendibleThreadSetJoiner stsj(ShenandoahSuspendibleWorkers); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2093 |
do_work(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2094 |
} else { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2095 |
ShenandoahParallelWorkerSession worker_session(worker_id); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2096 |
do_work(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2097 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2098 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2099 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2100 |
private: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2101 |
void do_work() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2102 |
ShenandoahHeapRegion* r = _regions->next(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2103 |
ShenandoahMarkingContext* const ctx = _heap->complete_marking_context(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2104 |
while (r != NULL) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2105 |
HeapWord* top_at_start_ur = r->concurrent_iteration_safe_limit(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2106 |
assert (top_at_start_ur >= r->bottom(), "sanity"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2107 |
if (r->is_active() && !r->is_cset()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2108 |
_heap->marked_object_oop_iterate(r, &cl, top_at_start_ur); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2109 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2110 |
if (ShenandoahPacing) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2111 |
_heap->pacer()->report_updaterefs(pointer_delta(top_at_start_ur, r->bottom())); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2112 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2113 |
if (_heap->check_cancelled_gc_and_yield(_concurrent)) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2114 |
return; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2115 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2116 |
r = _regions->next(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2117 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2118 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2119 |
}; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2120 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2121 |
void ShenandoahHeap::update_heap_references(bool concurrent) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2122 |
ShenandoahUpdateHeapRefsTask<ShenandoahUpdateHeapRefsClosure> task(&_update_refs_iterator, concurrent); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2123 |
workers()->run_task(&task); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2124 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2125 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2126 |
void ShenandoahHeap::op_init_updaterefs() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2127 |
assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "must be at safepoint"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2128 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2129 |
set_evacuation_in_progress(false); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2130 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2131 |
retire_and_reset_gclabs(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2132 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2133 |
if (ShenandoahVerify) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2134 |
verifier()->verify_before_updaterefs(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2135 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2136 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2137 |
set_update_refs_in_progress(true); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2138 |
make_parsable(true); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2139 |
for (uint i = 0; i < num_regions(); i++) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2140 |
ShenandoahHeapRegion* r = get_region(i); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2141 |
r->set_concurrent_iteration_safe_limit(r->top()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2142 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2143 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2144 |
// Reset iterator. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2145 |
_update_refs_iterator.reset(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2146 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2147 |
if (ShenandoahPacing) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2148 |
pacer()->setup_for_updaterefs(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2149 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2150 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2151 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2152 |
void ShenandoahHeap::op_final_updaterefs() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2153 |
assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "must be at safepoint"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2154 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2155 |
// Check if there is left-over work, and finish it |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2156 |
if (_update_refs_iterator.has_next()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2157 |
ShenandoahGCPhase final_work(ShenandoahPhaseTimings::final_update_refs_finish_work); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2158 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2159 |
// Finish updating references where we left off. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2160 |
clear_cancelled_gc(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2161 |
update_heap_references(false); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2162 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2163 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2164 |
// Clear cancelled GC, if set. On cancellation path, the block before would handle |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2165 |
// everything. On degenerated paths, cancelled gc would not be set anyway. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2166 |
if (cancelled_gc()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2167 |
clear_cancelled_gc(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2168 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2169 |
assert(!cancelled_gc(), "Should have been done right before"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2170 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2171 |
concurrent_mark()->update_roots(is_degenerated_gc_in_progress() ? |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2172 |
ShenandoahPhaseTimings::degen_gc_update_roots: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2173 |
ShenandoahPhaseTimings::final_update_refs_roots); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2174 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2175 |
ShenandoahGCPhase final_update_refs(ShenandoahPhaseTimings::final_update_refs_recycle); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2176 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2177 |
trash_cset_regions(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2178 |
set_has_forwarded_objects(false); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2179 |
set_update_refs_in_progress(false); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2180 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2181 |
if (ShenandoahVerify) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2182 |
verifier()->verify_after_updaterefs(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2183 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2184 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2185 |
if (VerifyAfterGC) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2186 |
Universe::verify(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2187 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2188 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2189 |
{ |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2190 |
ShenandoahHeapLocker locker(lock()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2191 |
_free_set->rebuild(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2192 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2193 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2194 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2195 |
#ifdef ASSERT |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2196 |
void ShenandoahHeap::assert_heaplock_owned_by_current_thread() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2197 |
_lock.assert_owned_by_current_thread(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2198 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2199 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2200 |
void ShenandoahHeap::assert_heaplock_not_owned_by_current_thread() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2201 |
_lock.assert_not_owned_by_current_thread(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2202 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2203 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2204 |
void ShenandoahHeap::assert_heaplock_or_safepoint() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2205 |
_lock.assert_owned_by_current_thread_or_safepoint(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2206 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2207 |
#endif |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2208 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2209 |
void ShenandoahHeap::print_extended_on(outputStream *st) const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2210 |
print_on(st); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2211 |
print_heap_regions_on(st); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2212 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2213 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2214 |
bool ShenandoahHeap::is_bitmap_slice_committed(ShenandoahHeapRegion* r, bool skip_self) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2215 |
size_t slice = r->region_number() / _bitmap_regions_per_slice; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2216 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2217 |
size_t regions_from = _bitmap_regions_per_slice * slice; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2218 |
size_t regions_to = MIN2(num_regions(), _bitmap_regions_per_slice * (slice + 1)); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2219 |
for (size_t g = regions_from; g < regions_to; g++) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2220 |
assert (g / _bitmap_regions_per_slice == slice, "same slice"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2221 |
if (skip_self && g == r->region_number()) continue; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2222 |
if (get_region(g)->is_committed()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2223 |
return true; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2224 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2225 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2226 |
return false; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2227 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2228 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2229 |
bool ShenandoahHeap::commit_bitmap_slice(ShenandoahHeapRegion* r) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2230 |
assert_heaplock_owned_by_current_thread(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2231 |
|
54047
0a9cb99a98a0
8220162: Shenandoah should not commit HugeTLBFS memory
shade
parents:
54046
diff
changeset
|
2232 |
// Bitmaps in special regions do not need commits |
0a9cb99a98a0
8220162: Shenandoah should not commit HugeTLBFS memory
shade
parents:
54046
diff
changeset
|
2233 |
if (_bitmap_region_special) { |
0a9cb99a98a0
8220162: Shenandoah should not commit HugeTLBFS memory
shade
parents:
54046
diff
changeset
|
2234 |
return true; |
0a9cb99a98a0
8220162: Shenandoah should not commit HugeTLBFS memory
shade
parents:
54046
diff
changeset
|
2235 |
} |
0a9cb99a98a0
8220162: Shenandoah should not commit HugeTLBFS memory
shade
parents:
54046
diff
changeset
|
2236 |
|
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2237 |
if (is_bitmap_slice_committed(r, true)) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2238 |
// Some other region from the group is already committed, meaning the bitmap |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2239 |
// slice is already committed, we exit right away. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2240 |
return true; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2241 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2242 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2243 |
// Commit the bitmap slice: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2244 |
size_t slice = r->region_number() / _bitmap_regions_per_slice; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2245 |
size_t off = _bitmap_bytes_per_slice * slice; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2246 |
size_t len = _bitmap_bytes_per_slice; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2247 |
if (!os::commit_memory((char*)_bitmap_region.start() + off, len, false)) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2248 |
return false; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2249 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2250 |
return true; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2251 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2252 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2253 |
bool ShenandoahHeap::uncommit_bitmap_slice(ShenandoahHeapRegion *r) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2254 |
assert_heaplock_owned_by_current_thread(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2255 |
|
54047
0a9cb99a98a0
8220162: Shenandoah should not commit HugeTLBFS memory
shade
parents:
54046
diff
changeset
|
2256 |
// Bitmaps in special regions do not need uncommits |
0a9cb99a98a0
8220162: Shenandoah should not commit HugeTLBFS memory
shade
parents:
54046
diff
changeset
|
2257 |
if (_bitmap_region_special) { |
0a9cb99a98a0
8220162: Shenandoah should not commit HugeTLBFS memory
shade
parents:
54046
diff
changeset
|
2258 |
return true; |
0a9cb99a98a0
8220162: Shenandoah should not commit HugeTLBFS memory
shade
parents:
54046
diff
changeset
|
2259 |
} |
0a9cb99a98a0
8220162: Shenandoah should not commit HugeTLBFS memory
shade
parents:
54046
diff
changeset
|
2260 |
|
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2261 |
if (is_bitmap_slice_committed(r, true)) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2262 |
// Some other region from the group is still committed, meaning the bitmap |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2263 |
// slice is should stay committed, exit right away. |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2264 |
return true; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2265 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2266 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2267 |
// Uncommit the bitmap slice: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2268 |
size_t slice = r->region_number() / _bitmap_regions_per_slice; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2269 |
size_t off = _bitmap_bytes_per_slice * slice; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2270 |
size_t len = _bitmap_bytes_per_slice; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2271 |
if (!os::uncommit_memory((char*)_bitmap_region.start() + off, len)) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2272 |
return false; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2273 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2274 |
return true; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2275 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2276 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2277 |
void ShenandoahHeap::safepoint_synchronize_begin() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2278 |
if (ShenandoahSuspendibleWorkers || UseStringDeduplication) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2279 |
SuspendibleThreadSet::synchronize(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2280 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2281 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2282 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2283 |
void ShenandoahHeap::safepoint_synchronize_end() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2284 |
if (ShenandoahSuspendibleWorkers || UseStringDeduplication) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2285 |
SuspendibleThreadSet::desynchronize(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2286 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2287 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2288 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2289 |
void ShenandoahHeap::vmop_entry_init_mark() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2290 |
TraceCollectorStats tcs(monitoring_support()->stw_collection_counters()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2291 |
ShenandoahGCPhase total(ShenandoahPhaseTimings::total_pause_gross); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2292 |
ShenandoahGCPhase phase(ShenandoahPhaseTimings::init_mark_gross); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2293 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2294 |
try_inject_alloc_failure(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2295 |
VM_ShenandoahInitMark op; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2296 |
VMThread::execute(&op); // jump to entry_init_mark() under safepoint |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2297 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2298 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2299 |
void ShenandoahHeap::vmop_entry_final_mark() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2300 |
TraceCollectorStats tcs(monitoring_support()->stw_collection_counters()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2301 |
ShenandoahGCPhase total(ShenandoahPhaseTimings::total_pause_gross); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2302 |
ShenandoahGCPhase phase(ShenandoahPhaseTimings::final_mark_gross); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2303 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2304 |
try_inject_alloc_failure(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2305 |
VM_ShenandoahFinalMarkStartEvac op; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2306 |
VMThread::execute(&op); // jump to entry_final_mark under safepoint |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2307 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2308 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2309 |
void ShenandoahHeap::vmop_entry_final_evac() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2310 |
TraceCollectorStats tcs(monitoring_support()->stw_collection_counters()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2311 |
ShenandoahGCPhase total(ShenandoahPhaseTimings::total_pause_gross); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2312 |
ShenandoahGCPhase phase(ShenandoahPhaseTimings::final_evac_gross); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2313 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2314 |
VM_ShenandoahFinalEvac op; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2315 |
VMThread::execute(&op); // jump to entry_final_evac under safepoint |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2316 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2317 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2318 |
void ShenandoahHeap::vmop_entry_init_updaterefs() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2319 |
TraceCollectorStats tcs(monitoring_support()->stw_collection_counters()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2320 |
ShenandoahGCPhase total(ShenandoahPhaseTimings::total_pause_gross); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2321 |
ShenandoahGCPhase phase(ShenandoahPhaseTimings::init_update_refs_gross); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2322 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2323 |
try_inject_alloc_failure(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2324 |
VM_ShenandoahInitUpdateRefs op; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2325 |
VMThread::execute(&op); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2326 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2327 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2328 |
void ShenandoahHeap::vmop_entry_final_updaterefs() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2329 |
TraceCollectorStats tcs(monitoring_support()->stw_collection_counters()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2330 |
ShenandoahGCPhase total(ShenandoahPhaseTimings::total_pause_gross); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2331 |
ShenandoahGCPhase phase(ShenandoahPhaseTimings::final_update_refs_gross); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2332 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2333 |
try_inject_alloc_failure(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2334 |
VM_ShenandoahFinalUpdateRefs op; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2335 |
VMThread::execute(&op); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2336 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2337 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2338 |
void ShenandoahHeap::vmop_entry_init_traversal() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2339 |
TraceCollectorStats tcs(monitoring_support()->stw_collection_counters()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2340 |
ShenandoahGCPhase total(ShenandoahPhaseTimings::total_pause_gross); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2341 |
ShenandoahGCPhase phase(ShenandoahPhaseTimings::init_traversal_gc_gross); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2342 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2343 |
try_inject_alloc_failure(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2344 |
VM_ShenandoahInitTraversalGC op; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2345 |
VMThread::execute(&op); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2346 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2347 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2348 |
void ShenandoahHeap::vmop_entry_final_traversal() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2349 |
TraceCollectorStats tcs(monitoring_support()->stw_collection_counters()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2350 |
ShenandoahGCPhase total(ShenandoahPhaseTimings::total_pause_gross); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2351 |
ShenandoahGCPhase phase(ShenandoahPhaseTimings::final_traversal_gc_gross); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2352 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2353 |
try_inject_alloc_failure(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2354 |
VM_ShenandoahFinalTraversalGC op; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2355 |
VMThread::execute(&op); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2356 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2357 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2358 |
void ShenandoahHeap::vmop_entry_full(GCCause::Cause cause) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2359 |
TraceCollectorStats tcs(monitoring_support()->full_stw_collection_counters()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2360 |
ShenandoahGCPhase total(ShenandoahPhaseTimings::total_pause_gross); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2361 |
ShenandoahGCPhase phase(ShenandoahPhaseTimings::full_gc_gross); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2362 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2363 |
try_inject_alloc_failure(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2364 |
VM_ShenandoahFullGC op(cause); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2365 |
VMThread::execute(&op); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2366 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2367 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2368 |
void ShenandoahHeap::vmop_degenerated(ShenandoahDegenPoint point) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2369 |
TraceCollectorStats tcs(monitoring_support()->full_stw_collection_counters()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2370 |
ShenandoahGCPhase total(ShenandoahPhaseTimings::total_pause_gross); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2371 |
ShenandoahGCPhase phase(ShenandoahPhaseTimings::degen_gc_gross); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2372 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2373 |
VM_ShenandoahDegeneratedGC degenerated_gc((int)point); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2374 |
VMThread::execute(°enerated_gc); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2375 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2376 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2377 |
void ShenandoahHeap::entry_init_mark() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2378 |
ShenandoahGCPhase total_phase(ShenandoahPhaseTimings::total_pause); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2379 |
ShenandoahGCPhase phase(ShenandoahPhaseTimings::init_mark); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2380 |
const char* msg = init_mark_event_message(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2381 |
GCTraceTime(Info, gc) time(msg, gc_timer()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2382 |
EventMark em("%s", msg); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2383 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2384 |
ShenandoahWorkerScope scope(workers(), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2385 |
ShenandoahWorkerPolicy::calc_workers_for_init_marking(), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2386 |
"init marking"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2387 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2388 |
op_init_mark(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2389 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2390 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2391 |
void ShenandoahHeap::entry_final_mark() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2392 |
ShenandoahGCPhase total_phase(ShenandoahPhaseTimings::total_pause); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2393 |
ShenandoahGCPhase phase(ShenandoahPhaseTimings::final_mark); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2394 |
const char* msg = final_mark_event_message(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2395 |
GCTraceTime(Info, gc) time(msg, gc_timer()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2396 |
EventMark em("%s", msg); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2397 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2398 |
ShenandoahWorkerScope scope(workers(), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2399 |
ShenandoahWorkerPolicy::calc_workers_for_final_marking(), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2400 |
"final marking"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2401 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2402 |
op_final_mark(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2403 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2404 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2405 |
void ShenandoahHeap::entry_final_evac() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2406 |
ShenandoahGCPhase total_phase(ShenandoahPhaseTimings::total_pause); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2407 |
ShenandoahGCPhase phase(ShenandoahPhaseTimings::final_evac); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2408 |
static const char* msg = "Pause Final Evac"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2409 |
GCTraceTime(Info, gc) time(msg, gc_timer()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2410 |
EventMark em("%s", msg); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2411 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2412 |
op_final_evac(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2413 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2414 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2415 |
void ShenandoahHeap::entry_init_updaterefs() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2416 |
ShenandoahGCPhase total_phase(ShenandoahPhaseTimings::total_pause); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2417 |
ShenandoahGCPhase phase(ShenandoahPhaseTimings::init_update_refs); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2418 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2419 |
static const char* msg = "Pause Init Update Refs"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2420 |
GCTraceTime(Info, gc) time(msg, gc_timer()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2421 |
EventMark em("%s", msg); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2422 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2423 |
// No workers used in this phase, no setup required |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2424 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2425 |
op_init_updaterefs(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2426 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2427 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2428 |
void ShenandoahHeap::entry_final_updaterefs() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2429 |
ShenandoahGCPhase total_phase(ShenandoahPhaseTimings::total_pause); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2430 |
ShenandoahGCPhase phase(ShenandoahPhaseTimings::final_update_refs); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2431 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2432 |
static const char* msg = "Pause Final Update Refs"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2433 |
GCTraceTime(Info, gc) time(msg, gc_timer()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2434 |
EventMark em("%s", msg); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2435 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2436 |
ShenandoahWorkerScope scope(workers(), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2437 |
ShenandoahWorkerPolicy::calc_workers_for_final_update_ref(), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2438 |
"final reference update"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2439 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2440 |
op_final_updaterefs(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2441 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2442 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2443 |
void ShenandoahHeap::entry_init_traversal() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2444 |
ShenandoahGCPhase total_phase(ShenandoahPhaseTimings::total_pause); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2445 |
ShenandoahGCPhase phase(ShenandoahPhaseTimings::init_traversal_gc); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2446 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2447 |
static const char* msg = "Pause Init Traversal"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2448 |
GCTraceTime(Info, gc) time(msg, gc_timer()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2449 |
EventMark em("%s", msg); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2450 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2451 |
ShenandoahWorkerScope scope(workers(), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2452 |
ShenandoahWorkerPolicy::calc_workers_for_stw_traversal(), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2453 |
"init traversal"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2454 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2455 |
op_init_traversal(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2456 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2457 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2458 |
void ShenandoahHeap::entry_final_traversal() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2459 |
ShenandoahGCPhase total_phase(ShenandoahPhaseTimings::total_pause); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2460 |
ShenandoahGCPhase phase(ShenandoahPhaseTimings::final_traversal_gc); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2461 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2462 |
static const char* msg = "Pause Final Traversal"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2463 |
GCTraceTime(Info, gc) time(msg, gc_timer()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2464 |
EventMark em("%s", msg); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2465 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2466 |
ShenandoahWorkerScope scope(workers(), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2467 |
ShenandoahWorkerPolicy::calc_workers_for_stw_traversal(), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2468 |
"final traversal"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2469 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2470 |
op_final_traversal(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2471 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2472 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2473 |
void ShenandoahHeap::entry_full(GCCause::Cause cause) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2474 |
ShenandoahGCPhase total_phase(ShenandoahPhaseTimings::total_pause); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2475 |
ShenandoahGCPhase phase(ShenandoahPhaseTimings::full_gc); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2476 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2477 |
static const char* msg = "Pause Full"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2478 |
GCTraceTime(Info, gc) time(msg, gc_timer(), cause, true); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2479 |
EventMark em("%s", msg); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2480 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2481 |
ShenandoahWorkerScope scope(workers(), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2482 |
ShenandoahWorkerPolicy::calc_workers_for_fullgc(), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2483 |
"full gc"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2484 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2485 |
op_full(cause); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2486 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2487 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2488 |
void ShenandoahHeap::entry_degenerated(int point) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2489 |
ShenandoahGCPhase total_phase(ShenandoahPhaseTimings::total_pause); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2490 |
ShenandoahGCPhase phase(ShenandoahPhaseTimings::degen_gc); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2491 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2492 |
ShenandoahDegenPoint dpoint = (ShenandoahDegenPoint)point; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2493 |
const char* msg = degen_event_message(dpoint); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2494 |
GCTraceTime(Info, gc) time(msg, NULL, GCCause::_no_gc, true); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2495 |
EventMark em("%s", msg); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2496 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2497 |
ShenandoahWorkerScope scope(workers(), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2498 |
ShenandoahWorkerPolicy::calc_workers_for_stw_degenerated(), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2499 |
"stw degenerated gc"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2500 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2501 |
set_degenerated_gc_in_progress(true); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2502 |
op_degenerated(dpoint); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2503 |
set_degenerated_gc_in_progress(false); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2504 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2505 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2506 |
void ShenandoahHeap::entry_mark() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2507 |
TraceCollectorStats tcs(monitoring_support()->concurrent_collection_counters()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2508 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2509 |
const char* msg = conc_mark_event_message(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2510 |
GCTraceTime(Info, gc) time(msg, NULL, GCCause::_no_gc, true); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2511 |
EventMark em("%s", msg); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2512 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2513 |
ShenandoahWorkerScope scope(workers(), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2514 |
ShenandoahWorkerPolicy::calc_workers_for_conc_marking(), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2515 |
"concurrent marking"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2516 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2517 |
try_inject_alloc_failure(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2518 |
op_mark(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2519 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2520 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2521 |
void ShenandoahHeap::entry_evac() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2522 |
ShenandoahGCPhase conc_evac_phase(ShenandoahPhaseTimings::conc_evac); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2523 |
TraceCollectorStats tcs(monitoring_support()->concurrent_collection_counters()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2524 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2525 |
static const char* msg = "Concurrent evacuation"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2526 |
GCTraceTime(Info, gc) time(msg, NULL, GCCause::_no_gc, true); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2527 |
EventMark em("%s", msg); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2528 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2529 |
ShenandoahWorkerScope scope(workers(), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2530 |
ShenandoahWorkerPolicy::calc_workers_for_conc_evac(), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2531 |
"concurrent evacuation"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2532 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2533 |
try_inject_alloc_failure(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2534 |
op_conc_evac(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2535 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2536 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2537 |
void ShenandoahHeap::entry_updaterefs() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2538 |
ShenandoahGCPhase phase(ShenandoahPhaseTimings::conc_update_refs); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2539 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2540 |
static const char* msg = "Concurrent update references"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2541 |
GCTraceTime(Info, gc) time(msg, NULL, GCCause::_no_gc, true); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2542 |
EventMark em("%s", msg); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2543 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2544 |
ShenandoahWorkerScope scope(workers(), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2545 |
ShenandoahWorkerPolicy::calc_workers_for_conc_update_ref(), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2546 |
"concurrent reference update"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2547 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2548 |
try_inject_alloc_failure(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2549 |
op_updaterefs(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2550 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2551 |
void ShenandoahHeap::entry_cleanup() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2552 |
ShenandoahGCPhase phase(ShenandoahPhaseTimings::conc_cleanup); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2553 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2554 |
static const char* msg = "Concurrent cleanup"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2555 |
GCTraceTime(Info, gc) time(msg, NULL, GCCause::_no_gc, true); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2556 |
EventMark em("%s", msg); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2557 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2558 |
// This phase does not use workers, no need for setup |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2559 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2560 |
try_inject_alloc_failure(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2561 |
op_cleanup(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2562 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2563 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2564 |
void ShenandoahHeap::entry_reset() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2565 |
ShenandoahGCPhase phase(ShenandoahPhaseTimings::conc_reset); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2566 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2567 |
static const char* msg = "Concurrent reset"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2568 |
GCTraceTime(Info, gc) time(msg, NULL, GCCause::_no_gc, true); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2569 |
EventMark em("%s", msg); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2570 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2571 |
ShenandoahWorkerScope scope(workers(), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2572 |
ShenandoahWorkerPolicy::calc_workers_for_conc_reset(), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2573 |
"concurrent reset"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2574 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2575 |
try_inject_alloc_failure(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2576 |
op_reset(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2577 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2578 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2579 |
void ShenandoahHeap::entry_preclean() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2580 |
if (ShenandoahPreclean && process_references()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2581 |
static const char* msg = "Concurrent precleaning"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2582 |
GCTraceTime(Info, gc) time(msg, NULL, GCCause::_no_gc, true); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2583 |
EventMark em("%s", msg); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2584 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2585 |
ShenandoahGCPhase conc_preclean(ShenandoahPhaseTimings::conc_preclean); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2586 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2587 |
ShenandoahWorkerScope scope(workers(), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2588 |
ShenandoahWorkerPolicy::calc_workers_for_conc_preclean(), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2589 |
"concurrent preclean", |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2590 |
/* check_workers = */ false); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2591 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2592 |
try_inject_alloc_failure(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2593 |
op_preclean(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2594 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2595 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2596 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2597 |
void ShenandoahHeap::entry_traversal() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2598 |
static const char* msg = "Concurrent traversal"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2599 |
GCTraceTime(Info, gc) time(msg, NULL, GCCause::_no_gc, true); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2600 |
EventMark em("%s", msg); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2601 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2602 |
TraceCollectorStats tcs(monitoring_support()->concurrent_collection_counters()); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2603 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2604 |
ShenandoahWorkerScope scope(workers(), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2605 |
ShenandoahWorkerPolicy::calc_workers_for_conc_traversal(), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2606 |
"concurrent traversal"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2607 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2608 |
try_inject_alloc_failure(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2609 |
op_traversal(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2610 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2611 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2612 |
void ShenandoahHeap::entry_uncommit(double shrink_before) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2613 |
static const char *msg = "Concurrent uncommit"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2614 |
GCTraceTime(Info, gc) time(msg, NULL, GCCause::_no_gc, true); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2615 |
EventMark em("%s", msg); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2616 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2617 |
ShenandoahGCPhase phase(ShenandoahPhaseTimings::conc_uncommit); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2618 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2619 |
op_uncommit(shrink_before); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2620 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2621 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2622 |
void ShenandoahHeap::try_inject_alloc_failure() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2623 |
if (ShenandoahAllocFailureALot && !cancelled_gc() && ((os::random() % 1000) > 950)) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2624 |
_inject_alloc_failure.set(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2625 |
os::naked_short_sleep(1); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2626 |
if (cancelled_gc()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2627 |
log_info(gc)("Allocation failure was successfully injected"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2628 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2629 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2630 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2631 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2632 |
bool ShenandoahHeap::should_inject_alloc_failure() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2633 |
return _inject_alloc_failure.is_set() && _inject_alloc_failure.try_unset(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2634 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2635 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2636 |
void ShenandoahHeap::initialize_serviceability() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2637 |
_memory_pool = new ShenandoahMemoryPool(this); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2638 |
_cycle_memory_manager.add_pool(_memory_pool); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2639 |
_stw_memory_manager.add_pool(_memory_pool); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2640 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2641 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2642 |
GrowableArray<GCMemoryManager*> ShenandoahHeap::memory_managers() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2643 |
GrowableArray<GCMemoryManager*> memory_managers(2); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2644 |
memory_managers.append(&_cycle_memory_manager); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2645 |
memory_managers.append(&_stw_memory_manager); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2646 |
return memory_managers; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2647 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2648 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2649 |
GrowableArray<MemoryPool*> ShenandoahHeap::memory_pools() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2650 |
GrowableArray<MemoryPool*> memory_pools(1); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2651 |
memory_pools.append(_memory_pool); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2652 |
return memory_pools; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2653 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2654 |
|
53873
5cf6623b1283
8219524: Shenandoah misreports "committed" size in MemoryMXBean
shade
parents:
53582
diff
changeset
|
2655 |
MemoryUsage ShenandoahHeap::memory_usage() { |
5cf6623b1283
8219524: Shenandoah misreports "committed" size in MemoryMXBean
shade
parents:
53582
diff
changeset
|
2656 |
return _memory_pool->get_memory_usage(); |
5cf6623b1283
8219524: Shenandoah misreports "committed" size in MemoryMXBean
shade
parents:
53582
diff
changeset
|
2657 |
} |
5cf6623b1283
8219524: Shenandoah misreports "committed" size in MemoryMXBean
shade
parents:
53582
diff
changeset
|
2658 |
|
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2659 |
void ShenandoahHeap::enter_evacuation() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2660 |
_oom_evac_handler.enter_evacuation(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2661 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2662 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2663 |
void ShenandoahHeap::leave_evacuation() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2664 |
_oom_evac_handler.leave_evacuation(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2665 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2666 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2667 |
ShenandoahRegionIterator::ShenandoahRegionIterator() : |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2668 |
_heap(ShenandoahHeap::heap()), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2669 |
_index(0) {} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2670 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2671 |
ShenandoahRegionIterator::ShenandoahRegionIterator(ShenandoahHeap* heap) : |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2672 |
_heap(heap), |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2673 |
_index(0) {} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2674 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2675 |
void ShenandoahRegionIterator::reset() { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2676 |
_index = 0; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2677 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2678 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2679 |
bool ShenandoahRegionIterator::has_next() const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2680 |
return _index < _heap->num_regions(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2681 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2682 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2683 |
char ShenandoahHeap::gc_state() const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2684 |
return _gc_state.raw_value(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2685 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2686 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2687 |
void ShenandoahHeap::deduplicate_string(oop str) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2688 |
assert(java_lang_String::is_instance(str), "invariant"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2689 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2690 |
if (ShenandoahStringDedup::is_enabled()) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2691 |
ShenandoahStringDedup::deduplicate(str); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2692 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2693 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2694 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2695 |
const char* ShenandoahHeap::init_mark_event_message() const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2696 |
bool update_refs = has_forwarded_objects(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2697 |
bool proc_refs = process_references(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2698 |
bool unload_cls = unload_classes(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2699 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2700 |
if (update_refs && proc_refs && unload_cls) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2701 |
return "Pause Init Mark (update refs) (process weakrefs) (unload classes)"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2702 |
} else if (update_refs && proc_refs) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2703 |
return "Pause Init Mark (update refs) (process weakrefs)"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2704 |
} else if (update_refs && unload_cls) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2705 |
return "Pause Init Mark (update refs) (unload classes)"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2706 |
} else if (proc_refs && unload_cls) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2707 |
return "Pause Init Mark (process weakrefs) (unload classes)"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2708 |
} else if (update_refs) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2709 |
return "Pause Init Mark (update refs)"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2710 |
} else if (proc_refs) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2711 |
return "Pause Init Mark (process weakrefs)"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2712 |
} else if (unload_cls) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2713 |
return "Pause Init Mark (unload classes)"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2714 |
} else { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2715 |
return "Pause Init Mark"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2716 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2717 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2718 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2719 |
const char* ShenandoahHeap::final_mark_event_message() const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2720 |
bool update_refs = has_forwarded_objects(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2721 |
bool proc_refs = process_references(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2722 |
bool unload_cls = unload_classes(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2723 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2724 |
if (update_refs && proc_refs && unload_cls) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2725 |
return "Pause Final Mark (update refs) (process weakrefs) (unload classes)"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2726 |
} else if (update_refs && proc_refs) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2727 |
return "Pause Final Mark (update refs) (process weakrefs)"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2728 |
} else if (update_refs && unload_cls) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2729 |
return "Pause Final Mark (update refs) (unload classes)"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2730 |
} else if (proc_refs && unload_cls) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2731 |
return "Pause Final Mark (process weakrefs) (unload classes)"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2732 |
} else if (update_refs) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2733 |
return "Pause Final Mark (update refs)"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2734 |
} else if (proc_refs) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2735 |
return "Pause Final Mark (process weakrefs)"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2736 |
} else if (unload_cls) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2737 |
return "Pause Final Mark (unload classes)"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2738 |
} else { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2739 |
return "Pause Final Mark"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2740 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2741 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2742 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2743 |
const char* ShenandoahHeap::conc_mark_event_message() const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2744 |
bool update_refs = has_forwarded_objects(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2745 |
bool proc_refs = process_references(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2746 |
bool unload_cls = unload_classes(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2747 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2748 |
if (update_refs && proc_refs && unload_cls) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2749 |
return "Concurrent marking (update refs) (process weakrefs) (unload classes)"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2750 |
} else if (update_refs && proc_refs) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2751 |
return "Concurrent marking (update refs) (process weakrefs)"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2752 |
} else if (update_refs && unload_cls) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2753 |
return "Concurrent marking (update refs) (unload classes)"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2754 |
} else if (proc_refs && unload_cls) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2755 |
return "Concurrent marking (process weakrefs) (unload classes)"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2756 |
} else if (update_refs) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2757 |
return "Concurrent marking (update refs)"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2758 |
} else if (proc_refs) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2759 |
return "Concurrent marking (process weakrefs)"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2760 |
} else if (unload_cls) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2761 |
return "Concurrent marking (unload classes)"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2762 |
} else { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2763 |
return "Concurrent marking"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2764 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2765 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2766 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2767 |
const char* ShenandoahHeap::degen_event_message(ShenandoahDegenPoint point) const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2768 |
switch (point) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2769 |
case _degenerated_unset: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2770 |
return "Pause Degenerated GC (<UNSET>)"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2771 |
case _degenerated_traversal: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2772 |
return "Pause Degenerated GC (Traversal)"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2773 |
case _degenerated_outside_cycle: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2774 |
return "Pause Degenerated GC (Outside of Cycle)"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2775 |
case _degenerated_mark: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2776 |
return "Pause Degenerated GC (Mark)"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2777 |
case _degenerated_evac: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2778 |
return "Pause Degenerated GC (Evacuation)"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2779 |
case _degenerated_updaterefs: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2780 |
return "Pause Degenerated GC (Update Refs)"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2781 |
default: |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2782 |
ShouldNotReachHere(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2783 |
return "ERROR"; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2784 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2785 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2786 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2787 |
jushort* ShenandoahHeap::get_liveness_cache(uint worker_id) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2788 |
#ifdef ASSERT |
54045 | 2789 |
assert(_liveness_cache != NULL, "sanity"); |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2790 |
assert(worker_id < _max_workers, "sanity"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2791 |
for (uint i = 0; i < num_regions(); i++) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2792 |
assert(_liveness_cache[worker_id][i] == 0, "liveness cache should be empty"); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2793 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2794 |
#endif |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2795 |
return _liveness_cache[worker_id]; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2796 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2797 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2798 |
void ShenandoahHeap::flush_liveness_cache(uint worker_id) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2799 |
assert(worker_id < _max_workers, "sanity"); |
54045 | 2800 |
assert(_liveness_cache != NULL, "sanity"); |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2801 |
jushort* ld = _liveness_cache[worker_id]; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2802 |
for (uint i = 0; i < num_regions(); i++) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2803 |
ShenandoahHeapRegion* r = get_region(i); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2804 |
jushort live = ld[i]; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2805 |
if (live > 0) { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2806 |
r->increase_live_data_gc_words(live); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2807 |
ld[i] = 0; |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2808 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2809 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2810 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2811 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2812 |
size_t ShenandoahHeap::obj_size(oop obj) const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2813 |
return CollectedHeap::obj_size(obj) + ShenandoahBrooksPointer::word_size(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2814 |
} |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2815 |
|
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2816 |
ptrdiff_t ShenandoahHeap::cell_header_size() const { |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2817 |
return ShenandoahBrooksPointer::byte_size(); |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
diff
changeset
|
2818 |
} |