src/hotspot/share/gc/g1/heapRegionType.cpp
author tschatzl
Fri, 29 Nov 2019 10:20:17 +0100
changeset 59321 5775e4825e58
parent 53116 bb03098c4dde
permissions -rw-r--r--
8233998: New young regions registered too early in collection set Reviewed-by: sangheki, sjohanss
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26696
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
     1
/*
53116
bb03098c4dde 8211425: Allocation of old generation of java heap on alternate memory devices - G1 GC
sangheki
parents: 47216
diff changeset
     2
 * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
26696
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
     4
 *
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
     7
 * published by the Free Software Foundation.
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
     8
 *
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    13
 * accompanied this code).
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    14
 *
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    18
 *
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    21
 * questions.
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    22
 *
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    23
 */
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    24
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    25
#include "precompiled.hpp"
36098
e056a98ac7ca 8149650: Create a trace event for G1 heap region type transitions
david
parents: 31346
diff changeset
    26
#include "gc/g1/g1HeapRegionTraceType.hpp"
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 26846
diff changeset
    27
#include "gc/g1/heapRegionType.hpp"
26696
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    28
53116
bb03098c4dde 8211425: Allocation of old generation of java heap on alternate memory devices - G1 GC
sangheki
parents: 47216
diff changeset
    29
const HeapRegionType HeapRegionType::Eden      = HeapRegionType(EdenTag);
bb03098c4dde 8211425: Allocation of old generation of java heap on alternate memory devices - G1 GC
sangheki
parents: 47216
diff changeset
    30
const HeapRegionType HeapRegionType::Survivor  = HeapRegionType(SurvTag);
bb03098c4dde 8211425: Allocation of old generation of java heap on alternate memory devices - G1 GC
sangheki
parents: 47216
diff changeset
    31
const HeapRegionType HeapRegionType::Old       = HeapRegionType(OldTag);
bb03098c4dde 8211425: Allocation of old generation of java heap on alternate memory devices - G1 GC
sangheki
parents: 47216
diff changeset
    32
const HeapRegionType HeapRegionType::Humongous = HeapRegionType(StartsHumongousTag);
bb03098c4dde 8211425: Allocation of old generation of java heap on alternate memory devices - G1 GC
sangheki
parents: 47216
diff changeset
    33
26696
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    34
bool HeapRegionType::is_valid(Tag tag) {
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    35
  switch (tag) {
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    36
    case FreeTag:
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    37
    case EdenTag:
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    38
    case SurvTag:
26846
7d4376f8560e 8058495: G1: normalize names for isHumongous() and friends
tonyp
parents: 26696
diff changeset
    39
    case StartsHumongousTag:
7d4376f8560e 8058495: G1: normalize names for isHumongous() and friends
tonyp
parents: 26696
diff changeset
    40
    case ContinuesHumongousTag:
26696
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    41
    case OldTag:
46810
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 46630
diff changeset
    42
    case OpenArchiveTag:
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 46630
diff changeset
    43
    case ClosedArchiveTag:
26696
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    44
      return true;
46630
75aa3e39d02c 8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents: 36098
diff changeset
    45
    default:
75aa3e39d02c 8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents: 36098
diff changeset
    46
      return false;
26696
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    47
  }
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    48
}
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    49
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    50
const char* HeapRegionType::get_str() const {
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    51
  hrt_assert_is_valid(_tag);
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    52
  switch (_tag) {
26846
7d4376f8560e 8058495: G1: normalize names for isHumongous() and friends
tonyp
parents: 26696
diff changeset
    53
    case FreeTag:               return "FREE";
7d4376f8560e 8058495: G1: normalize names for isHumongous() and friends
tonyp
parents: 26696
diff changeset
    54
    case EdenTag:               return "EDEN";
7d4376f8560e 8058495: G1: normalize names for isHumongous() and friends
tonyp
parents: 26696
diff changeset
    55
    case SurvTag:               return "SURV";
7d4376f8560e 8058495: G1: normalize names for isHumongous() and friends
tonyp
parents: 26696
diff changeset
    56
    case StartsHumongousTag:    return "HUMS";
7d4376f8560e 8058495: G1: normalize names for isHumongous() and friends
tonyp
parents: 26696
diff changeset
    57
    case ContinuesHumongousTag: return "HUMC";
7d4376f8560e 8058495: G1: normalize names for isHumongous() and friends
tonyp
parents: 26696
diff changeset
    58
    case OldTag:                return "OLD";
46810
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 46630
diff changeset
    59
    case OpenArchiveTag:        return "OARC";
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 46630
diff changeset
    60
    case ClosedArchiveTag:      return "CARC";
46630
75aa3e39d02c 8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents: 36098
diff changeset
    61
    default:
75aa3e39d02c 8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents: 36098
diff changeset
    62
      ShouldNotReachHere();
75aa3e39d02c 8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents: 36098
diff changeset
    63
      return NULL; // keep some compilers happy
26696
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    64
  }
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    65
}
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    66
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    67
const char* HeapRegionType::get_short_str() const {
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    68
  hrt_assert_is_valid(_tag);
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    69
  switch (_tag) {
26846
7d4376f8560e 8058495: G1: normalize names for isHumongous() and friends
tonyp
parents: 26696
diff changeset
    70
    case FreeTag:               return "F";
7d4376f8560e 8058495: G1: normalize names for isHumongous() and friends
tonyp
parents: 26696
diff changeset
    71
    case EdenTag:               return "E";
7d4376f8560e 8058495: G1: normalize names for isHumongous() and friends
tonyp
parents: 26696
diff changeset
    72
    case SurvTag:               return "S";
7d4376f8560e 8058495: G1: normalize names for isHumongous() and friends
tonyp
parents: 26696
diff changeset
    73
    case StartsHumongousTag:    return "HS";
7d4376f8560e 8058495: G1: normalize names for isHumongous() and friends
tonyp
parents: 26696
diff changeset
    74
    case ContinuesHumongousTag: return "HC";
7d4376f8560e 8058495: G1: normalize names for isHumongous() and friends
tonyp
parents: 26696
diff changeset
    75
    case OldTag:                return "O";
46810
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 46630
diff changeset
    76
    case OpenArchiveTag:        return "OA";
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 46630
diff changeset
    77
    case ClosedArchiveTag:      return "CA";
46630
75aa3e39d02c 8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents: 36098
diff changeset
    78
    default:
75aa3e39d02c 8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents: 36098
diff changeset
    79
      ShouldNotReachHere();
75aa3e39d02c 8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents: 36098
diff changeset
    80
      return NULL; // keep some compilers happy
26696
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    81
  }
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    82
}
36098
e056a98ac7ca 8149650: Create a trace event for G1 heap region type transitions
david
parents: 31346
diff changeset
    83
