src/hotspot/share/runtime/flags/jvmFlag.hpp
author dfuchs
Fri, 04 May 2018 17:28:03 +0100
branchhttp-client-branch
changeset 56532 a594484f54db
parent 49857 31e07291ae29
child 50196 85e3ac4fa57b
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
     1
/*
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
     2
 * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
     4
 *
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
     7
 * published by the Free Software Foundation.
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
     8
 *
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    13
 * accompanied this code).
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    14
 *
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    18
 *
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    21
 * questions.
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    22
 *
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    23
 */
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    24
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    25
#ifndef SHARE_VM_RUNTIME_FLAGS_JVMFLAG_HPP
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    26
#define SHARE_VM_RUNTIME_FLAGS_JVMFLAG_HPP
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    27
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    28
#include "utilities/globalDefinitions.hpp"
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    29
#include "utilities/macros.hpp"
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    30
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    31
// function type that will construct default range string
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    32
typedef const char* (*RangeStrFunc)(void);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    33
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    34
struct JVMFlag {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    35
  enum Flags {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    36
    // latest value origin
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    37
    DEFAULT          = 0,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    38
    COMMAND_LINE     = 1,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    39
    ENVIRON_VAR      = 2,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    40
    CONFIG_FILE      = 3,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    41
    MANAGEMENT       = 4,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    42
    ERGONOMIC        = 5,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    43
    ATTACH_ON_DEMAND = 6,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    44
    INTERNAL         = 7,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    45
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    46
    LAST_VALUE_ORIGIN = INTERNAL,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    47
    VALUE_ORIGIN_BITS = 4,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    48
    VALUE_ORIGIN_MASK = right_n_bits(VALUE_ORIGIN_BITS),
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    49
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    50
    // flag kind
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    51
    KIND_PRODUCT            = 1 << 4,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    52
    KIND_MANAGEABLE         = 1 << 5,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    53
    KIND_DIAGNOSTIC         = 1 << 6,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    54
    KIND_EXPERIMENTAL       = 1 << 7,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    55
    KIND_NOT_PRODUCT        = 1 << 8,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    56
    KIND_DEVELOP            = 1 << 9,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    57
    KIND_PLATFORM_DEPENDENT = 1 << 10,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    58
    KIND_READ_WRITE         = 1 << 11,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    59
    KIND_C1                 = 1 << 12,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    60
    KIND_C2                 = 1 << 13,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    61
    KIND_ARCH               = 1 << 14,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    62
    KIND_LP64_PRODUCT       = 1 << 15,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    63
    KIND_COMMERCIAL         = 1 << 16,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    64
    KIND_JVMCI              = 1 << 17,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    65
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    66
    // set this bit if the flag was set on the command line
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    67
    ORIG_COMMAND_LINE       = 1 << 18,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    68
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    69
    KIND_MASK = ~(VALUE_ORIGIN_MASK | ORIG_COMMAND_LINE)
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    70
  };
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    71
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    72
  enum Error {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    73
    // no error
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    74
    SUCCESS = 0,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    75
    // flag name is missing
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    76
    MISSING_NAME,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    77
    // flag value is missing
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    78
    MISSING_VALUE,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    79
    // error parsing the textual form of the value
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    80
    WRONG_FORMAT,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    81
    // flag is not writable
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    82
    NON_WRITABLE,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    83
    // flag value is outside of its bounds
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    84
    OUT_OF_BOUNDS,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    85
    // flag value violates its constraint
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    86
    VIOLATES_CONSTRAINT,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    87
    // there is no flag with the given name
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    88
    INVALID_FLAG,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    89
    // the flag can only be set only on command line during invocation of the VM
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    90
    COMMAND_LINE_ONLY,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    91
    // the flag may only be set once
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    92
    SET_ONLY_ONCE,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    93
    // the flag is not writable in this combination of product/debug build
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    94
    CONSTANT,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    95
    // other, unspecified error related to setting the flag
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    96
    ERR_OTHER
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    97
  };
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    98
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    99
  enum MsgType {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   100
    NONE = 0,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   101
    DIAGNOSTIC_FLAG_BUT_LOCKED,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   102
    EXPERIMENTAL_FLAG_BUT_LOCKED,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   103
    DEVELOPER_FLAG_BUT_PRODUCT_BUILD,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   104
    NOTPRODUCT_FLAG_BUT_PRODUCT_BUILD,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   105
    COMMERCIAL_FLAG_BUT_DISABLED,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   106
    COMMERCIAL_FLAG_BUT_LOCKED
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   107
  };
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   108
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   109
  const char* _type;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   110
  const char* _name;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   111
  void* _addr;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   112
  NOT_PRODUCT(const char* _doc;)
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   113
  Flags _flags;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   114
  size_t _name_len;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   115
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   116
  // points to all Flags static array
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   117
  static JVMFlag* flags;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   118
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   119
  // number of flags
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   120
  static size_t numFlags;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   121
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   122
  static JVMFlag* find_flag(const char* name) { return find_flag(name, strlen(name), true, true); };
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   123
  static JVMFlag* find_flag(const char* name, size_t length, bool allow_locked = false, bool return_flag = false);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   124
  static JVMFlag* fuzzy_match(const char* name, size_t length, bool allow_locked = false);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   125
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   126
  static const char* get_int_default_range_str();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   127
  static const char* get_uint_default_range_str();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   128
  static const char* get_intx_default_range_str();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   129
  static const char* get_uintx_default_range_str();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   130
  static const char* get_uint64_t_default_range_str();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   131
  static const char* get_size_t_default_range_str();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   132
  static const char* get_double_default_range_str();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   133
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   134
  JVMFlag::Error check_writable(bool changed);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   135
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   136
  bool is_bool() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   137
  bool get_bool() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   138
  JVMFlag::Error set_bool(bool value);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   139
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   140
  bool is_int() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   141
  int get_int() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   142
  JVMFlag::Error set_int(int value);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   143
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   144
  bool is_uint() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   145
  uint get_uint() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   146
  JVMFlag::Error set_uint(uint value);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   147
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   148
  bool is_intx() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   149
  intx get_intx() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   150
  JVMFlag::Error set_intx(intx value);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   151
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   152
  bool is_uintx() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   153
  uintx get_uintx() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   154
  JVMFlag::Error set_uintx(uintx value);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   155
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   156
  bool is_uint64_t() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   157
  uint64_t get_uint64_t() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   158
  JVMFlag::Error set_uint64_t(uint64_t value);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   159
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   160
  bool is_size_t() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   161
  size_t get_size_t() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   162
  JVMFlag::Error set_size_t(size_t value);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   163
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   164
  bool is_double() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   165
  double get_double() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   166
  JVMFlag::Error set_double(double value);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   167
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   168
  bool is_ccstr() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   169
  bool ccstr_accumulates() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   170
  ccstr get_ccstr() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   171
  JVMFlag::Error set_ccstr(ccstr value);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   172
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   173
  Flags get_origin();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   174
  void set_origin(Flags origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   175
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   176
  size_t get_name_length();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   177
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   178
  bool is_default();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   179
  bool is_ergonomic();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   180
  bool is_command_line();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   181
  void set_command_line();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   182
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   183
  bool is_product() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   184
  bool is_manageable() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   185
  bool is_diagnostic() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   186
  bool is_experimental() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   187
  bool is_notproduct() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   188
  bool is_develop() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   189
  bool is_read_write() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   190
  bool is_commercial() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   191
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   192
  bool is_constant_in_binary() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   193
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   194
  bool is_unlocker() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   195
  bool is_unlocked() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   196
  bool is_writeable() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   197
  bool is_external() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   198
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   199
  bool is_unlocker_ext() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   200
  bool is_unlocked_ext() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   201
  bool is_writeable_ext() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   202
  bool is_external_ext() const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   203
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   204
  void clear_diagnostic();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   205
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   206
  JVMFlag::MsgType get_locked_message(char*, int) const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   207
  JVMFlag::MsgType get_locked_message_ext(char*, int) const;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   208
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   209
  // printRanges will print out flags type, name and range values as expected by -XX:+PrintFlagsRanges
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   210
  void print_on(outputStream* st, bool withComments = false, bool printRanges = false);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   211
  void print_kind(outputStream* st, unsigned int width);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   212
  void print_origin(outputStream* st, unsigned int width);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   213
  void print_as_flag(outputStream* st);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   214
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   215
  static const char* flag_error_str(JVMFlag::Error error);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   216
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   217
public:
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   218
  static JVMFlag::Error boolAt(const char* name, size_t len, bool* value, bool allow_locked = false, bool return_flag = false);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   219
  static JVMFlag::Error boolAt(const char* name, bool* value, bool allow_locked = false, bool return_flag = false)      { return boolAt(name, strlen(name), value, allow_locked, return_flag); }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   220
  static JVMFlag::Error boolAtPut(JVMFlag* flag, bool* value, JVMFlag::Flags origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   221
  static JVMFlag::Error boolAtPut(const char* name, size_t len, bool* value, JVMFlag::Flags origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   222
  static JVMFlag::Error boolAtPut(const char* name, bool* value, JVMFlag::Flags origin)   { return boolAtPut(name, strlen(name), value, origin); }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   223
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   224
  static JVMFlag::Error intAt(const char* name, size_t len, int* value, bool allow_locked = false, bool return_flag = false);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   225
  static JVMFlag::Error intAt(const char* name, int* value, bool allow_locked = false, bool return_flag = false)      { return intAt(name, strlen(name), value, allow_locked, return_flag); }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   226
  static JVMFlag::Error intAtPut(JVMFlag* flag, int* value, JVMFlag::Flags origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   227
  static JVMFlag::Error intAtPut(const char* name, size_t len, int* value, JVMFlag::Flags origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   228
  static JVMFlag::Error intAtPut(const char* name, int* value, JVMFlag::Flags origin)   { return intAtPut(name, strlen(name), value, origin); }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   229
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   230
  static JVMFlag::Error uintAt(const char* name, size_t len, uint* value, bool allow_locked = false, bool return_flag = false);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   231
  static JVMFlag::Error uintAt(const char* name, uint* value, bool allow_locked = false, bool return_flag = false)      { return uintAt(name, strlen(name), value, allow_locked, return_flag); }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   232
  static JVMFlag::Error uintAtPut(JVMFlag* flag, uint* value, JVMFlag::Flags origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   233
  static JVMFlag::Error uintAtPut(const char* name, size_t len, uint* value, JVMFlag::Flags origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   234
  static JVMFlag::Error uintAtPut(const char* name, uint* value, JVMFlag::Flags origin)   { return uintAtPut(name, strlen(name), value, origin); }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   235
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   236
  static JVMFlag::Error intxAt(const char* name, size_t len, intx* value, bool allow_locked = false, bool return_flag = false);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   237
  static JVMFlag::Error intxAt(const char* name, intx* value, bool allow_locked = false, bool return_flag = false)      { return intxAt(name, strlen(name), value, allow_locked, return_flag); }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   238
  static JVMFlag::Error intxAtPut(JVMFlag* flag, intx* value, JVMFlag::Flags origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   239
  static JVMFlag::Error intxAtPut(const char* name, size_t len, intx* value, JVMFlag::Flags origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   240
  static JVMFlag::Error intxAtPut(const char* name, intx* value, JVMFlag::Flags origin)   { return intxAtPut(name, strlen(name), value, origin); }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   241
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   242
  static JVMFlag::Error uintxAt(const char* name, size_t len, uintx* value, bool allow_locked = false, bool return_flag = false);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   243
  static JVMFlag::Error uintxAt(const char* name, uintx* value, bool allow_locked = false, bool return_flag = false)    { return uintxAt(name, strlen(name), value, allow_locked, return_flag); }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   244
  static JVMFlag::Error uintxAtPut(JVMFlag* flag, uintx* value, JVMFlag::Flags origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   245
  static JVMFlag::Error uintxAtPut(const char* name, size_t len, uintx* value, JVMFlag::Flags origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   246
  static JVMFlag::Error uintxAtPut(const char* name, uintx* value, JVMFlag::Flags origin) { return uintxAtPut(name, strlen(name), value, origin); }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   247
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   248
  static JVMFlag::Error size_tAt(const char* name, size_t len, size_t* value, bool allow_locked = false, bool return_flag = false);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   249
  static JVMFlag::Error size_tAt(const char* name, size_t* value, bool allow_locked = false, bool return_flag = false)    { return size_tAt(name, strlen(name), value, allow_locked, return_flag); }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   250
  static JVMFlag::Error size_tAtPut(JVMFlag* flag, size_t* value, JVMFlag::Flags origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   251
  static JVMFlag::Error size_tAtPut(const char* name, size_t len, size_t* value, JVMFlag::Flags origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   252
  static JVMFlag::Error size_tAtPut(const char* name, size_t* value, JVMFlag::Flags origin) { return size_tAtPut(name, strlen(name), value, origin); }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   253
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   254
  static JVMFlag::Error uint64_tAt(const char* name, size_t len, uint64_t* value, bool allow_locked = false, bool return_flag = false);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   255
  static JVMFlag::Error uint64_tAt(const char* name, uint64_t* value, bool allow_locked = false, bool return_flag = false) { return uint64_tAt(name, strlen(name), value, allow_locked, return_flag); }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   256
  static JVMFlag::Error uint64_tAtPut(JVMFlag* flag, uint64_t* value, JVMFlag::Flags origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   257
  static JVMFlag::Error uint64_tAtPut(const char* name, size_t len, uint64_t* value, JVMFlag::Flags origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   258
  static JVMFlag::Error uint64_tAtPut(const char* name, uint64_t* value, JVMFlag::Flags origin) { return uint64_tAtPut(name, strlen(name), value, origin); }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   259
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   260
  static JVMFlag::Error doubleAt(const char* name, size_t len, double* value, bool allow_locked = false, bool return_flag = false);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   261
  static JVMFlag::Error doubleAt(const char* name, double* value, bool allow_locked = false, bool return_flag = false)    { return doubleAt(name, strlen(name), value, allow_locked, return_flag); }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   262
  static JVMFlag::Error doubleAtPut(JVMFlag* flag, double* value, JVMFlag::Flags origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   263
  static JVMFlag::Error doubleAtPut(const char* name, size_t len, double* value, JVMFlag::Flags origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   264
  static JVMFlag::Error doubleAtPut(const char* name, double* value, JVMFlag::Flags origin) { return doubleAtPut(name, strlen(name), value, origin); }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   265
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   266
  static JVMFlag::Error ccstrAt(const char* name, size_t len, ccstr* value, bool allow_locked = false, bool return_flag = false);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   267
  static JVMFlag::Error ccstrAt(const char* name, ccstr* value, bool allow_locked = false, bool return_flag = false)    { return ccstrAt(name, strlen(name), value, allow_locked, return_flag); }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   268
  // Contract:  JVMFlag will make private copy of the incoming value.
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   269
  // Outgoing value is always malloc-ed, and caller MUST call free.
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   270
  static JVMFlag::Error ccstrAtPut(const char* name, size_t len, ccstr* value, JVMFlag::Flags origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   271
  static JVMFlag::Error ccstrAtPut(const char* name, ccstr* value, JVMFlag::Flags origin) { return ccstrAtPut(name, strlen(name), value, origin); }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   272
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   273
  // Returns false if name is not a command line flag.
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   274
  static bool wasSetOnCmdline(const char* name, bool* value);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   275
  static void printSetFlags(outputStream* out);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   276
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   277
  // printRanges will print out flags type, name and range values as expected by -XX:+PrintFlagsRanges
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   278
  static void printFlags(outputStream* out, bool withComments, bool printRanges = false);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   279
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   280
  static void verify() PRODUCT_RETURN;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   281
};
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   282
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   283
#endif // SHARE_VM_RUNTIME_FLAGS_JVMFLAG_HPP