author | lkorinth |
Wed, 13 Nov 2019 11:37:29 +0100 | |
changeset 59053 | ba6c248cae19 |
parent 55002 | da9840e2f7da |
permissions | -rw-r--r-- |
1 | 1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52925
diff
changeset
|
2 |
* Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
3261
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52925
diff
changeset
|
25 |
#ifndef SHARE_GC_SHARED_GCCAUSE_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52925
diff
changeset
|
26 |
#define SHARE_GC_SHARED_GCCAUSE_HPP |
7397 | 27 |
|
28 |
#include "memory/allocation.hpp" |
|
29 |
||
1 | 30 |
// |
31 |
// This class exposes implementation details of the various |
|
32 |
// collector(s), and we need to be very careful with it. If |
|
33 |
// use of this class grows, we should split it into public |
|
22551 | 34 |
// and implementation-private "causes". |
1 | 35 |
// |
37103
79c0f8e4b7b7
8062506: Java GCCause enum is out of sync with C++ GCCause enum
pliden
parents:
35061
diff
changeset
|
36 |
// The definitions in the SA code should be kept in sync |
79c0f8e4b7b7
8062506: Java GCCause enum is out of sync with C++ GCCause enum
pliden
parents:
35061
diff
changeset
|
37 |
// with the definitions here. |
79c0f8e4b7b7
8062506: Java GCCause enum is out of sync with C++ GCCause enum
pliden
parents:
35061
diff
changeset
|
38 |
// |
1 | 39 |
|
40 |
class GCCause : public AllStatic { |
|
41 |
public: |
|
42 |
enum Cause { |
|
43 |
/* public */ |
|
44 |
_java_lang_system_gc, |
|
45 |
_full_gc_alot, |
|
46 |
_scavenge_alot, |
|
47 |
_allocation_profiler, |
|
48 |
_jvmti_force_gc, |
|
49 |
_gc_locker, |
|
50 |
_heap_inspection, |
|
51 |
_heap_dump, |
|
26183
bbe259d3c8bc
8055098: WB API should be extended to provide information about size and age of object.
tschatzl
parents:
22551
diff
changeset
|
52 |
_wb_young_gc, |
27900
d24cd7a1ed38
8065579: WB method to start G1 concurrent mark cycle should be introduced
tschatzl
parents:
27008
diff
changeset
|
53 |
_wb_conc_mark, |
37149
f025738bbada
8152113: Remove _last_ditch_collection GC-cause and avoid expanding heap on Metaspace OOM
sjohanss
parents:
37103
diff
changeset
|
54 |
_wb_full_gc, |
52811
ff04b71bf6f1
8214388: CDS dumping fails with java heap fragmentation
iklam
parents:
50525
diff
changeset
|
55 |
_archive_time_gc, |
1 | 56 |
|
57 |
/* implementation independent, but reserved for GC use */ |
|
58 |
_no_gc, |
|
59 |
_no_cause_specified, |
|
60 |
_allocation_failure, |
|
61 |
||
62 |
/* implementation specific */ |
|
63 |
||
64 |
_tenured_generation_full, |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12630
diff
changeset
|
65 |
_metadata_GC_threshold, |
37149
f025738bbada
8152113: Remove _last_ditch_collection GC-cause and avoid expanding heap on Metaspace OOM
sjohanss
parents:
37103
diff
changeset
|
66 |
_metadata_GC_clear_soft_refs, |
1 | 67 |
|
68 |
_old_generation_expanded_on_last_scavenge, |
|
69 |
_old_generation_too_full_to_scavenge, |
|
70 |
_adaptive_size_policy, |
|
71 |
||
2344 | 72 |
_g1_inc_collection_pause, |
11576
e0bef5ca4602
6976060: G1: humongous object allocations should initiate marking cycles when necessary
brutisso
parents:
8295
diff
changeset
|
73 |
_g1_humongous_allocation, |
52918
f94c7929a44b
8212657: Implementation of JDK-8204089 Promptly Return Unused Committed Memory from G1
tschatzl
parents:
52811
diff
changeset
|
74 |
_g1_periodic_collection, |
1374 | 75 |
|
31032
8e72621ca186
8072913: [REDO] GCCause should distinguish jcmd GC.run from System.gc()
ysuenaga
parents:
30764
diff
changeset
|
76 |
_dcmd_gc_run, |
8e72621ca186
8072913: [REDO] GCCause should distinguish jcmd GC.run from System.gc()
ysuenaga
parents:
30764
diff
changeset
|
77 |
|
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
52918
diff
changeset
|
78 |
_shenandoah_stop_vm, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
52918
diff
changeset
|
79 |
_shenandoah_allocation_failure_evac, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
52918
diff
changeset
|
80 |
_shenandoah_concurrent_gc, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
52918
diff
changeset
|
81 |
_shenandoah_traversal_gc, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
52918
diff
changeset
|
82 |
_shenandoah_upgrade_to_full_gc, |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
52918
diff
changeset
|
83 |
|
50525
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
49054
diff
changeset
|
84 |
_z_timer, |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
49054
diff
changeset
|
85 |
_z_warmup, |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
49054
diff
changeset
|
86 |
_z_allocation_rate, |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
49054
diff
changeset
|
87 |
_z_allocation_stall, |
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
49054
diff
changeset
|
88 |
_z_proactive, |
55002 | 89 |
_z_high_usage, |
50525
767cdb97f103
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents:
49054
diff
changeset
|
90 |
|
1 | 91 |
_last_gc_cause |
92 |
}; |
|
93 |
||
94 |
inline static bool is_user_requested_gc(GCCause::Cause cause) { |
|
95 |
return (cause == GCCause::_java_lang_system_gc || |
|
31032
8e72621ca186
8072913: [REDO] GCCause should distinguish jcmd GC.run from System.gc()
ysuenaga
parents:
30764
diff
changeset
|
96 |
cause == GCCause::_dcmd_gc_run); |
1 | 97 |
} |
1374 | 98 |
|
1 | 99 |
inline static bool is_serviceability_requested_gc(GCCause::Cause |
100 |
cause) { |
|
101 |
return (cause == GCCause::_jvmti_force_gc || |
|
102 |
cause == GCCause::_heap_inspection || |
|
103 |
cause == GCCause::_heap_dump); |
|
104 |
} |
|
1374 | 105 |
|
31634
0aa645cd8cc3
7012980: PSOldGen is increased if there is no space in Metaspace
jmasa
parents:
31032
diff
changeset
|
106 |
// Causes for collection of the tenured gernation |
0aa645cd8cc3
7012980: PSOldGen is increased if there is no space in Metaspace
jmasa
parents:
31032
diff
changeset
|
107 |
inline static bool is_tenured_allocation_failure_gc(GCCause::Cause cause) { |
0aa645cd8cc3
7012980: PSOldGen is increased if there is no space in Metaspace
jmasa
parents:
31032
diff
changeset
|
108 |
assert(cause != GCCause::_old_generation_too_full_to_scavenge && |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
31634
diff
changeset
|
109 |
cause != GCCause::_old_generation_expanded_on_last_scavenge, |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
31634
diff
changeset
|
110 |
"This GCCause may be correct but is not expected yet: %s", |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
31634
diff
changeset
|
111 |
to_string(cause)); |
59053
ba6c248cae19
8232365: Implementation for JEP 363: Remove the Concurrent Mark Sweep (CMS) Garbage Collector
lkorinth
parents:
55002
diff
changeset
|
112 |
// _tenured_generation_full for full tenured generations |
31634
0aa645cd8cc3
7012980: PSOldGen is increased if there is no space in Metaspace
jmasa
parents:
31032
diff
changeset
|
113 |
// _adaptive_size_policy for a full collection after a young GC |
0aa645cd8cc3
7012980: PSOldGen is increased if there is no space in Metaspace
jmasa
parents:
31032
diff
changeset
|
114 |
// _allocation_failure is the generic cause a collection which could result |
0aa645cd8cc3
7012980: PSOldGen is increased if there is no space in Metaspace
jmasa
parents:
31032
diff
changeset
|
115 |
// in the collection of the tenured generation if there is not enough space |
0aa645cd8cc3
7012980: PSOldGen is increased if there is no space in Metaspace
jmasa
parents:
31032
diff
changeset
|
116 |
// in the tenured generation to support a young GC. |
0aa645cd8cc3
7012980: PSOldGen is increased if there is no space in Metaspace
jmasa
parents:
31032
diff
changeset
|
117 |
return (cause == GCCause::_tenured_generation_full || |
0aa645cd8cc3
7012980: PSOldGen is increased if there is no space in Metaspace
jmasa
parents:
31032
diff
changeset
|
118 |
cause == GCCause::_adaptive_size_policy || |
37149
f025738bbada
8152113: Remove _last_ditch_collection GC-cause and avoid expanding heap on Metaspace OOM
sjohanss
parents:
37103
diff
changeset
|
119 |
cause == GCCause::_allocation_failure); |
31634
0aa645cd8cc3
7012980: PSOldGen is increased if there is no space in Metaspace
jmasa
parents:
31032
diff
changeset
|
120 |
} |
0aa645cd8cc3
7012980: PSOldGen is increased if there is no space in Metaspace
jmasa
parents:
31032
diff
changeset
|
121 |
|
0aa645cd8cc3
7012980: PSOldGen is increased if there is no space in Metaspace
jmasa
parents:
31032
diff
changeset
|
122 |
// Causes for collection of the young generation |
0aa645cd8cc3
7012980: PSOldGen is increased if there is no space in Metaspace
jmasa
parents:
31032
diff
changeset
|
123 |
inline static bool is_allocation_failure_gc(GCCause::Cause cause) { |
0aa645cd8cc3
7012980: PSOldGen is increased if there is no space in Metaspace
jmasa
parents:
31032
diff
changeset
|
124 |
// _allocation_failure is the generic cause a collection for allocation failure |
0aa645cd8cc3
7012980: PSOldGen is increased if there is no space in Metaspace
jmasa
parents:
31032
diff
changeset
|
125 |
// _adaptive_size_policy is for a collecton done before a full GC |
0aa645cd8cc3
7012980: PSOldGen is increased if there is no space in Metaspace
jmasa
parents:
31032
diff
changeset
|
126 |
return (cause == GCCause::_allocation_failure || |
52925
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
52918
diff
changeset
|
127 |
cause == GCCause::_adaptive_size_policy || |
9c18c9d839d3
8214259: Implementation: JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
rkennke
parents:
52918
diff
changeset
|
128 |
cause == GCCause::_shenandoah_allocation_failure_evac); |
31634
0aa645cd8cc3
7012980: PSOldGen is increased if there is no space in Metaspace
jmasa
parents:
31032
diff
changeset
|
129 |
} |
0aa645cd8cc3
7012980: PSOldGen is increased if there is no space in Metaspace
jmasa
parents:
31032
diff
changeset
|
130 |
|
1 | 131 |
// Return a string describing the GCCause. |
132 |
static const char* to_string(GCCause::Cause cause); |
|
133 |
}; |
|
7397 | 134 |
|
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52925
diff
changeset
|
135 |
#endif // SHARE_GC_SHARED_GCCAUSE_HPP |