src/hotspot/share/runtime/flags/jvmFlag.cpp
author dfuchs
Fri, 04 May 2018 17:28:03 +0100
branchhttp-client-branch
changeset 56532 a594484f54db
parent 49857 31e07291ae29
child 50113 caf115bb98ad
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
#include "precompiled.hpp"
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    26
#include "memory/allocation.inline.hpp"
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    27
#include "runtime/arguments.hpp"
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    28
#include "runtime/flags/jvmFlag.hpp"
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    29
#include "runtime/flags/jvmFlagConstraintList.hpp"
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    30
#include "runtime/flags/jvmFlagWriteableList.hpp"
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    31
#include "runtime/flags/jvmFlagRangeList.hpp"
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    32
#include "runtime/globals_extension.hpp"
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    33
#include "trace/tracing.hpp"
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    34
#include "utilities/defaultStream.hpp"
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    35
#include "utilities/stringUtils.hpp"
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    36
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    37
#define DEFAULT_RANGE_STR_CHUNK_SIZE 64
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    38
static char* create_range_str(const char *fmt, ...) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    39
  static size_t string_length = DEFAULT_RANGE_STR_CHUNK_SIZE;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    40
  static char* range_string = NEW_C_HEAP_ARRAY(char, string_length, mtLogging);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    41
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    42
  int size_needed = 0;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    43
  do {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    44
    va_list args;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    45
    va_start(args, fmt);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    46
    size_needed = jio_vsnprintf(range_string, string_length, fmt, args);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    47
    va_end(args);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    48
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    49
    if (size_needed < 0) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    50
      string_length += DEFAULT_RANGE_STR_CHUNK_SIZE;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    51
      range_string = REALLOC_C_HEAP_ARRAY(char, range_string, string_length, mtLogging);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    52
      guarantee(range_string != NULL, "create_range_str string should not be NULL");
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    53
    }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    54
  } while (size_needed < 0);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    55
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    56
  return range_string;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    57
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    58
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    59
const char* JVMFlag::get_int_default_range_str() {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    60
  return create_range_str("[ " INT32_FORMAT_W(-25) " ... " INT32_FORMAT_W(25) " ]", INT_MIN, INT_MAX);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    61
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    62
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    63
const char* JVMFlag::get_uint_default_range_str() {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    64
  return create_range_str("[ " UINT32_FORMAT_W(-25) " ... " UINT32_FORMAT_W(25) " ]", 0, UINT_MAX);
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
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    67
const char* JVMFlag::get_intx_default_range_str() {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    68
  return create_range_str("[ " INTX_FORMAT_W(-25) " ... " INTX_FORMAT_W(25) " ]", min_intx, max_intx);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    69
}
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
const char* JVMFlag::get_uintx_default_range_str() {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    72
  return create_range_str("[ " UINTX_FORMAT_W(-25) " ... " UINTX_FORMAT_W(25) " ]", 0, max_uintx);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    73
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    74
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    75
const char* JVMFlag::get_uint64_t_default_range_str() {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    76
  return create_range_str("[ " UINT64_FORMAT_W(-25) " ... " UINT64_FORMAT_W(25) " ]", 0, uint64_t(max_juint));
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    77
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    78
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    79
const char* JVMFlag::get_size_t_default_range_str() {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    80
  return create_range_str("[ " SIZE_FORMAT_W(-25) " ... " SIZE_FORMAT_W(25) " ]", 0, SIZE_MAX);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    81
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    82
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    83
const char* JVMFlag::get_double_default_range_str() {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    84
  return create_range_str("[ %-25.3f ... %25.3f ]", DBL_MIN, DBL_MAX);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    85
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    86
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    87
static bool is_product_build() {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    88
#ifdef PRODUCT
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    89
  return true;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    90
#else
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    91
  return false;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    92
#endif
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    93
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    94
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    95
JVMFlag::Error JVMFlag::check_writable(bool changed) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    96
  if (is_constant_in_binary()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
    97
    fatal("flag is constant: %s", _name);
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
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   100
  JVMFlag::Error error = JVMFlag::SUCCESS;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   101
  if (changed) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   102
    JVMFlagWriteable* writeable = JVMFlagWriteableList::find(_name);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   103
    if (writeable) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   104
      if (writeable->is_writeable() == false) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   105
        switch (writeable->type())
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   106
        {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   107
          case JVMFlagWriteable::Once:
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   108
            error = JVMFlag::SET_ONLY_ONCE;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   109
            jio_fprintf(defaultStream::error_stream(), "Error: %s may not be set more than once\n", _name);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   110
            break;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   111
          case JVMFlagWriteable::CommandLineOnly:
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   112
            error = JVMFlag::COMMAND_LINE_ONLY;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   113
            jio_fprintf(defaultStream::error_stream(), "Error: %s may be modified only from commad line\n", _name);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   114
            break;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   115
          default:
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   116
            ShouldNotReachHere();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   117
            break;
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
      }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   120
      writeable->mark_once();
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
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   123
  return error;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   124
}
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
bool JVMFlag::is_bool() const {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   127
  return strcmp(_type, "bool") == 0;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   128
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   129
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   130
bool JVMFlag::get_bool() const {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   131
  return *((bool*) _addr);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   132
}
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 JVMFlag::set_bool(bool value) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   135
  JVMFlag::Error error = check_writable(value!=get_bool());
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   136
  if (error == JVMFlag::SUCCESS) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   137
    *((bool*) _addr) = value;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   138
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   139
  return error;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   140
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   141
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   142
bool JVMFlag::is_int() const {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   143
  return strcmp(_type, "int")  == 0;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   144
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   145
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   146
int JVMFlag::get_int() const {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   147
  return *((int*) _addr);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   148
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   149
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   150
JVMFlag::Error JVMFlag::set_int(int value) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   151
  JVMFlag::Error error = check_writable(value!=get_int());
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   152
  if (error == JVMFlag::SUCCESS) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   153
    *((int*) _addr) = value;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   154
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   155
  return error;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   156
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   157
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   158
bool JVMFlag::is_uint() const {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   159
  return strcmp(_type, "uint")  == 0;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   160
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   161
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   162
uint JVMFlag::get_uint() const {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   163
  return *((uint*) _addr);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   164
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   165
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   166
JVMFlag::Error JVMFlag::set_uint(uint value) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   167
  JVMFlag::Error error = check_writable(value!=get_uint());
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   168
  if (error == JVMFlag::SUCCESS) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   169
    *((uint*) _addr) = value;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   170
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   171
  return error;
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
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   174
bool JVMFlag::is_intx() const {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   175
  return strcmp(_type, "intx")  == 0;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   176
}
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
intx JVMFlag::get_intx() const {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   179
  return *((intx*) _addr);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   180
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   181
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   182
JVMFlag::Error JVMFlag::set_intx(intx value) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   183
  JVMFlag::Error error = check_writable(value!=get_intx());
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   184
  if (error == JVMFlag::SUCCESS) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   185
    *((intx*) _addr) = value;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   186
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   187
  return error;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   188
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   189
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   190
bool JVMFlag::is_uintx() const {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   191
  return strcmp(_type, "uintx") == 0;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   192
}
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
uintx JVMFlag::get_uintx() const {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   195
  return *((uintx*) _addr);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   196
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   197
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   198
JVMFlag::Error JVMFlag::set_uintx(uintx value) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   199
  JVMFlag::Error error = check_writable(value!=get_uintx());
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   200
  if (error == JVMFlag::SUCCESS) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   201
    *((uintx*) _addr) = value;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   202
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   203
  return error;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   204
}
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
bool JVMFlag::is_uint64_t() const {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   207
  return strcmp(_type, "uint64_t") == 0;
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
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   210
uint64_t JVMFlag::get_uint64_t() const {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   211
  return *((uint64_t*) _addr);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   212
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   213
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   214
JVMFlag::Error JVMFlag::set_uint64_t(uint64_t value) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   215
  JVMFlag::Error error = check_writable(value!=get_uint64_t());
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   216
  if (error == JVMFlag::SUCCESS) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   217
    *((uint64_t*) _addr) = value;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   218
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   219
  return error;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   220
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   221
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   222
bool JVMFlag::is_size_t() const {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   223
  return strcmp(_type, "size_t") == 0;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   224
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   225
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   226
size_t JVMFlag::get_size_t() const {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   227
  return *((size_t*) _addr);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   228
}
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
JVMFlag::Error JVMFlag::set_size_t(size_t value) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   231
  JVMFlag::Error error = check_writable(value!=get_size_t());
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   232
  if (error == JVMFlag::SUCCESS) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   233
    *((size_t*) _addr) = value;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   234
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   235
  return error;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   236
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   237
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   238
bool JVMFlag::is_double() const {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   239
  return strcmp(_type, "double") == 0;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   240
}
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
double JVMFlag::get_double() const {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   243
  return *((double*) _addr);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   244
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   245
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   246
JVMFlag::Error JVMFlag::set_double(double value) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   247
  JVMFlag::Error error = check_writable(value!=get_double());
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   248
  if (error == JVMFlag::SUCCESS) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   249
    *((double*) _addr) = value;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   250
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   251
  return error;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   252
}
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
bool JVMFlag::is_ccstr() const {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   255
  return strcmp(_type, "ccstr") == 0 || strcmp(_type, "ccstrlist") == 0;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   256
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   257
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   258
bool JVMFlag::ccstr_accumulates() const {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   259
  return strcmp(_type, "ccstrlist") == 0;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   260
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   261
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   262
ccstr JVMFlag::get_ccstr() const {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   263
  return *((ccstr*) _addr);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   264
}
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
JVMFlag::Error JVMFlag::set_ccstr(ccstr value) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   267
  JVMFlag::Error error = check_writable(value!=get_ccstr());
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   268
  if (error == JVMFlag::SUCCESS) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   269
    *((ccstr*) _addr) = value;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   270
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   271
  return error;
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
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   274
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   275
JVMFlag::Flags JVMFlag::get_origin() {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   276
  return Flags(_flags & VALUE_ORIGIN_MASK);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   277
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   278
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   279
void JVMFlag::set_origin(Flags origin) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   280
  assert((origin & VALUE_ORIGIN_MASK) == origin, "sanity");
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   281
  Flags new_origin = Flags((origin == COMMAND_LINE) ? Flags(origin | ORIG_COMMAND_LINE) : origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   282
  _flags = Flags((_flags & ~VALUE_ORIGIN_MASK) | new_origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   283
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   284
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   285
bool JVMFlag::is_default() {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   286
  return (get_origin() == DEFAULT);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   287
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   288
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   289
bool JVMFlag::is_ergonomic() {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   290
  return (get_origin() == ERGONOMIC);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   291
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   292
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   293
bool JVMFlag::is_command_line() {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   294
  return (_flags & ORIG_COMMAND_LINE) != 0;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   295
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   296
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   297
void JVMFlag::set_command_line() {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   298
  _flags = Flags(_flags | ORIG_COMMAND_LINE);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   299
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   300
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   301
bool JVMFlag::is_product() const {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   302
  return (_flags & KIND_PRODUCT) != 0;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   303
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   304
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   305
bool JVMFlag::is_manageable() const {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   306
  return (_flags & KIND_MANAGEABLE) != 0;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   307
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   308
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   309
bool JVMFlag::is_diagnostic() const {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   310
  return (_flags & KIND_DIAGNOSTIC) != 0;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   311
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   312
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   313
bool JVMFlag::is_experimental() const {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   314
  return (_flags & KIND_EXPERIMENTAL) != 0;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   315
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   316
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   317
bool JVMFlag::is_notproduct() const {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   318
  return (_flags & KIND_NOT_PRODUCT) != 0;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   319
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   320
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   321
bool JVMFlag::is_develop() const {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   322
  return (_flags & KIND_DEVELOP) != 0;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   323
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   324
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   325
bool JVMFlag::is_read_write() const {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   326
  return (_flags & KIND_READ_WRITE) != 0;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   327
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   328
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   329
bool JVMFlag::is_commercial() const {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   330
  return (_flags & KIND_COMMERCIAL) != 0;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   331
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   332
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   333
/**
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   334
 * Returns if this flag is a constant in the binary.  Right now this is
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   335
 * true for notproduct and develop flags in product builds.
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   336
 */
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   337
bool JVMFlag::is_constant_in_binary() const {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   338
#ifdef PRODUCT
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   339
  return is_notproduct() || is_develop();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   340
#else
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   341
  return false;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   342
#endif
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   343
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   344
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   345
bool JVMFlag::is_unlocker() const {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   346
  return strcmp(_name, "UnlockDiagnosticVMOptions") == 0     ||
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   347
  strcmp(_name, "UnlockExperimentalVMOptions") == 0   ||
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   348
  is_unlocker_ext();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   349
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   350
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   351
bool JVMFlag::is_unlocked() const {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   352
  if (is_diagnostic()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   353
    return UnlockDiagnosticVMOptions;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   354
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   355
  if (is_experimental()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   356
    return UnlockExperimentalVMOptions;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   357
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   358
  return is_unlocked_ext();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   359
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   360
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   361
void JVMFlag::clear_diagnostic() {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   362
  assert(is_diagnostic(), "sanity");
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   363
  _flags = Flags(_flags & ~KIND_DIAGNOSTIC);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   364
  assert(!is_diagnostic(), "sanity");
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   365
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   366
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   367
// Get custom message for this locked flag, or NULL if
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   368
// none is available. Returns message type produced.
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   369
JVMFlag::MsgType JVMFlag::get_locked_message(char* buf, int buflen) const {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   370
  buf[0] = '\0';
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   371
  if (is_diagnostic() && !is_unlocked()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   372
    jio_snprintf(buf, buflen,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   373
                 "Error: VM option '%s' is diagnostic and must be enabled via -XX:+UnlockDiagnosticVMOptions.\n"
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   374
                 "Error: The unlock option must precede '%s'.\n",
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   375
                 _name, _name);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   376
    return JVMFlag::DIAGNOSTIC_FLAG_BUT_LOCKED;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   377
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   378
  if (is_experimental() && !is_unlocked()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   379
    jio_snprintf(buf, buflen,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   380
                 "Error: VM option '%s' is experimental and must be enabled via -XX:+UnlockExperimentalVMOptions.\n"
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   381
                 "Error: The unlock option must precede '%s'.\n",
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   382
                 _name, _name);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   383
    return JVMFlag::EXPERIMENTAL_FLAG_BUT_LOCKED;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   384
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   385
  if (is_develop() && is_product_build()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   386
    jio_snprintf(buf, buflen, "Error: VM option '%s' is develop and is available only in debug version of VM.\n",
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   387
                 _name);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   388
    return JVMFlag::DEVELOPER_FLAG_BUT_PRODUCT_BUILD;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   389
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   390
  if (is_notproduct() && is_product_build()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   391
    jio_snprintf(buf, buflen, "Error: VM option '%s' is notproduct and is available only in debug version of VM.\n",
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   392
                 _name);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   393
    return JVMFlag::NOTPRODUCT_FLAG_BUT_PRODUCT_BUILD;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   394
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   395
  return get_locked_message_ext(buf, buflen);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   396
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   397
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   398
bool JVMFlag::is_writeable() const {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   399
  return is_manageable() || (is_product() && is_read_write()) || is_writeable_ext();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   400
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   401
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   402
// All flags except "manageable" are assumed to be internal flags.
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   403
// Long term, we need to define a mechanism to specify which flags
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   404
// are external/stable and change this function accordingly.
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   405
bool JVMFlag::is_external() const {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   406
  return is_manageable() || is_external_ext();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   407
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   408
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   409
// Helper function for JVMFlag::print_on().
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   410
// Fills current line up to requested position.
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   411
// Should the current position already be past the requested position,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   412
// one separator blank is enforced.
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   413
void fill_to_pos(outputStream* st, unsigned int req_pos) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   414
  if ((unsigned int)st->position() < req_pos) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   415
    st->fill_to(req_pos);  // need to fill with blanks to reach req_pos
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   416
  } else {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   417
    st->print(" ");        // enforce blank separation. Previous field too long.
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   418
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   419
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   420
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   421
void JVMFlag::print_on(outputStream* st, bool withComments, bool printRanges) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   422
  // Don't print notproduct and develop flags in a product build.
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   423
  if (is_constant_in_binary()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   424
    return;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   425
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   426
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   427
  if (!printRanges) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   428
    // The command line options -XX:+PrintFlags* cause this function to be called
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   429
    // for each existing flag to print information pertinent to this flag. The data
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   430
    // is displayed in columnar form, with the following layout:
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   431
    //  col1 - data type, right-justified
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   432
    //  col2 - name,      left-justified
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   433
    //  col3 - ' ='       double-char, leading space to align with possible '+='
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   434
    //  col4 - value      left-justified
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   435
    //  col5 - kind       right-justified
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   436
    //  col6 - origin     left-justified
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   437
    //  col7 - comments   left-justified
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   438
    //
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   439
    //  The column widths are fixed. They are defined such that, for most cases,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   440
    //  an eye-pleasing tabular output is created.
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   441
    //
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   442
    //  Sample output:
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   443
    //       bool CMSScavengeBeforeRemark                  = false                                     {product} {default}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   444
    //      uintx CMSScheduleRemarkEdenPenetration         = 50                                        {product} {default}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   445
    //     size_t CMSScheduleRemarkEdenSizeThreshold       = 2097152                                   {product} {default}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   446
    //      uintx CMSScheduleRemarkSamplingRatio           = 5                                         {product} {default}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   447
    //     double CMSSmallCoalSurplusPercent               = 1.050000                                  {product} {default}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   448
    //      ccstr CompileCommandFile                       = MyFile.cmd                                {product} {command line}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   449
    //  ccstrlist CompileOnly                              = Method1
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   450
    //            CompileOnly                             += Method2                                   {product} {command line}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   451
    //  |         |                                       |  |                              |                    |               |
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   452
    //  |         |                                       |  |                              |                    |               +-- col7
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   453
    //  |         |                                       |  |                              |                    +-- col6
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   454
    //  |         |                                       |  |                              +-- col5
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   455
    //  |         |                                       |  +-- col4
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   456
    //  |         |                                       +-- col3
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   457
    //  |         +-- col2
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   458
    //  +-- col1
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   459
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   460
    const unsigned int col_spacing = 1;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   461
    const unsigned int col1_pos    = 0;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   462
    const unsigned int col1_width  = 9;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   463
    const unsigned int col2_pos    = col1_pos + col1_width + col_spacing;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   464
    const unsigned int col2_width  = 39;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   465
    const unsigned int col3_pos    = col2_pos + col2_width + col_spacing;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   466
    const unsigned int col3_width  = 2;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   467
    const unsigned int col4_pos    = col3_pos + col3_width + col_spacing;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   468
    const unsigned int col4_width  = 30;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   469
    const unsigned int col5_pos    = col4_pos + col4_width + col_spacing;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   470
    const unsigned int col5_width  = 20;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   471
    const unsigned int col6_pos    = col5_pos + col5_width + col_spacing;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   472
    const unsigned int col6_width  = 15;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   473
    const unsigned int col7_pos    = col6_pos + col6_width + col_spacing;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   474
    const unsigned int col7_width  = 1;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   475
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   476
    st->fill_to(col1_pos);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   477
    st->print("%*s", col1_width, _type);  // right-justified, therefore width is required.
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   478
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   479
    fill_to_pos(st, col2_pos);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   480
    st->print("%s", _name);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   481
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   482
    fill_to_pos(st, col3_pos);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   483
    st->print(" =");  // use " =" for proper alignment with multiline ccstr output.
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   484
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   485
    fill_to_pos(st, col4_pos);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   486
    if (is_bool()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   487
      st->print("%s", get_bool() ? "true" : "false");
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   488
    } else if (is_int()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   489
      st->print("%d", get_int());
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   490
    } else if (is_uint()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   491
      st->print("%u", get_uint());
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   492
    } else if (is_intx()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   493
      st->print(INTX_FORMAT, get_intx());
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   494
    } else if (is_uintx()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   495
      st->print(UINTX_FORMAT, get_uintx());
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   496
    } else if (is_uint64_t()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   497
      st->print(UINT64_FORMAT, get_uint64_t());
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   498
    } else if (is_size_t()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   499
      st->print(SIZE_FORMAT, get_size_t());
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   500
    } else if (is_double()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   501
      st->print("%f", get_double());
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   502
    } else if (is_ccstr()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   503
      // Honor <newline> characters in ccstr: print multiple lines.
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   504
      const char* cp = get_ccstr();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   505
      if (cp != NULL) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   506
        const char* eol;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   507
        while ((eol = strchr(cp, '\n')) != NULL) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   508
          size_t llen = pointer_delta(eol, cp, sizeof(char));
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   509
          st->print("%.*s", (int)llen, cp);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   510
          st->cr();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   511
          cp = eol+1;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   512
          fill_to_pos(st, col2_pos);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   513
          st->print("%s", _name);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   514
          fill_to_pos(st, col3_pos);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   515
          st->print("+=");
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   516
          fill_to_pos(st, col4_pos);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   517
        }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   518
        st->print("%s", cp);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   519
      }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   520
    } else {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   521
      st->print("unhandled  type %s", _type);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   522
      st->cr();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   523
      return;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   524
    }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   525
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   526
    fill_to_pos(st, col5_pos);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   527
    print_kind(st, col5_width);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   528
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   529
    fill_to_pos(st, col6_pos);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   530
    print_origin(st, col6_width);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   531
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   532
#ifndef PRODUCT
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   533
    if (withComments) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   534
      fill_to_pos(st, col7_pos);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   535
      st->print("%s", _doc);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   536
    }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   537
#endif
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   538
    st->cr();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   539
  } else if (!is_bool() && !is_ccstr()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   540
    // The command line options -XX:+PrintFlags* cause this function to be called
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   541
    // for each existing flag to print information pertinent to this flag. The data
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   542
    // is displayed in columnar form, with the following layout:
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   543
    //  col1 - data type, right-justified
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   544
    //  col2 - name,      left-justified
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   545
    //  col4 - range      [ min ... max]
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   546
    //  col5 - kind       right-justified
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   547
    //  col6 - origin     left-justified
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   548
    //  col7 - comments   left-justified
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   549
    //
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   550
    //  The column widths are fixed. They are defined such that, for most cases,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   551
    //  an eye-pleasing tabular output is created.
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   552
    //
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   553
    //  Sample output:
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   554
    //       intx MinPassesBeforeFlush                               [ 0                         ...       9223372036854775807 ]                         {diagnostic} {default}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   555
    //      uintx MinRAMFraction                                     [ 1                         ...      18446744073709551615 ]                            {product} {default}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   556
    //     double MinRAMPercentage                                   [ 0.000                     ...                   100.000 ]                            {product} {default}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   557
    //      uintx MinSurvivorRatio                                   [ 3                         ...      18446744073709551615 ]                            {product} {default}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   558
    //     size_t MinTLABSize                                        [ 1                         ...       9223372036854775807 ]                            {product} {default}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   559
    //       intx MonitorBound                                       [ 0                         ...                2147483647 ]                            {product} {default}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   560
    //  |         |                                                  |                                                           |                                    |               |
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   561
    //  |         |                                                  |                                                           |                                    |               +-- col7
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   562
    //  |         |                                                  |                                                           |                                    +-- col6
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   563
    //  |         |                                                  |                                                           +-- col5
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   564
    //  |         |                                                  +-- col4
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   565
    //  |         +-- col2
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   566
    //  +-- col1
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   567
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   568
    const unsigned int col_spacing = 1;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   569
    const unsigned int col1_pos    = 0;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   570
    const unsigned int col1_width  = 9;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   571
    const unsigned int col2_pos    = col1_pos + col1_width + col_spacing;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   572
    const unsigned int col2_width  = 49;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   573
    const unsigned int col3_pos    = col2_pos + col2_width + col_spacing;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   574
    const unsigned int col3_width  = 0;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   575
    const unsigned int col4_pos    = col3_pos + col3_width + col_spacing;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   576
    const unsigned int col4_width  = 60;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   577
    const unsigned int col5_pos    = col4_pos + col4_width + col_spacing;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   578
    const unsigned int col5_width  = 35;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   579
    const unsigned int col6_pos    = col5_pos + col5_width + col_spacing;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   580
    const unsigned int col6_width  = 15;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   581
    const unsigned int col7_pos    = col6_pos + col6_width + col_spacing;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   582
    const unsigned int col7_width  = 1;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   583
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   584
    st->fill_to(col1_pos);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   585
    st->print("%*s", col1_width, _type);  // right-justified, therefore width is required.
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   586
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   587
    fill_to_pos(st, col2_pos);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   588
    st->print("%s", _name);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   589
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   590
    fill_to_pos(st, col4_pos);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   591
    RangeStrFunc func = NULL;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   592
    if (is_int()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   593
      func = JVMFlag::get_int_default_range_str;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   594
    } else if (is_uint()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   595
      func = JVMFlag::get_uint_default_range_str;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   596
    } else if (is_intx()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   597
      func = JVMFlag::get_intx_default_range_str;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   598
    } else if (is_uintx()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   599
      func = JVMFlag::get_uintx_default_range_str;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   600
    } else if (is_uint64_t()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   601
      func = JVMFlag::get_uint64_t_default_range_str;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   602
    } else if (is_size_t()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   603
      func = JVMFlag::get_size_t_default_range_str;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   604
    } else if (is_double()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   605
      func = JVMFlag::get_double_default_range_str;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   606
    } else {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   607
      st->print("unhandled  type %s", _type);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   608
      st->cr();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   609
      return;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   610
    }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   611
    JVMFlagRangeList::print(st, _name, func);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   612
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   613
    fill_to_pos(st, col5_pos);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   614
    print_kind(st, col5_width);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   615
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   616
    fill_to_pos(st, col6_pos);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   617
    print_origin(st, col6_width);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   618
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   619
#ifndef PRODUCT
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   620
    if (withComments) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   621
      fill_to_pos(st, col7_pos);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   622
      st->print("%s", _doc);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   623
    }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   624
#endif
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   625
    st->cr();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   626
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   627
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   628
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   629
void JVMFlag::print_kind(outputStream* st, unsigned int width) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   630
  struct Data {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   631
    int flag;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   632
    const char* name;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   633
  };
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   634
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   635
  Data data[] = {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   636
    { KIND_JVMCI, "JVMCI" },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   637
    { KIND_C1, "C1" },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   638
    { KIND_C2, "C2" },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   639
    { KIND_ARCH, "ARCH" },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   640
    { KIND_PLATFORM_DEPENDENT, "pd" },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   641
    { KIND_PRODUCT, "product" },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   642
    { KIND_MANAGEABLE, "manageable" },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   643
    { KIND_DIAGNOSTIC, "diagnostic" },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   644
    { KIND_EXPERIMENTAL, "experimental" },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   645
    { KIND_COMMERCIAL, "commercial" },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   646
    { KIND_NOT_PRODUCT, "notproduct" },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   647
    { KIND_DEVELOP, "develop" },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   648
    { KIND_LP64_PRODUCT, "lp64_product" },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   649
    { KIND_READ_WRITE, "rw" },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   650
    { -1, "" }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   651
  };
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   652
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   653
  if ((_flags & KIND_MASK) != 0) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   654
    bool is_first = true;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   655
    const size_t buffer_size = 64;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   656
    size_t buffer_used = 0;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   657
    char kind[buffer_size];
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   658
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   659
    jio_snprintf(kind, buffer_size, "{");
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   660
    buffer_used++;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   661
    for (int i = 0; data[i].flag != -1; i++) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   662
      Data d = data[i];
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   663
      if ((_flags & d.flag) != 0) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   664
        if (is_first) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   665
          is_first = false;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   666
        } else {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   667
          assert(buffer_used + 1 < buffer_size, "Too small buffer");
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   668
          jio_snprintf(kind + buffer_used, buffer_size - buffer_used, " ");
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   669
          buffer_used++;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   670
        }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   671
        size_t length = strlen(d.name);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   672
        assert(buffer_used + length < buffer_size, "Too small buffer");
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   673
        jio_snprintf(kind + buffer_used, buffer_size - buffer_used, "%s", d.name);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   674
        buffer_used += length;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   675
      }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   676
    }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   677
    assert(buffer_used + 2 <= buffer_size, "Too small buffer");
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   678
    jio_snprintf(kind + buffer_used, buffer_size - buffer_used, "}");
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   679
    st->print("%*s", width, kind);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   680
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   681
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   682
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   683
void JVMFlag::print_origin(outputStream* st, unsigned int width) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   684
  int origin = _flags & VALUE_ORIGIN_MASK;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   685
  st->print("{");
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   686
  switch(origin) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   687
    case DEFAULT:
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   688
      st->print("default"); break;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   689
    case COMMAND_LINE:
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   690
      st->print("command line"); break;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   691
    case ENVIRON_VAR:
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   692
      st->print("environment"); break;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   693
    case CONFIG_FILE:
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   694
      st->print("config file"); break;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   695
    case MANAGEMENT:
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   696
      st->print("management"); break;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   697
    case ERGONOMIC:
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   698
      if (_flags & ORIG_COMMAND_LINE) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   699
        st->print("command line, ");
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   700
      }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   701
      st->print("ergonomic"); break;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   702
    case ATTACH_ON_DEMAND:
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   703
      st->print("attach"); break;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   704
    case INTERNAL:
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   705
      st->print("internal"); break;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   706
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   707
  st->print("}");
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   708
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   709
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   710
void JVMFlag::print_as_flag(outputStream* st) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   711
  if (is_bool()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   712
    st->print("-XX:%s%s", get_bool() ? "+" : "-", _name);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   713
  } else if (is_int()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   714
    st->print("-XX:%s=%d", _name, get_int());
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   715
  } else if (is_uint()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   716
    st->print("-XX:%s=%u", _name, get_uint());
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   717
  } else if (is_intx()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   718
    st->print("-XX:%s=" INTX_FORMAT, _name, get_intx());
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   719
  } else if (is_uintx()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   720
    st->print("-XX:%s=" UINTX_FORMAT, _name, get_uintx());
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   721
  } else if (is_uint64_t()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   722
    st->print("-XX:%s=" UINT64_FORMAT, _name, get_uint64_t());
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   723
  } else if (is_size_t()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   724
    st->print("-XX:%s=" SIZE_FORMAT, _name, get_size_t());
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   725
  } else if (is_double()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   726
    st->print("-XX:%s=%f", _name, get_double());
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   727
  } else if (is_ccstr()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   728
    st->print("-XX:%s=", _name);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   729
    const char* cp = get_ccstr();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   730
    if (cp != NULL) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   731
      // Need to turn embedded '\n's back into separate arguments
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   732
      // Not so efficient to print one character at a time,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   733
      // but the choice is to do the transformation to a buffer
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   734
      // and print that.  And this need not be efficient.
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   735
      for (; *cp != '\0'; cp += 1) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   736
        switch (*cp) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   737
          default:
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   738
            st->print("%c", *cp);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   739
            break;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   740
          case '\n':
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   741
            st->print(" -XX:%s=", _name);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   742
            break;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   743
        }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   744
      }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   745
    }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   746
  } else {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   747
    ShouldNotReachHere();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   748
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   749
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   750
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   751
const char* JVMFlag::flag_error_str(JVMFlag::Error error) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   752
  switch (error) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   753
    case JVMFlag::MISSING_NAME: return "MISSING_NAME";
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   754
    case JVMFlag::MISSING_VALUE: return "MISSING_VALUE";
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   755
    case JVMFlag::NON_WRITABLE: return "NON_WRITABLE";
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   756
    case JVMFlag::OUT_OF_BOUNDS: return "OUT_OF_BOUNDS";
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   757
    case JVMFlag::VIOLATES_CONSTRAINT: return "VIOLATES_CONSTRAINT";
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   758
    case JVMFlag::INVALID_FLAG: return "INVALID_FLAG";
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   759
    case JVMFlag::ERR_OTHER: return "ERR_OTHER";
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   760
    case JVMFlag::SUCCESS: return "SUCCESS";
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   761
    default: ShouldNotReachHere(); return "NULL";
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   762
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   763
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   764
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   765
// 4991491 do not "optimize out" the was_set false values: omitting them
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   766
// tickles a Microsoft compiler bug causing flagTable to be malformed
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   767
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   768
#define RUNTIME_PRODUCT_FLAG_STRUCT(     type, name, value, doc) { #type, XSTR(name), &name,         NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_PRODUCT) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   769
#define RUNTIME_PD_PRODUCT_FLAG_STRUCT(  type, name,        doc) { #type, XSTR(name), &name,         NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_PRODUCT | JVMFlag::KIND_PLATFORM_DEPENDENT) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   770
#define RUNTIME_DIAGNOSTIC_FLAG_STRUCT(  type, name, value, doc) { #type, XSTR(name), &name,         NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_DIAGNOSTIC) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   771
#define RUNTIME_PD_DIAGNOSTIC_FLAG_STRUCT(type, name,       doc) { #type, XSTR(name), &name,         NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_DIAGNOSTIC | JVMFlag::KIND_PLATFORM_DEPENDENT) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   772
#define RUNTIME_EXPERIMENTAL_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name,         NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_EXPERIMENTAL) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   773
#define RUNTIME_MANAGEABLE_FLAG_STRUCT(  type, name, value, doc) { #type, XSTR(name), &name,         NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_MANAGEABLE) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   774
#define RUNTIME_PRODUCT_RW_FLAG_STRUCT(  type, name, value, doc) { #type, XSTR(name), &name,         NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_PRODUCT | JVMFlag::KIND_READ_WRITE) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   775
#define RUNTIME_DEVELOP_FLAG_STRUCT(     type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_DEVELOP) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   776
#define RUNTIME_PD_DEVELOP_FLAG_STRUCT(  type, name,        doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_DEVELOP | JVMFlag::KIND_PLATFORM_DEPENDENT) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   777
#define RUNTIME_NOTPRODUCT_FLAG_STRUCT(  type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_NOT_PRODUCT) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   778
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   779
#define JVMCI_PRODUCT_FLAG_STRUCT(       type, name, value, doc) { #type, XSTR(name), &name,         NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_JVMCI | JVMFlag::KIND_PRODUCT) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   780
#define JVMCI_PD_PRODUCT_FLAG_STRUCT(    type, name,        doc) { #type, XSTR(name), &name,         NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_JVMCI | JVMFlag::KIND_PRODUCT | JVMFlag::KIND_PLATFORM_DEPENDENT) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   781
#define JVMCI_DIAGNOSTIC_FLAG_STRUCT(    type, name, value, doc) { #type, XSTR(name), &name,         NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_JVMCI | JVMFlag::KIND_DIAGNOSTIC) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   782
#define JVMCI_PD_DIAGNOSTIC_FLAG_STRUCT( type, name,        doc) { #type, XSTR(name), &name,         NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_JVMCI | JVMFlag::KIND_DIAGNOSTIC | JVMFlag::KIND_PLATFORM_DEPENDENT) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   783
#define JVMCI_EXPERIMENTAL_FLAG_STRUCT(  type, name, value, doc) { #type, XSTR(name), &name,         NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_JVMCI | JVMFlag::KIND_EXPERIMENTAL) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   784
#define JVMCI_DEVELOP_FLAG_STRUCT(       type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_JVMCI | JVMFlag::KIND_DEVELOP) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   785
#define JVMCI_PD_DEVELOP_FLAG_STRUCT(    type, name,        doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_JVMCI | JVMFlag::KIND_DEVELOP | JVMFlag::KIND_PLATFORM_DEPENDENT) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   786
#define JVMCI_NOTPRODUCT_FLAG_STRUCT(    type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_JVMCI | JVMFlag::KIND_NOT_PRODUCT) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   787
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   788
#ifdef _LP64
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   789
#define RUNTIME_LP64_PRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name,         NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_LP64_PRODUCT) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   790
#else
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   791
#define RUNTIME_LP64_PRODUCT_FLAG_STRUCT(type, name, value, doc) /* flag is constant */
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   792
#endif // _LP64
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   793
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   794
#define C1_PRODUCT_FLAG_STRUCT(          type, name, value, doc) { #type, XSTR(name), &name,         NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_C1 | JVMFlag::KIND_PRODUCT) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   795
#define C1_PD_PRODUCT_FLAG_STRUCT(       type, name,        doc) { #type, XSTR(name), &name,         NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_C1 | JVMFlag::KIND_PRODUCT | JVMFlag::KIND_PLATFORM_DEPENDENT) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   796
#define C1_DIAGNOSTIC_FLAG_STRUCT(       type, name, value, doc) { #type, XSTR(name), &name,         NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_C1 | JVMFlag::KIND_DIAGNOSTIC) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   797
#define C1_PD_DIAGNOSTIC_FLAG_STRUCT(    type, name,        doc) { #type, XSTR(name), &name,         NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_C1 | JVMFlag::KIND_DIAGNOSTIC | JVMFlag::KIND_PLATFORM_DEPENDENT) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   798
#define C1_DEVELOP_FLAG_STRUCT(          type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_C1 | JVMFlag::KIND_DEVELOP) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   799
#define C1_PD_DEVELOP_FLAG_STRUCT(       type, name,        doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_C1 | JVMFlag::KIND_DEVELOP | JVMFlag::KIND_PLATFORM_DEPENDENT) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   800
#define C1_NOTPRODUCT_FLAG_STRUCT(       type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_C1 | JVMFlag::KIND_NOT_PRODUCT) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   801
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   802
#define C2_PRODUCT_FLAG_STRUCT(          type, name, value, doc) { #type, XSTR(name), &name,         NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_C2 | JVMFlag::KIND_PRODUCT) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   803
#define C2_PD_PRODUCT_FLAG_STRUCT(       type, name,        doc) { #type, XSTR(name), &name,         NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_C2 | JVMFlag::KIND_PRODUCT | JVMFlag::KIND_PLATFORM_DEPENDENT) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   804
#define C2_DIAGNOSTIC_FLAG_STRUCT(       type, name, value, doc) { #type, XSTR(name), &name,         NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_C2 | JVMFlag::KIND_DIAGNOSTIC) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   805
#define C2_PD_DIAGNOSTIC_FLAG_STRUCT(    type, name,        doc) { #type, XSTR(name), &name,         NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_C2 | JVMFlag::KIND_DIAGNOSTIC | JVMFlag::KIND_PLATFORM_DEPENDENT) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   806
#define C2_EXPERIMENTAL_FLAG_STRUCT(     type, name, value, doc) { #type, XSTR(name), &name,         NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_C2 | JVMFlag::KIND_EXPERIMENTAL) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   807
#define C2_DEVELOP_FLAG_STRUCT(          type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_C2 | JVMFlag::KIND_DEVELOP) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   808
#define C2_PD_DEVELOP_FLAG_STRUCT(       type, name,        doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_C2 | JVMFlag::KIND_DEVELOP | JVMFlag::KIND_PLATFORM_DEPENDENT) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   809
#define C2_NOTPRODUCT_FLAG_STRUCT(       type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_C2 | JVMFlag::KIND_NOT_PRODUCT) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   810
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   811
#define ARCH_PRODUCT_FLAG_STRUCT(        type, name, value, doc) { #type, XSTR(name), &name,         NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_ARCH | JVMFlag::KIND_PRODUCT) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   812
#define ARCH_DIAGNOSTIC_FLAG_STRUCT(     type, name, value, doc) { #type, XSTR(name), &name,         NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_ARCH | JVMFlag::KIND_DIAGNOSTIC) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   813
#define ARCH_EXPERIMENTAL_FLAG_STRUCT(   type, name, value, doc) { #type, XSTR(name), &name,         NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_ARCH | JVMFlag::KIND_EXPERIMENTAL) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   814
#define ARCH_DEVELOP_FLAG_STRUCT(        type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_ARCH | JVMFlag::KIND_DEVELOP) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   815
#define ARCH_NOTPRODUCT_FLAG_STRUCT(     type, name, value, doc) { #type, XSTR(name), (void*) &name, NOT_PRODUCT_ARG(doc) JVMFlag::Flags(JVMFlag::DEFAULT | JVMFlag::KIND_ARCH | JVMFlag::KIND_NOT_PRODUCT) },
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   816
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   817
static JVMFlag flagTable[] = {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   818
  VM_FLAGS(RUNTIME_DEVELOP_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   819
           RUNTIME_PD_DEVELOP_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   820
           RUNTIME_PRODUCT_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   821
           RUNTIME_PD_PRODUCT_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   822
           RUNTIME_DIAGNOSTIC_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   823
           RUNTIME_PD_DIAGNOSTIC_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   824
           RUNTIME_EXPERIMENTAL_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   825
           RUNTIME_NOTPRODUCT_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   826
           RUNTIME_MANAGEABLE_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   827
           RUNTIME_PRODUCT_RW_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   828
           RUNTIME_LP64_PRODUCT_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   829
           IGNORE_RANGE, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   830
           IGNORE_CONSTRAINT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   831
           IGNORE_WRITEABLE)
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   832
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   833
  RUNTIME_OS_FLAGS(RUNTIME_DEVELOP_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   834
                   RUNTIME_PD_DEVELOP_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   835
                   RUNTIME_PRODUCT_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   836
                   RUNTIME_PD_PRODUCT_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   837
                   RUNTIME_DIAGNOSTIC_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   838
                   RUNTIME_PD_DIAGNOSTIC_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   839
                   RUNTIME_NOTPRODUCT_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   840
                   IGNORE_RANGE, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   841
                   IGNORE_CONSTRAINT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   842
                   IGNORE_WRITEABLE)
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   843
#if INCLUDE_JVMCI
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   844
  JVMCI_FLAGS(JVMCI_DEVELOP_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   845
              JVMCI_PD_DEVELOP_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   846
              JVMCI_PRODUCT_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   847
              JVMCI_PD_PRODUCT_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   848
              JVMCI_DIAGNOSTIC_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   849
              JVMCI_PD_DIAGNOSTIC_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   850
              JVMCI_EXPERIMENTAL_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   851
              JVMCI_NOTPRODUCT_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   852
              IGNORE_RANGE, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   853
              IGNORE_CONSTRAINT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   854
              IGNORE_WRITEABLE)
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   855
#endif // INCLUDE_JVMCI
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   856
#ifdef COMPILER1
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   857
  C1_FLAGS(C1_DEVELOP_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   858
           C1_PD_DEVELOP_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   859
           C1_PRODUCT_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   860
           C1_PD_PRODUCT_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   861
           C1_DIAGNOSTIC_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   862
           C1_PD_DIAGNOSTIC_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   863
           C1_NOTPRODUCT_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   864
           IGNORE_RANGE, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   865
           IGNORE_CONSTRAINT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   866
           IGNORE_WRITEABLE)
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   867
#endif // COMPILER1
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   868
#ifdef COMPILER2
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   869
  C2_FLAGS(C2_DEVELOP_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   870
           C2_PD_DEVELOP_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   871
           C2_PRODUCT_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   872
           C2_PD_PRODUCT_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   873
           C2_DIAGNOSTIC_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   874
           C2_PD_DIAGNOSTIC_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   875
           C2_EXPERIMENTAL_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   876
           C2_NOTPRODUCT_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   877
           IGNORE_RANGE, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   878
           IGNORE_CONSTRAINT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   879
           IGNORE_WRITEABLE)
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   880
#endif // COMPILER2
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   881
  ARCH_FLAGS(ARCH_DEVELOP_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   882
             ARCH_PRODUCT_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   883
             ARCH_DIAGNOSTIC_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   884
             ARCH_EXPERIMENTAL_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   885
             ARCH_NOTPRODUCT_FLAG_STRUCT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   886
             IGNORE_RANGE, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   887
             IGNORE_CONSTRAINT, \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   888
             IGNORE_WRITEABLE)
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   889
  FLAGTABLE_EXT
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   890
  {0, NULL, NULL}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   891
};
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   892
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   893
JVMFlag* JVMFlag::flags = flagTable;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   894
size_t JVMFlag::numFlags = (sizeof(flagTable) / sizeof(JVMFlag));
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   895
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   896
inline bool str_equal(const char* s, size_t s_len, const char* q, size_t q_len) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   897
  if (s_len != q_len) return false;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   898
  return memcmp(s, q, q_len) == 0;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   899
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   900
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   901
// Search the flag table for a named flag
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   902
JVMFlag* JVMFlag::find_flag(const char* name, size_t length, bool allow_locked, bool return_flag) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   903
  for (JVMFlag* current = &flagTable[0]; current->_name != NULL; current++) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   904
    if (str_equal(current->_name, current->get_name_length(), name, length)) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   905
      // Found a matching entry.
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   906
      // Don't report notproduct and develop flags in product builds.
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   907
      if (current->is_constant_in_binary()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   908
        return (return_flag ? current : NULL);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   909
      }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   910
      // Report locked flags only if allowed.
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   911
      if (!(current->is_unlocked() || current->is_unlocker())) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   912
        if (!allow_locked) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   913
          // disable use of locked flags, e.g. diagnostic, experimental,
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   914
          // commercial... until they are explicitly unlocked
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   915
          return NULL;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   916
        }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   917
      }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   918
      return current;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   919
    }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   920
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   921
  // JVMFlag name is not in the flag table
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   922
  return NULL;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   923
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   924
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   925
// Get or compute the flag name length
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   926
size_t JVMFlag::get_name_length() {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   927
  if (_name_len == 0) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   928
    _name_len = strlen(_name);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   929
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   930
  return _name_len;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   931
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   932
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   933
JVMFlag* JVMFlag::fuzzy_match(const char* name, size_t length, bool allow_locked) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   934
  float VMOptionsFuzzyMatchSimilarity = 0.7f;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   935
  JVMFlag* match = NULL;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   936
  float score;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   937
  float max_score = -1;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   938
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   939
  for (JVMFlag* current = &flagTable[0]; current->_name != NULL; current++) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   940
    score = StringUtils::similarity(current->_name, strlen(current->_name), name, length);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   941
    if (score > max_score) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   942
      max_score = score;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   943
      match = current;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   944
    }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   945
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   946
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   947
  if (!(match->is_unlocked() || match->is_unlocker())) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   948
    if (!allow_locked) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   949
      return NULL;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   950
    }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   951
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   952
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   953
  if (max_score < VMOptionsFuzzyMatchSimilarity) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   954
    return NULL;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   955
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   956
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   957
  return match;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   958
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   959
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   960
// Returns the address of the index'th element
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   961
static JVMFlag* address_of_flag(JVMFlagsWithType flag) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   962
  assert((size_t)flag < JVMFlag::numFlags, "bad command line flag index");
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   963
  return &JVMFlag::flags[flag];
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   964
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   965
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   966
bool JVMFlagEx::is_default(JVMFlags flag) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   967
  assert((size_t)flag < JVMFlag::numFlags, "bad command line flag index");
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   968
  JVMFlag* f = &JVMFlag::flags[flag];
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   969
  return f->is_default();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   970
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   971
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   972
bool JVMFlagEx::is_ergo(JVMFlags flag) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   973
  assert((size_t)flag < JVMFlag::numFlags, "bad command line flag index");
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   974
  JVMFlag* f = &JVMFlag::flags[flag];
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   975
  return f->is_ergonomic();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   976
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   977
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   978
bool JVMFlagEx::is_cmdline(JVMFlags flag) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   979
  assert((size_t)flag < JVMFlag::numFlags, "bad command line flag index");
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   980
  JVMFlag* f = &JVMFlag::flags[flag];
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   981
  return f->is_command_line();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   982
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   983
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   984
bool JVMFlag::wasSetOnCmdline(const char* name, bool* value) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   985
  JVMFlag* result = JVMFlag::find_flag((char*)name, strlen(name));
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   986
  if (result == NULL) return false;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   987
  *value = result->is_command_line();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   988
  return true;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   989
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   990
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   991
void JVMFlagEx::setOnCmdLine(JVMFlagsWithType flag) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   992
  JVMFlag* faddr = address_of_flag(flag);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   993
  assert(faddr != NULL, "Unknown flag");
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   994
  faddr->set_command_line();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   995
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   996
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   997
template<class E, class T>
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   998
static void trace_flag_changed(const char* name, const T old_value, const T new_value, const JVMFlag::Flags origin) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
   999
  E e;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1000
  e.set_name(name);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1001
  e.set_oldValue(old_value);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1002
  e.set_newValue(new_value);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1003
  e.set_origin(origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1004
  e.commit();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1005
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1006
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1007
static JVMFlag::Error apply_constraint_and_check_range_bool(const char* name, bool new_value, bool verbose) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1008
  JVMFlag::Error status = JVMFlag::SUCCESS;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1009
  JVMFlagConstraint* constraint = JVMFlagConstraintList::find_if_needs_check(name);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1010
  if (constraint != NULL) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1011
    status = constraint->apply_bool(new_value, verbose);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1012
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1013
  return status;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1014
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1015
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1016
JVMFlag::Error JVMFlag::boolAt(const char* name, size_t len, bool* value, bool allow_locked, bool return_flag) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1017
  JVMFlag* result = JVMFlag::find_flag(name, len, allow_locked, return_flag);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1018
  if (result == NULL) return JVMFlag::INVALID_FLAG;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1019
  if (!result->is_bool()) return JVMFlag::WRONG_FORMAT;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1020
  *value = result->get_bool();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1021
  return JVMFlag::SUCCESS;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1022
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1023
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1024
JVMFlag::Error JVMFlag::boolAtPut(JVMFlag* flag, bool* value, JVMFlag::Flags origin) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1025
  const char* name;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1026
  if (flag == NULL) return JVMFlag::INVALID_FLAG;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1027
  if (!flag->is_bool()) return JVMFlag::WRONG_FORMAT;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1028
  name = flag->_name;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1029
  JVMFlag::Error check = apply_constraint_and_check_range_bool(name, *value, !JVMFlagConstraintList::validated_after_ergo());
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1030
  if (check != JVMFlag::SUCCESS) return check;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1031
  bool old_value = flag->get_bool();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1032
  trace_flag_changed<EventBooleanFlagChanged, bool>(name, old_value, *value, origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1033
  check = flag->set_bool(*value);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1034
  *value = old_value;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1035
  flag->set_origin(origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1036
  return check;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1037
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1038
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1039
JVMFlag::Error JVMFlag::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
  1040
  JVMFlag* result = JVMFlag::find_flag(name, len);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1041
  return boolAtPut(result, value, origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1042
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1043
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1044
JVMFlag::Error JVMFlagEx::boolAtPut(JVMFlagsWithType flag, bool value, JVMFlag::Flags origin) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1045
  JVMFlag* faddr = address_of_flag(flag);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1046
  guarantee(faddr != NULL && faddr->is_bool(), "wrong flag type");
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1047
  return JVMFlag::boolAtPut(faddr, &value, origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1048
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1049
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1050
static JVMFlag::Error apply_constraint_and_check_range_int(const char* name, int new_value, bool verbose) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1051
  JVMFlag::Error status = JVMFlag::SUCCESS;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1052
  JVMFlagRange* range = JVMFlagRangeList::find(name);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1053
  if (range != NULL) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1054
    status = range->check_int(new_value, verbose);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1055
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1056
  if (status == JVMFlag::SUCCESS) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1057
    JVMFlagConstraint* constraint = JVMFlagConstraintList::find_if_needs_check(name);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1058
    if (constraint != NULL) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1059
      status = constraint->apply_int(new_value, verbose);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1060
    }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1061
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1062
  return status;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1063
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1064
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1065
JVMFlag::Error JVMFlag::intAt(const char* name, size_t len, int* value, bool allow_locked, bool return_flag) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1066
  JVMFlag* result = JVMFlag::find_flag(name, len, allow_locked, return_flag);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1067
  if (result == NULL) return JVMFlag::INVALID_FLAG;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1068
  if (!result->is_int()) return JVMFlag::WRONG_FORMAT;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1069
  *value = result->get_int();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1070
  return JVMFlag::SUCCESS;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1071
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1072
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1073
JVMFlag::Error JVMFlag::intAtPut(JVMFlag* flag, int* value, JVMFlag::Flags origin) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1074
  const char* name;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1075
  if (flag == NULL) return JVMFlag::INVALID_FLAG;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1076
  if (!flag->is_int()) return JVMFlag::WRONG_FORMAT;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1077
  name = flag->_name;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1078
  JVMFlag::Error check = apply_constraint_and_check_range_int(name, *value, !JVMFlagConstraintList::validated_after_ergo());
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1079
  if (check != JVMFlag::SUCCESS) return check;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1080
  int old_value = flag->get_int();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1081
  trace_flag_changed<EventIntFlagChanged, s4>(name, old_value, *value, origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1082
  check = flag->set_int(*value);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1083
  *value = old_value;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1084
  flag->set_origin(origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1085
  return check;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1086
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1087
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1088
JVMFlag::Error JVMFlag::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
  1089
  JVMFlag* result = JVMFlag::find_flag(name, len);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1090
  return intAtPut(result, value, origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1091
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1092
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1093
JVMFlag::Error JVMFlagEx::intAtPut(JVMFlagsWithType flag, int value, JVMFlag::Flags origin) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1094
  JVMFlag* faddr = address_of_flag(flag);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1095
  guarantee(faddr != NULL && faddr->is_int(), "wrong flag type");
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1096
  return JVMFlag::intAtPut(faddr, &value, origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1097
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1098
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1099
static JVMFlag::Error apply_constraint_and_check_range_uint(const char* name, uint new_value, bool verbose) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1100
  JVMFlag::Error status = JVMFlag::SUCCESS;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1101
  JVMFlagRange* range = JVMFlagRangeList::find(name);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1102
  if (range != NULL) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1103
    status = range->check_uint(new_value, verbose);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1104
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1105
  if (status == JVMFlag::SUCCESS) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1106
    JVMFlagConstraint* constraint = JVMFlagConstraintList::find_if_needs_check(name);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1107
    if (constraint != NULL) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1108
      status = constraint->apply_uint(new_value, verbose);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1109
    }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1110
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1111
  return status;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1112
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1113
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1114
JVMFlag::Error JVMFlag::uintAt(const char* name, size_t len, uint* value, bool allow_locked, bool return_flag) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1115
  JVMFlag* result = JVMFlag::find_flag(name, len, allow_locked, return_flag);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1116
  if (result == NULL) return JVMFlag::INVALID_FLAG;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1117
  if (!result->is_uint()) return JVMFlag::WRONG_FORMAT;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1118
  *value = result->get_uint();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1119
  return JVMFlag::SUCCESS;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1120
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1121
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1122
JVMFlag::Error JVMFlag::uintAtPut(JVMFlag* flag, uint* value, JVMFlag::Flags origin) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1123
  const char* name;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1124
  if (flag == NULL) return JVMFlag::INVALID_FLAG;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1125
  if (!flag->is_uint()) return JVMFlag::WRONG_FORMAT;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1126
  name = flag->_name;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1127
  JVMFlag::Error check = apply_constraint_and_check_range_uint(name, *value, !JVMFlagConstraintList::validated_after_ergo());
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1128
  if (check != JVMFlag::SUCCESS) return check;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1129
  uint old_value = flag->get_uint();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1130
  trace_flag_changed<EventUnsignedIntFlagChanged, u4>(name, old_value, *value, origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1131
  check = flag->set_uint(*value);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1132
  *value = old_value;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1133
  flag->set_origin(origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1134
  return check;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1135
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1136
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1137
JVMFlag::Error JVMFlag::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
  1138
  JVMFlag* result = JVMFlag::find_flag(name, len);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1139
  return uintAtPut(result, value, origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1140
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1141
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1142
JVMFlag::Error JVMFlagEx::uintAtPut(JVMFlagsWithType flag, uint value, JVMFlag::Flags origin) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1143
  JVMFlag* faddr = address_of_flag(flag);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1144
  guarantee(faddr != NULL && faddr->is_uint(), "wrong flag type");
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1145
  return JVMFlag::uintAtPut(faddr, &value, origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1146
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1147
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1148
JVMFlag::Error JVMFlag::intxAt(const char* name, size_t len, intx* value, bool allow_locked, bool return_flag) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1149
  JVMFlag* result = JVMFlag::find_flag(name, len, allow_locked, return_flag);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1150
  if (result == NULL) return JVMFlag::INVALID_FLAG;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1151
  if (!result->is_intx()) return JVMFlag::WRONG_FORMAT;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1152
  *value = result->get_intx();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1153
  return JVMFlag::SUCCESS;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1154
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1155
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1156
static JVMFlag::Error apply_constraint_and_check_range_intx(const char* name, intx new_value, bool verbose) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1157
  JVMFlag::Error status = JVMFlag::SUCCESS;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1158
  JVMFlagRange* range = JVMFlagRangeList::find(name);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1159
  if (range != NULL) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1160
    status = range->check_intx(new_value, verbose);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1161
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1162
  if (status == JVMFlag::SUCCESS) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1163
    JVMFlagConstraint* constraint = JVMFlagConstraintList::find_if_needs_check(name);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1164
    if (constraint != NULL) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1165
      status = constraint->apply_intx(new_value, verbose);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1166
    }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1167
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1168
  return status;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1169
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1170
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1171
JVMFlag::Error JVMFlag::intxAtPut(JVMFlag* flag, intx* value, JVMFlag::Flags origin) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1172
  const char* name;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1173
  if (flag == NULL) return JVMFlag::INVALID_FLAG;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1174
  if (!flag->is_intx()) return JVMFlag::WRONG_FORMAT;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1175
  name = flag->_name;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1176
  JVMFlag::Error check = apply_constraint_and_check_range_intx(name, *value, !JVMFlagConstraintList::validated_after_ergo());
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1177
  if (check != JVMFlag::SUCCESS) return check;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1178
  intx old_value = flag->get_intx();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1179
  trace_flag_changed<EventLongFlagChanged, intx>(name, old_value, *value, origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1180
  check = flag->set_intx(*value);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1181
  *value = old_value;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1182
  flag->set_origin(origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1183
  return check;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1184
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1185
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1186
JVMFlag::Error JVMFlag::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
  1187
  JVMFlag* result = JVMFlag::find_flag(name, len);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1188
  return intxAtPut(result, value, origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1189
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1190
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1191
JVMFlag::Error JVMFlagEx::intxAtPut(JVMFlagsWithType flag, intx value, JVMFlag::Flags origin) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1192
  JVMFlag* faddr = address_of_flag(flag);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1193
  guarantee(faddr != NULL && faddr->is_intx(), "wrong flag type");
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1194
  return JVMFlag::intxAtPut(faddr, &value, origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1195
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1196
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1197
JVMFlag::Error JVMFlag::uintxAt(const char* name, size_t len, uintx* value, bool allow_locked, bool return_flag) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1198
  JVMFlag* result = JVMFlag::find_flag(name, len, allow_locked, return_flag);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1199
  if (result == NULL) return JVMFlag::INVALID_FLAG;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1200
  if (!result->is_uintx()) return JVMFlag::WRONG_FORMAT;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1201
  *value = result->get_uintx();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1202
  return JVMFlag::SUCCESS;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1203
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1204
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1205
static JVMFlag::Error apply_constraint_and_check_range_uintx(const char* name, uintx new_value, bool verbose) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1206
  JVMFlag::Error status = JVMFlag::SUCCESS;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1207
  JVMFlagRange* range = JVMFlagRangeList::find(name);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1208
  if (range != NULL) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1209
    status = range->check_uintx(new_value, verbose);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1210
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1211
  if (status == JVMFlag::SUCCESS) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1212
    JVMFlagConstraint* constraint = JVMFlagConstraintList::find_if_needs_check(name);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1213
    if (constraint != NULL) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1214
      status = constraint->apply_uintx(new_value, verbose);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1215
    }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1216
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1217
  return status;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1218
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1219
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1220
JVMFlag::Error JVMFlag::uintxAtPut(JVMFlag* flag, uintx* value, JVMFlag::Flags origin) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1221
  const char* name;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1222
  if (flag == NULL) return JVMFlag::INVALID_FLAG;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1223
  if (!flag->is_uintx()) return JVMFlag::WRONG_FORMAT;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1224
  name = flag->_name;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1225
  JVMFlag::Error check = apply_constraint_and_check_range_uintx(name, *value, !JVMFlagConstraintList::validated_after_ergo());
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1226
  if (check != JVMFlag::SUCCESS) return check;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1227
  uintx old_value = flag->get_uintx();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1228
  trace_flag_changed<EventUnsignedLongFlagChanged, u8>(name, old_value, *value, origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1229
  check = flag->set_uintx(*value);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1230
  *value = old_value;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1231
  flag->set_origin(origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1232
  return check;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1233
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1234
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1235
JVMFlag::Error JVMFlag::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
  1236
  JVMFlag* result = JVMFlag::find_flag(name, len);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1237
  return uintxAtPut(result, value, origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1238
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1239
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1240
JVMFlag::Error JVMFlagEx::uintxAtPut(JVMFlagsWithType flag, uintx value, JVMFlag::Flags origin) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1241
  JVMFlag* faddr = address_of_flag(flag);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1242
  guarantee(faddr != NULL && faddr->is_uintx(), "wrong flag type");
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1243
  return JVMFlag::uintxAtPut(faddr, &value, origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1244
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1245
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1246
JVMFlag::Error JVMFlag::uint64_tAt(const char* name, size_t len, uint64_t* value, bool allow_locked, bool return_flag) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1247
  JVMFlag* result = JVMFlag::find_flag(name, len, allow_locked, return_flag);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1248
  if (result == NULL) return JVMFlag::INVALID_FLAG;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1249
  if (!result->is_uint64_t()) return JVMFlag::WRONG_FORMAT;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1250
  *value = result->get_uint64_t();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1251
  return JVMFlag::SUCCESS;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1252
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1253
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1254
static JVMFlag::Error apply_constraint_and_check_range_uint64_t(const char* name, uint64_t new_value, bool verbose) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1255
  JVMFlag::Error status = JVMFlag::SUCCESS;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1256
  JVMFlagRange* range = JVMFlagRangeList::find(name);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1257
  if (range != NULL) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1258
    status = range->check_uint64_t(new_value, verbose);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1259
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1260
  if (status == JVMFlag::SUCCESS) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1261
    JVMFlagConstraint* constraint = JVMFlagConstraintList::find_if_needs_check(name);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1262
    if (constraint != NULL) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1263
      status = constraint->apply_uint64_t(new_value, verbose);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1264
    }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1265
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1266
  return status;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1267
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1268
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1269
JVMFlag::Error JVMFlag::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
  1270
  const char* name;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1271
  if (flag == NULL) return JVMFlag::INVALID_FLAG;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1272
  if (!flag->is_uint64_t()) return JVMFlag::WRONG_FORMAT;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1273
  name = flag->_name;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1274
  JVMFlag::Error check = apply_constraint_and_check_range_uint64_t(name, *value, !JVMFlagConstraintList::validated_after_ergo());
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1275
  if (check != JVMFlag::SUCCESS) return check;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1276
  uint64_t old_value = flag->get_uint64_t();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1277
  trace_flag_changed<EventUnsignedLongFlagChanged, u8>(name, old_value, *value, origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1278
  check = flag->set_uint64_t(*value);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1279
  *value = old_value;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1280
  flag->set_origin(origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1281
  return check;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1282
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1283
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1284
JVMFlag::Error JVMFlag::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
  1285
  JVMFlag* result = JVMFlag::find_flag(name, len);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1286
  return uint64_tAtPut(result, value, origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1287
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1288
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1289
JVMFlag::Error JVMFlagEx::uint64_tAtPut(JVMFlagsWithType flag, uint64_t value, JVMFlag::Flags origin) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1290
  JVMFlag* faddr = address_of_flag(flag);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1291
  guarantee(faddr != NULL && faddr->is_uint64_t(), "wrong flag type");
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1292
  return JVMFlag::uint64_tAtPut(faddr, &value, origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1293
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1294
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1295
JVMFlag::Error JVMFlag::size_tAt(const char* name, size_t len, size_t* value, bool allow_locked, bool return_flag) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1296
  JVMFlag* result = JVMFlag::find_flag(name, len, allow_locked, return_flag);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1297
  if (result == NULL) return JVMFlag::INVALID_FLAG;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1298
  if (!result->is_size_t()) return JVMFlag::WRONG_FORMAT;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1299
  *value = result->get_size_t();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1300
  return JVMFlag::SUCCESS;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1301
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1302
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1303
static JVMFlag::Error apply_constraint_and_check_range_size_t(const char* name, size_t new_value, bool verbose) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1304
  JVMFlag::Error status = JVMFlag::SUCCESS;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1305
  JVMFlagRange* range = JVMFlagRangeList::find(name);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1306
  if (range != NULL) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1307
    status = range->check_size_t(new_value, verbose);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1308
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1309
  if (status == JVMFlag::SUCCESS) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1310
    JVMFlagConstraint* constraint = JVMFlagConstraintList::find_if_needs_check(name);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1311
    if (constraint != NULL) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1312
      status = constraint->apply_size_t(new_value, verbose);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1313
    }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1314
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1315
  return status;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1316
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1317
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1318
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1319
JVMFlag::Error JVMFlag::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
  1320
  const char* name;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1321
  if (flag == NULL) return JVMFlag::INVALID_FLAG;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1322
  if (!flag->is_size_t()) return JVMFlag::WRONG_FORMAT;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1323
  name = flag->_name;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1324
  JVMFlag::Error check = apply_constraint_and_check_range_size_t(name, *value, !JVMFlagConstraintList::validated_after_ergo());
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1325
  if (check != JVMFlag::SUCCESS) return check;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1326
  size_t old_value = flag->get_size_t();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1327
  trace_flag_changed<EventUnsignedLongFlagChanged, u8>(name, old_value, *value, origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1328
  check = flag->set_size_t(*value);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1329
  *value = old_value;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1330
  flag->set_origin(origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1331
  return check;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1332
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1333
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1334
JVMFlag::Error JVMFlag::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
  1335
  JVMFlag* result = JVMFlag::find_flag(name, len);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1336
  return size_tAtPut(result, value, origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1337
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1338
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1339
JVMFlag::Error JVMFlagEx::size_tAtPut(JVMFlagsWithType flag, size_t value, JVMFlag::Flags origin) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1340
  JVMFlag* faddr = address_of_flag(flag);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1341
  guarantee(faddr != NULL && faddr->is_size_t(), "wrong flag type");
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1342
  return JVMFlag::size_tAtPut(faddr, &value, origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1343
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1344
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1345
JVMFlag::Error JVMFlag::doubleAt(const char* name, size_t len, double* value, bool allow_locked, bool return_flag) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1346
  JVMFlag* result = JVMFlag::find_flag(name, len, allow_locked, return_flag);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1347
  if (result == NULL) return JVMFlag::INVALID_FLAG;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1348
  if (!result->is_double()) return JVMFlag::WRONG_FORMAT;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1349
  *value = result->get_double();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1350
  return JVMFlag::SUCCESS;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1351
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1352
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1353
static JVMFlag::Error apply_constraint_and_check_range_double(const char* name, double new_value, bool verbose) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1354
  JVMFlag::Error status = JVMFlag::SUCCESS;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1355
  JVMFlagRange* range = JVMFlagRangeList::find(name);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1356
  if (range != NULL) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1357
    status = range->check_double(new_value, verbose);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1358
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1359
  if (status == JVMFlag::SUCCESS) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1360
    JVMFlagConstraint* constraint = JVMFlagConstraintList::find_if_needs_check(name);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1361
    if (constraint != NULL) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1362
      status = constraint->apply_double(new_value, verbose);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1363
    }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1364
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1365
  return status;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1366
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1367
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1368
JVMFlag::Error JVMFlag::doubleAtPut(JVMFlag* flag, double* value, JVMFlag::Flags origin) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1369
  const char* name;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1370
  if (flag == NULL) return JVMFlag::INVALID_FLAG;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1371
  if (!flag->is_double()) return JVMFlag::WRONG_FORMAT;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1372
  name = flag->_name;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1373
  JVMFlag::Error check = apply_constraint_and_check_range_double(name, *value, !JVMFlagConstraintList::validated_after_ergo());
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1374
  if (check != JVMFlag::SUCCESS) return check;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1375
  double old_value = flag->get_double();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1376
  trace_flag_changed<EventDoubleFlagChanged, double>(name, old_value, *value, origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1377
  check = flag->set_double(*value);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1378
  *value = old_value;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1379
  flag->set_origin(origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1380
  return check;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1381
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1382
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1383
JVMFlag::Error JVMFlag::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
  1384
  JVMFlag* result = JVMFlag::find_flag(name, len);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1385
  return doubleAtPut(result, value, origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1386
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1387
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1388
JVMFlag::Error JVMFlagEx::doubleAtPut(JVMFlagsWithType flag, double value, JVMFlag::Flags origin) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1389
  JVMFlag* faddr = address_of_flag(flag);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1390
  guarantee(faddr != NULL && faddr->is_double(), "wrong flag type");
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1391
  return JVMFlag::doubleAtPut(faddr, &value, origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1392
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1393
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1394
JVMFlag::Error JVMFlag::ccstrAt(const char* name, size_t len, ccstr* value, bool allow_locked, bool return_flag) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1395
  JVMFlag* result = JVMFlag::find_flag(name, len, allow_locked, return_flag);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1396
  if (result == NULL) return JVMFlag::INVALID_FLAG;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1397
  if (!result->is_ccstr()) return JVMFlag::WRONG_FORMAT;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1398
  *value = result->get_ccstr();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1399
  return JVMFlag::SUCCESS;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1400
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1401
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1402
JVMFlag::Error JVMFlag::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
  1403
  JVMFlag* result = JVMFlag::find_flag(name, len);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1404
  if (result == NULL) return JVMFlag::INVALID_FLAG;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1405
  if (!result->is_ccstr()) return JVMFlag::WRONG_FORMAT;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1406
  ccstr old_value = result->get_ccstr();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1407
  trace_flag_changed<EventStringFlagChanged, const char*>(name, old_value, *value, origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1408
  char* new_value = NULL;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1409
  if (*value != NULL) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1410
    new_value = os::strdup_check_oom(*value);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1411
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1412
  JVMFlag::Error check = result->set_ccstr(new_value);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1413
  if (result->is_default() && old_value != NULL) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1414
    // Prior value is NOT heap allocated, but was a literal constant.
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1415
    old_value = os::strdup_check_oom(old_value);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1416
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1417
  *value = old_value;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1418
  result->set_origin(origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1419
  return check;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1420
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1421
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1422
JVMFlag::Error JVMFlagEx::ccstrAtPut(JVMFlagsWithType flag, ccstr value, JVMFlag::Flags origin) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1423
  JVMFlag* faddr = address_of_flag(flag);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1424
  guarantee(faddr != NULL && faddr->is_ccstr(), "wrong flag type");
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1425
  ccstr old_value = faddr->get_ccstr();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1426
  trace_flag_changed<EventStringFlagChanged, const char*>(faddr->_name, old_value, value, origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1427
  char* new_value = os::strdup_check_oom(value);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1428
  JVMFlag::Error check = faddr->set_ccstr(new_value);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1429
  if (!faddr->is_default() && old_value != NULL) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1430
    // Prior value is heap allocated so free it.
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1431
    FREE_C_HEAP_ARRAY(char, old_value);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1432
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1433
  faddr->set_origin(origin);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1434
  return check;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1435
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1436
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1437
extern "C" {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1438
  static int compare_flags(const void* void_a, const void* void_b) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1439
    return strcmp((*((JVMFlag**) void_a))->_name, (*((JVMFlag**) void_b))->_name);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1440
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1441
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1442
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1443
void JVMFlag::printSetFlags(outputStream* out) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1444
  // Print which flags were set on the command line
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1445
  // note: this method is called before the thread structure is in place
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1446
  //       which means resource allocation cannot be used.
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1447
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1448
  // The last entry is the null entry.
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1449
  const size_t length = JVMFlag::numFlags - 1;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1450
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1451
  // Sort
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1452
  JVMFlag** array = NEW_C_HEAP_ARRAY(JVMFlag*, length, mtArguments);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1453
  for (size_t i = 0; i < length; i++) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1454
    array[i] = &flagTable[i];
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1455
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1456
  qsort(array, length, sizeof(JVMFlag*), compare_flags);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1457
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1458
  // Print
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1459
  for (size_t i = 0; i < length; i++) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1460
    if (array[i]->get_origin() /* naked field! */) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1461
      array[i]->print_as_flag(out);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1462
      out->print(" ");
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1463
    }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1464
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1465
  out->cr();
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1466
  FREE_C_HEAP_ARRAY(JVMFlag*, array);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1467
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1468
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1469
#ifndef PRODUCT
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1470
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1471
void JVMFlag::verify() {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1472
  assert(Arguments::check_vm_args_consistency(), "Some flag settings conflict");
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1473
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1474
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1475
#endif // PRODUCT
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1476
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1477
void JVMFlag::printFlags(outputStream* out, bool withComments, bool printRanges) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1478
  // Print the flags sorted by name
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1479
  // note: this method is called before the thread structure is in place
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1480
  //       which means resource allocation cannot be used.
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1481
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1482
  // The last entry is the null entry.
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1483
  const size_t length = JVMFlag::numFlags - 1;
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1484
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1485
  // Sort
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1486
  JVMFlag** array = NEW_C_HEAP_ARRAY(JVMFlag*, length, mtArguments);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1487
  for (size_t i = 0; i < length; i++) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1488
    array[i] = &flagTable[i];
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1489
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1490
  qsort(array, length, sizeof(JVMFlag*), compare_flags);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1491
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1492
  // Print
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1493
  if (!printRanges) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1494
    out->print_cr("[Global flags]");
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1495
  } else {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1496
    out->print_cr("[Global flags ranges]");
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1497
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1498
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1499
  for (size_t i = 0; i < length; i++) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1500
    if (array[i]->is_unlocked()) {
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1501
      array[i]->print_on(out, withComments, printRanges);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1502
    }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1503
  }
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1504
  FREE_C_HEAP_ARRAY(JVMFlag*, array);
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1505
}
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents:
diff changeset
  1506