src/hotspot/share/gc/g1/heapRegionType.hpp
author coleenp
Wed, 14 Mar 2018 07:27:19 -0400
changeset 49392 2956d0ece7a9
parent 47602 d4380ee1cbe9
child 51494 1906adbef2dc
permissions -rw-r--r--
8199282: Remove ValueObj class for allocation subclassing for gc code Reviewed-by: stefank, kbarrett
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
/*
49392
2956d0ece7a9 8199282: Remove ValueObj class for allocation subclassing for gc code
coleenp
parents: 47602
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
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 26846
diff changeset
    25
#ifndef SHARE_VM_GC_G1_HEAPREGIONTYPE_HPP
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 26846
diff changeset
    26
#define SHARE_VM_GC_G1_HEAPREGIONTYPE_HPP
26696
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    27
36098
e056a98ac7ca 8149650: Create a trace event for G1 heap region type transitions
david
parents: 33105
diff changeset
    28
#include "gc/g1/g1HeapRegionTraceType.hpp"
26696
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    29
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    30
#define hrt_assert_is_valid(tag) \
33105
294e48b4f704 8080775: Better argument formatting for assert() and friends
david
parents: 32623
diff changeset
    31
  assert(is_valid((tag)), "invalid HR type: %u", (uint) (tag))
26696
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    32
49392
2956d0ece7a9 8199282: Remove ValueObj class for allocation subclassing for gc code
coleenp
parents: 47602
diff changeset
    33
class HeapRegionType {
47602
d4380ee1cbe9 8187403: [Unknown generation] is shown in Stack Memory on HSDB
ysuenaga
parents: 47216
diff changeset
    34
friend class VMStructs;
d4380ee1cbe9 8187403: [Unknown generation] is shown in Stack Memory on HSDB
ysuenaga
parents: 47216
diff changeset
    35
26696
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    36
private:
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    37
  // We encode the value of the heap region type so the generation can be
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    38
  // determined quickly. The tag is split into two parts:
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    39
  //
32623
390a27af5657 8134626: Misc cleanups after generation array removal
jwilhelm
parents: 31346
diff changeset
    40
  //   major type (young, old, humongous, archive)           : top N-1 bits
26696
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    41
  //   minor type (eden / survivor, starts / cont hum, etc.) : bottom 1 bit
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    42
  //
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    43
  // If there's need to increase the number of minor types in the
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    44
  // future, we'll have to increase the size of the latter and hence
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    45
  // decrease the size of the former.
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    46
  //
46810
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
    47
  // 00000 0 [ 0] Free
26696
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    48
  //
46810
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
    49
  // 00001 0 [ 2] Young Mask
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
    50
  // 00001 0 [ 2] Eden
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
    51
  // 00001 1 [ 3] Survivor
26696
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    52
  //
46810
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
    53
  // 00010 0 [ 4] Humongous Mask
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
    54
  // 00100 0 [ 8] Pinned Mask
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
    55
  // 00110 0 [12] Starts Humongous
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
    56
  // 00110 1 [13] Continues Humongous
26696
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    57
  //
46810
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
    58
  // 01000 0 [16] Old Mask
31346
a70d45c06136 8042668: GC Support for shared heap ranges in CDS
jiangli
parents: 30764
diff changeset
    59
  //
46810
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
    60
  // 10000 0 [32] Archive Mask
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
    61
  // 11100 0 [56] Open Archive
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
    62
  // 11100 1 [57] Closed Archive
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
    63
  //
26696
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    64
  typedef enum {
26846
7d4376f8560e 8058495: G1: normalize names for isHumongous() and friends
tonyp
parents: 26696
diff changeset
    65
    FreeTag               = 0,
26696
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    66
26846
7d4376f8560e 8058495: G1: normalize names for isHumongous() and friends
tonyp
parents: 26696
diff changeset
    67
    YoungMask             = 2,
7d4376f8560e 8058495: G1: normalize names for isHumongous() and friends
tonyp
parents: 26696
diff changeset
    68
    EdenTag               = YoungMask,
7d4376f8560e 8058495: G1: normalize names for isHumongous() and friends
tonyp
parents: 26696
diff changeset
    69
    SurvTag               = YoungMask + 1,
26696
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    70
26846
7d4376f8560e 8058495: G1: normalize names for isHumongous() and friends
tonyp
parents: 26696
diff changeset
    71
    HumongousMask         = 4,
31346
a70d45c06136 8042668: GC Support for shared heap ranges in CDS
jiangli
parents: 30764
diff changeset
    72
    PinnedMask            = 8,
a70d45c06136 8042668: GC Support for shared heap ranges in CDS
jiangli
parents: 30764
diff changeset
    73
    StartsHumongousTag    = HumongousMask | PinnedMask,
a70d45c06136 8042668: GC Support for shared heap ranges in CDS
jiangli
parents: 30764
diff changeset
    74
    ContinuesHumongousTag = HumongousMask | PinnedMask + 1,
26696
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    75
31346
a70d45c06136 8042668: GC Support for shared heap ranges in CDS
jiangli
parents: 30764
diff changeset
    76
    OldMask               = 16,
a70d45c06136 8042668: GC Support for shared heap ranges in CDS
jiangli
parents: 30764
diff changeset
    77
    OldTag                = OldMask,
a70d45c06136 8042668: GC Support for shared heap ranges in CDS
jiangli
parents: 30764
diff changeset
    78
46810
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
    79
    // Archive regions are regions with immutable content (i.e. not reclaimed, and
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
    80
    // not allocated into during regular operation). They differ in the kind of references
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
    81
    // allowed for the contained objects:
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
    82
    // - Closed archive regions form a separate self-contained (closed) object graph
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
    83
    // within the set of all of these regions. No references outside of closed
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
    84
    // archive regions are allowed.
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
    85
    // - Open archive regions have no restrictions on the references of their objects.
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
    86
    // Objects within these regions are allowed to have references to objects
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
    87
    // contained in any other kind of regions.
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
    88
    ArchiveMask           = 32,
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
    89
    OpenArchiveTag        = ArchiveMask | PinnedMask | OldMask,
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
    90
    ClosedArchiveTag      = ArchiveMask | PinnedMask | OldMask + 1
26696
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    91
  } Tag;
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    92
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    93
  volatile Tag _tag;
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    94
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    95
  static bool is_valid(Tag tag);
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    96
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    97
  Tag get() const {
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    98
    hrt_assert_is_valid(_tag);
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
    99
    return _tag;
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   100
  }
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   101
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   102
  // Sets the type to 'tag'.
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   103
  void set(Tag tag) {
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   104
    hrt_assert_is_valid(tag);
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   105
    hrt_assert_is_valid(_tag);
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   106
    _tag = tag;
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   107
  }
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   108
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   109
  // Sets the type to 'tag', expecting the type to be 'before'. This
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   110
  // is available for when we want to add sanity checking to the type
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   111
  // transition.
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   112
  void set_from(Tag tag, Tag before) {
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   113
    hrt_assert_is_valid(tag);
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   114
    hrt_assert_is_valid(before);
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   115
    hrt_assert_is_valid(_tag);
33105
294e48b4f704 8080775: Better argument formatting for assert() and friends
david
parents: 32623
diff changeset
   116
    assert(_tag == before, "HR tag: %u, expected: %u new tag; %u", _tag, before, tag);
26696
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   117
    _tag = tag;
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   118
  }
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   119
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   120
public:
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   121
  // Queries
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   122
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   123
  bool is_free() const { return get() == FreeTag; }
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   124
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   125
  bool is_young()    const { return (get() & YoungMask) != 0; }
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   126
  bool is_eden()     const { return get() == EdenTag;  }
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   127
  bool is_survivor() const { return get() == SurvTag;  }
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   128
26846
7d4376f8560e 8058495: G1: normalize names for isHumongous() and friends
tonyp
parents: 26696
diff changeset
   129
  bool is_humongous()           const { return (get() & HumongousMask) != 0;   }
7d4376f8560e 8058495: G1: normalize names for isHumongous() and friends
tonyp
parents: 26696
diff changeset
   130
  bool is_starts_humongous()    const { return get() == StartsHumongousTag;    }
7d4376f8560e 8058495: G1: normalize names for isHumongous() and friends
tonyp
parents: 26696
diff changeset
   131
  bool is_continues_humongous() const { return get() == ContinuesHumongousTag; }
26696
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   132
46810
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
   133
  bool is_archive()        const { return (get() & ArchiveMask) != 0; }
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
   134
  bool is_open_archive()   const { return get() == OpenArchiveTag; }
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
   135
  bool is_closed_archive() const { return get() == ClosedArchiveTag; }
31346
a70d45c06136 8042668: GC Support for shared heap ranges in CDS
jiangli
parents: 30764
diff changeset
   136
a70d45c06136 8042668: GC Support for shared heap ranges in CDS
jiangli
parents: 30764
diff changeset
   137
  // is_old regions may or may not also be pinned
a70d45c06136 8042668: GC Support for shared heap ranges in CDS
jiangli
parents: 30764
diff changeset
   138
  bool is_old() const { return (get() & OldMask) != 0; }
a70d45c06136 8042668: GC Support for shared heap ranges in CDS
jiangli
parents: 30764
diff changeset
   139
42589
037b433e8069 8166811: Missing memory fences between memory allocation and refinement
kbarrett
parents: 36098
diff changeset
   140
  bool is_old_or_humongous() const { return (get() & (OldMask | HumongousMask)) != 0; }
037b433e8069 8166811: Missing memory fences between memory allocation and refinement
kbarrett
parents: 36098
diff changeset
   141
31346
a70d45c06136 8042668: GC Support for shared heap ranges in CDS
jiangli
parents: 30764
diff changeset
   142
  // is_pinned regions may be archive or humongous
a70d45c06136 8042668: GC Support for shared heap ranges in CDS
jiangli
parents: 30764
diff changeset
   143
  bool is_pinned() const { return (get() & PinnedMask) != 0; }
26696
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   144
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   145
  // Setters
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   146
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   147
  void set_free() { set(FreeTag); }
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   148
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   149
  void set_eden()        { set_from(EdenTag, FreeTag); }
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   150
  void set_eden_pre_gc() { set_from(EdenTag, SurvTag); }
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   151
  void set_survivor()    { set_from(SurvTag, FreeTag); }
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   152
26846
7d4376f8560e 8058495: G1: normalize names for isHumongous() and friends
tonyp
parents: 26696
diff changeset
   153
  void set_starts_humongous()    { set_from(StartsHumongousTag,    FreeTag); }
7d4376f8560e 8058495: G1: normalize names for isHumongous() and friends
tonyp
parents: 26696
diff changeset
   154
  void set_continues_humongous() { set_from(ContinuesHumongousTag, FreeTag); }
26696
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   155
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   156
  void set_old() { set(OldTag); }
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   157
46810
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
   158
  // Change the current region type to be of an old region type if not already done so.
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
   159
  // Returns whether the region type has been changed or not.
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
   160
  bool relabel_as_old() {
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
   161
    //assert(!is_free(), "Should not try to move Free region");
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
   162
    assert(!is_humongous(), "Should not try to move Humongous region");
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
   163
    if (is_old()) {
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
   164
      return false;
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
   165
    }
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
   166
    if (is_eden()) {
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
   167
      set_from(OldTag, EdenTag);
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
   168
      return true;
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
   169
    } else if (is_free()) {
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
   170
      set_from(OldTag, FreeTag);
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
   171
      return true;
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
   172
    } else {
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
   173
      set_from(OldTag, SurvTag);
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
   174
      return true;
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
   175
    }
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
   176
  }
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
   177
  void set_open_archive()   { set_from(OpenArchiveTag, FreeTag); }
7dad333205cd 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 42589
diff changeset
   178
  void set_closed_archive() { set_from(ClosedArchiveTag, FreeTag); }
31346
a70d45c06136 8042668: GC Support for shared heap ranges in CDS
jiangli
parents: 30764
diff changeset
   179
26696
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   180
  // Misc
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   181
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   182
  const char* get_str() const;
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   183
  const char* get_short_str() const;
36098
e056a98ac7ca 8149650: Create a trace event for G1 heap region type transitions
david
parents: 33105
diff changeset
   184
  G1HeapRegionTraceType::Type get_trace_type();
26696
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   185
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   186
  HeapRegionType() : _tag(FreeTag) { hrt_assert_is_valid(_tag); }
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   187
};
623a25e6c686 8057768: Make heap region region type in G1 HeapRegion explicit
tonyp
parents:
diff changeset
   188
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 26846
diff changeset
   189
#endif // SHARE_VM_GC_G1_HEAPREGIONTYPE_HPP