src/hotspot/share/gc/shared/gcCause.hpp
author erikj
Tue, 12 Sep 2017 19:03:39 +0200
changeset 47216 71c04702a3d5
parent 37149 hotspot/src/share/vm/gc/shared/gcCause.hpp@f025738bbada
child 49054 fa4c8865a4ff
permissions -rw-r--r--
8187443: Forest Consolidation: Move files to unified layout Reviewed-by: darcy, ihse
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 28935
diff changeset
     2
 * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    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
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 28935
diff changeset
    25
#ifndef SHARE_VM_GC_SHARED_GCCAUSE_HPP
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 28935
diff changeset
    26
#define SHARE_VM_GC_SHARED_GCCAUSE_HPP
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "memory/allocation.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
// This class exposes implementation details of the various
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
// collector(s), and we need to be very careful with it. If
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
// use of this class grows, we should split it into public
22551
9bf46d16dcc6 8025856: Fix typos in the GC code
jwilhelm
parents: 22234
diff changeset
    34
// and implementation-private "causes".
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    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
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
class GCCause : public AllStatic {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  enum Cause {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
    /* public */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
    _java_lang_system_gc,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
    _full_gc_alot,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
    _scavenge_alot,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
    _allocation_profiler,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
    _jvmti_force_gc,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
    _gc_locker,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
    _heap_inspection,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    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,
27008
10d6c1e39d87 8059466: Force young GC to initiate marking cycle when stat update is requested
sjohanss
parents: 26845
diff changeset
    55
    _update_allocation_context_stats_inc,
10d6c1e39d87 8059466: Force young GC to initiate marking cycle when stat update is requested
sjohanss
parents: 26845
diff changeset
    56
    _update_allocation_context_stats_full,
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
    /* implementation independent, but reserved for GC use */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
    _no_gc,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
    _no_cause_specified,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
    _allocation_failure,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
    /* implementation specific */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
    _tenured_generation_full,
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 12630
diff changeset
    66
    _metadata_GC_threshold,
37149
f025738bbada 8152113: Remove _last_ditch_collection GC-cause and avoid expanding heap on Metaspace OOM
sjohanss
parents: 37103
diff changeset
    67
    _metadata_GC_clear_soft_refs,
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
    _cms_generation_full,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
    _cms_initial_mark,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
    _cms_final_remark,
18025
b7bcf7497f93 8005849: JEP 167: Event-Based JVM Tracing
sla
parents: 15095
diff changeset
    72
    _cms_concurrent_mark,
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
    _old_generation_expanded_on_last_scavenge,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
    _old_generation_too_full_to_scavenge,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
    _adaptive_size_policy,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
2344
f2e09ba7ceab 6543938: G1: remove the concept of popularity
apetrusenko
parents: 1374
diff changeset
    78
    _g1_inc_collection_pause,
11576
e0bef5ca4602 6976060: G1: humongous object allocations should initiate marking cycles when necessary
brutisso
parents: 8295
diff changeset
    79
    _g1_humongous_allocation,
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
    80
31032
8e72621ca186 8072913: [REDO] GCCause should distinguish jcmd GC.run from System.gc()
ysuenaga
parents: 30764
diff changeset
    81
    _dcmd_gc_run,
8e72621ca186 8072913: [REDO] GCCause should distinguish jcmd GC.run from System.gc()
ysuenaga
parents: 30764
diff changeset
    82
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
    _last_gc_cause
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  inline static bool is_user_requested_gc(GCCause::Cause cause) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
    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
    88
            cause == GCCause::_dcmd_gc_run);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  }
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
    90
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  inline static bool is_serviceability_requested_gc(GCCause::Cause
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
                                                             cause) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
    return (cause == GCCause::_jvmti_force_gc ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
            cause == GCCause::_heap_inspection ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
            cause == GCCause::_heap_dump);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  }
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents: 1
diff changeset
    97
31634
0aa645cd8cc3 7012980: PSOldGen is increased if there is no space in Metaspace
jmasa
parents: 31032
diff changeset
    98
  // Causes for collection of the tenured gernation
0aa645cd8cc3 7012980: PSOldGen is increased if there is no space in Metaspace
jmasa
parents: 31032
diff changeset
    99
  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
   100
    assert(cause != GCCause::_old_generation_too_full_to_scavenge &&
33105
294e48b4f704 8080775: Better argument formatting for assert() and friends
david
parents: 31634
diff changeset
   101
           cause != GCCause::_old_generation_expanded_on_last_scavenge,
294e48b4f704 8080775: Better argument formatting for assert() and friends
david
parents: 31634
diff changeset
   102
           "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
   103
           to_string(cause));
31634
0aa645cd8cc3 7012980: PSOldGen is increased if there is no space in Metaspace
jmasa
parents: 31032
diff changeset
   104
    // _tenured_generation_full or _cms_generation_full for full tenured generations
0aa645cd8cc3 7012980: PSOldGen is increased if there is no space in Metaspace
jmasa
parents: 31032
diff changeset
   105
    // _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
   106
    // _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
   107
    // 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
   108
    // 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
   109
    return (cause == GCCause::_tenured_generation_full ||
0aa645cd8cc3 7012980: PSOldGen is increased if there is no space in Metaspace
jmasa
parents: 31032
diff changeset
   110
            cause == GCCause::_cms_generation_full ||
0aa645cd8cc3 7012980: PSOldGen is increased if there is no space in Metaspace
jmasa
parents: 31032
diff changeset
   111
            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
   112
            cause == GCCause::_allocation_failure);
31634
0aa645cd8cc3 7012980: PSOldGen is increased if there is no space in Metaspace
jmasa
parents: 31032
diff changeset
   113
  }
0aa645cd8cc3 7012980: PSOldGen is increased if there is no space in Metaspace
jmasa
parents: 31032
diff changeset
   114
0aa645cd8cc3 7012980: PSOldGen is increased if there is no space in Metaspace
jmasa
parents: 31032
diff changeset
   115
  // Causes for collection of the young generation
0aa645cd8cc3 7012980: PSOldGen is increased if there is no space in Metaspace
jmasa
parents: 31032
diff changeset
   116
  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
   117
    // _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
   118
    // _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
   119
    return (cause == GCCause::_allocation_failure ||
37149
f025738bbada 8152113: Remove _last_ditch_collection GC-cause and avoid expanding heap on Metaspace OOM
sjohanss
parents: 37103
diff changeset
   120
            cause == GCCause::_adaptive_size_policy);
31634
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
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  // Return a string describing the GCCause.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  static const char* to_string(GCCause::Cause cause);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
};
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   126
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 28935
diff changeset
   127
#endif // SHARE_VM_GC_SHARED_GCCAUSE_HPP