src/hotspot/share/gc/shared/gcConfiguration.cpp
author pliden
Tue, 12 Jun 2018 17:40:28 +0200
changeset 50525 767cdb97f103
parent 50113 caf115bb98ad
child 52925 9c18c9d839d3
permissions -rw-r--r--
8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental) Reviewed-by: pliden, stefank, eosterlund, ehelin, sjohanss, rbackman, coleenp, ihse, jgeorge, lmesnik, rkennke Contributed-by: per.liden@oracle.com, stefan.karlsson@oracle.com, erik.osterlund@oracle.com, mikael.gerdin@oracle.com, kim.barrett@oracle.com, nils.eliasson@oracle.com, rickard.backman@oracle.com, rwestrel@redhat.com, coleen.phillimore@oracle.com, robbin.ehn@oracle.com, gerard.ziemski@oracle.com, hugh.wilkinson@intel.com, sandhya.viswanathan@intel.com, bill.npo.wheeler@intel.com, vinay.k.awasthi@intel.com, yasuenag@gmail.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     1
/*
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     2
 * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     4
 *
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     7
 * published by the Free Software Foundation.
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     8
 *
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    13
 * accompanied this code).
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    14
 *
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    18
 *
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    21
 * questions.
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    22
 *
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    23
 */
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    24
#include "precompiled.hpp"
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    25
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    26
#include "gc/shared/collectedHeap.hpp"
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    27
#include "gc/shared/gcConfiguration.hpp"
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    28
#include "memory/universe.hpp"
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    29
#include "runtime/arguments.hpp"
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    30
#include "runtime/globals.hpp"
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    31
#include "utilities/debug.hpp"
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    32
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    33
GCName GCConfiguration::young_collector() const {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    34
  if (UseG1GC) {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    35
    return G1New;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    36
  }
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    37
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    38
  if (UseParallelGC) {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    39
    return ParallelScavenge;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    40
  }
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    41
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    42
  if (UseConcMarkSweepGC) {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    43
    return ParNew;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    44
  }
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    45
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50113
diff changeset
    46
  if (UseZGC) {
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50113
diff changeset
    47
    return NA;
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50113
diff changeset
    48
  }
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50113
diff changeset
    49
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    50
  return DefNew;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    51
}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    52
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    53
GCName GCConfiguration::old_collector() const {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    54
  if (UseG1GC) {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    55
    return G1Old;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    56
  }
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    57
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    58
  if (UseConcMarkSweepGC) {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    59
    return ConcurrentMarkSweep;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    60
  }
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    61
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    62
  if (UseParallelOldGC) {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    63
    return ParallelOld;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    64
  }
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    65
50525
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50113
diff changeset
    66
  if (UseZGC) {
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50113
diff changeset
    67
    return Z;
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50113
diff changeset
    68
  }
767cdb97f103 8204210: Implementation: JEP 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
pliden
parents: 50113
diff changeset
    69
50113
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    70
  return SerialOld;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    71
}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    72
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    73
uint GCConfiguration::num_parallel_gc_threads() const {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    74
  return ParallelGCThreads;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    75
}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    76
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    77
uint GCConfiguration::num_concurrent_gc_threads() const {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    78
  return ConcGCThreads;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    79
}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    80
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    81
bool GCConfiguration::uses_dynamic_gc_threads() const {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    82
  return UseDynamicNumberOfGCThreads;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    83
}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    84
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    85
bool GCConfiguration::is_explicit_gc_concurrent() const {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    86
  return ExplicitGCInvokesConcurrent;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    87
}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    88
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    89
bool GCConfiguration::is_explicit_gc_disabled() const {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    90
  return DisableExplicitGC;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    91
}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    92
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    93
bool GCConfiguration::has_pause_target_default_value() const {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    94
  return FLAG_IS_DEFAULT(MaxGCPauseMillis);
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    95
}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    96
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    97
uintx GCConfiguration::pause_target() const {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    98
  return MaxGCPauseMillis;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
    99
}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   100
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   101
uintx GCConfiguration::gc_time_ratio() const {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   102
  return GCTimeRatio;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   103
}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   104
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   105
bool GCTLABConfiguration::uses_tlabs() const {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   106
  return UseTLAB;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   107
}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   108
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   109
size_t GCTLABConfiguration::min_tlab_size() const {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   110
  return MinTLABSize;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   111
}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   112
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   113
uint GCTLABConfiguration::tlab_refill_waste_limit() const {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   114
  return TLABRefillWasteFraction;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   115
}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   116
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   117
intx GCSurvivorConfiguration::max_tenuring_threshold() const {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   118
  return MaxTenuringThreshold;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   119
}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   120
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   121
intx GCSurvivorConfiguration::initial_tenuring_threshold() const {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   122
  return InitialTenuringThreshold;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   123
}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   124
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   125
size_t GCHeapConfiguration::max_size() const {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   126
  return MaxHeapSize;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   127
}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   128
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   129
size_t GCHeapConfiguration::min_size() const {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   130
  return Arguments::min_heap_size();
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   131
}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   132
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   133
size_t GCHeapConfiguration::initial_size() const {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   134
  return InitialHeapSize;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   135
}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   136
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   137
bool GCHeapConfiguration::uses_compressed_oops() const {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   138
  return UseCompressedOops;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   139
}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   140
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   141
Universe::NARROW_OOP_MODE GCHeapConfiguration::narrow_oop_mode() const {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   142
  return Universe::narrow_oop_mode();
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   143
}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   144
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   145
uint GCHeapConfiguration::object_alignment_in_bytes() const {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   146
  return ObjectAlignmentInBytes;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   147
}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   148
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   149
int GCHeapConfiguration::heap_address_size_in_bits() const {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   150
  return BitsPerHeapOop;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   151
}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   152
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   153
bool GCYoungGenerationConfiguration::has_max_size_default_value() const {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   154
  return FLAG_IS_DEFAULT(MaxNewSize);
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   155
}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   156
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   157
uintx GCYoungGenerationConfiguration::max_size() const {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   158
  return MaxNewSize;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   159
}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   160
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   161
uintx GCYoungGenerationConfiguration::min_size() const {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   162
  return NewSize;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   163
}
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   164
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   165
intx GCYoungGenerationConfiguration::new_ratio() const {
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   166
  return NewRatio;
caf115bb98ad 8199712: Flight Recorder
egahlin
parents:
diff changeset
   167
}