src/hotspot/share/gc/shared/gcConfig.hpp
author pliden
Tue, 19 Jun 2018 12:11:37 +0200
changeset 50629 645a5962201d
parent 49922 3a64eea72624
child 51206 14b870bda24f
permissions -rw-r--r--
8205064: Fail immediately if an unavailable GC is selected Reviewed-by: rkennke, shade
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
49629
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
     1
/*
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
     2
 * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
     4
 *
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
     7
 * published by the Free Software Foundation.
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
     8
 *
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    13
 * accompanied this code).
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    14
 *
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    18
 *
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    21
 * questions.
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    22
 *
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    23
 */
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    24
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    25
#ifndef SHARE_GC_SHARED_GCCONFIG_HPP
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    26
#define SHARE_GC_SHARED_GCCONFIG_HPP
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    27
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    28
#include "gc/shared/collectedHeap.hpp"
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    29
#include "memory/allocation.hpp"
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    30
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    31
class GCArguments;
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    32
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    33
class GCConfig : public AllStatic {
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    34
private:
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    35
  static GCArguments* _arguments;
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    36
  static bool         _gc_selected_ergonomically;
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    37
50629
645a5962201d 8205064: Fail immediately if an unavailable GC is selected
pliden
parents: 49922
diff changeset
    38
  static void fail_if_unsupported_gc_is_selected();
49629
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    39
  static bool is_no_gc_selected();
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    40
  static bool is_exactly_one_gc_selected();
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    41
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    42
  static void select_gc_ergonomically();
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    43
  static GCArguments* select_gc();
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    44
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    45
public:
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    46
  static void initialize();
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    47
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    48
  static bool is_gc_supported(CollectedHeap::Name name);
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    49
  static bool is_gc_selected(CollectedHeap::Name name);
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    50
  static bool is_gc_selected_ergonomically();
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    51
49922
3a64eea72624 8202364: Add GCConfig::hs_err_name() to avoid GC-specific code in error reporting
pliden
parents: 49629
diff changeset
    52
  static const char* hs_err_name();
3a64eea72624 8202364: Add GCConfig::hs_err_name() to avoid GC-specific code in error reporting
pliden
parents: 49629
diff changeset
    53
49629
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    54
  static GCArguments* arguments();
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    55
};
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    56
b786280276dc 8199925: Break out GC selection logic from GCArguments to GCConfig
pliden
parents:
diff changeset
    57
#endif // SHARE_GC_SHARED_GCCONFIG_HPP