e056a98ac7ca 8149650: Create a trace event for G1 heap region type transitions
david
parents: 31346
diff changeset
    84
G1HeapRegionTraceType::Type HeapRegionType::get_trace_type() {
e056a98ac7ca 8149650: Create a trace event for G1 heap region type transitions
david
parents: 31346
diff changeset
    85
  hrt_assert_is_valid(_tag);
e056a98ac7ca 8149650: Create a trace event for G1 heap region type transitions
david
parents: 31346
diff changeset
    86
  switch (_tag) {
e056a98ac7ca 8149650: Create a trace event for G1 heap region type transitions
david
parents: 31346
diff changeset
    87
    case FreeTag:               return G1HeapRegionTraceType::Free;
e056a98ac7ca 8149650: Create a trace event for G1 heap region type transitions
david
parents: 31346
diff changeset
    88
    case EdenTag:               return G1HeapRegionTraceType::Eden;
e056a98ac7ca 8149650: Create a trace event for G1 heap region type transitions
david
parents: 31346
diff changeset
    89
    case SurvTag:               return G1HeapRegionTraceType::Survivor;
e056a98ac7ca 8149650: Create a trace event for G1 heap region type transitions
david
parents: 31346
diff changeset
    90
    case StartsHumongousTag:    return G1HeapRegionTraceType::StartsHumongous;
e056a98ac7ca 8149650: Create a trace event for G1 heap region type transitions
david
parents: 31346
diff changeset
    91
    case ContinuesHumongousTag: return G1HeapRegionTraceType::ContinuesHumongous;
e056a98ac7ca 8149650: Create a trace event for G1 heap region type transitions
david
parents: 31346
diff changeset
    92
    case OldTag:                return G1HeapRegionTraceType::Old;
46810
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 46630
diff changeset
    93
    case OpenArchiveTag:        return G1HeapRegionTraceType::OpenArchive;
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 46630
diff changeset
    94
    case ClosedArchiveTag:      return G1HeapRegionTraceType::ClosedArchive;
46630
75aa3e39d02c 8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents: 36098
diff changeset
    95
    default:
75aa3e39d02c 8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents: 36098
diff changeset
    96
      ShouldNotReachHere();
75aa3e39d02c 8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents: 36098
diff changeset
    97
      return G1HeapRegionTraceType::Free; // keep some compilers happy
36098
e056a98ac7ca 8149650: Create a trace event for G1 heap region type transitions
david
parents: 31346
diff changeset
    98
  }
e056a98ac7ca 8149650: Create a trace event for G1 heap region type transitions
david
parents: 31346
diff changeset
    99
}