src/hotspot/share/services/writeableFlags.hpp
author gziemski
Mon, 23 Apr 2018 10:59:39 -0500
changeset 49857 31e07291ae29
parent 47216 71c04702a3d5
child 49860 ca5216a2a2cc
permissions -rw-r--r--
8081519: Split globals.hpp to factor out the Flag class Summary: Factored out Flag out go globals, renamed to JVMFlag Reviewed-by: coleenp, dholmes, kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
     1
/*
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 47216
diff changeset
     2
 * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
     4
 *
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
     7
 * published by the Free Software Foundation.
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
     8
 *
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    13
 * accompanied this code).
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    14
 *
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    18
 *
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    21
 * questions.
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    22
 *
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    23
 */
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    24
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    25
#ifndef SHARE_VM_SERVICES_WRITEABLEFLAG_HPP
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    26
#define SHARE_VM_SERVICES_WRITEABLEFLAG_HPP
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    27
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 47216
diff changeset
    28
#include "runtime/flags/jvmFlag.hpp"
46560
388aa8d67c80 8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents: 31371
diff changeset
    29
#include "runtime/globals.hpp"
388aa8d67c80 8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents: 31371
diff changeset
    30
#include "utilities/formatBuffer.hpp"
388aa8d67c80 8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents: 31371
diff changeset
    31
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    32
class WriteableFlags : AllStatic {
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    33
private:
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    34
  // a writeable flag setter accepting either 'jvalue' or 'char *' values
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 47216
diff changeset
    35
  static JVMFlag::Error set_flag(const char* name, const void* value, JVMFlag::Error(*setter)(JVMFlag*, const void*, JVMFlag::Flags, FormatBuffer<80>&), JVMFlag::Flags origin, FormatBuffer<80>& err_msg);
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    36
  // a writeable flag setter accepting 'char *' values
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 47216
diff changeset
    37
  static JVMFlag::Error set_flag_from_char(JVMFlag* f, const void* value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg);
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    38
  // a writeable flag setter accepting 'jvalue' values
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 47216
diff changeset
    39
  static JVMFlag::Error set_flag_from_jvalue(JVMFlag* f, const void* value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg);
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    40
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    41
  // set a boolean global flag
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 47216
diff changeset
    42
  static JVMFlag::Error set_bool_flag(const char* name, const char* value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg);
31236
d4d3011aa98e 8080947: Add uint as a valid VM flag type
david
parents: 28949
diff changeset
    43
  // set a int global flag
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 47216
diff changeset
    44
  static JVMFlag::Error set_int_flag(const char* name, const char* value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg);
31236
d4d3011aa98e 8080947: Add uint as a valid VM flag type
david
parents: 28949
diff changeset
    45
  // set a uint global flag
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 47216
diff changeset
    46
  static JVMFlag::Error set_uint_flag(const char* name, const char* value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg);
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    47
  // set a intx global flag
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 47216
diff changeset
    48
  static JVMFlag::Error set_intx_flag(const char* name, const char* value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg);
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    49
  // set a uintx global flag
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 47216
diff changeset
    50
  static JVMFlag::Error set_uintx_flag(const char* name, const char* value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg);
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    51
  // set a uint64_t global flag
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 47216
diff changeset
    52
  static JVMFlag::Error set_uint64_t_flag(const char* name, const char* value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg);
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    53
  // set a size_t global flag using value from AttachOperation
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 47216
diff changeset
    54
  static JVMFlag::Error set_size_t_flag(const char* name, const char* value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg);
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    55
  // set a boolean global flag
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 47216
diff changeset
    56
  static JVMFlag::Error set_bool_flag(const char* name, bool value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg);
31236
d4d3011aa98e 8080947: Add uint as a valid VM flag type
david
parents: 28949
diff changeset
    57
  // set a int global flag
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 47216
diff changeset
    58
  static JVMFlag::Error set_int_flag(const char* name, int value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg);
31236
d4d3011aa98e 8080947: Add uint as a valid VM flag type
david
parents: 28949
diff changeset
    59
  // set a uint global flag
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 47216
diff changeset
    60
  static JVMFlag::Error set_uint_flag(const char* name, uint value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg);
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    61
  // set a intx global flag
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 47216
diff changeset
    62
  static JVMFlag::Error set_intx_flag(const char* name, intx value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg);
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    63
  // set a uintx global flag
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 47216
diff changeset
    64
  static JVMFlag::Error set_uintx_flag(const char* name, uintx value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg);
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    65
  // set a uint64_t global flag
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 47216
diff changeset
    66
  static JVMFlag::Error set_uint64_t_flag(const char* name, uint64_t value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg);
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    67
  // set a size_t global flag using value from AttachOperation
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 47216
diff changeset
    68
  static JVMFlag::Error set_size_t_flag(const char* name, size_t value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg);
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    69
  // set a string global flag
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 47216
diff changeset
    70
  static JVMFlag::Error set_ccstr_flag(const char* name, const char* value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg);
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    71
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    72
public:
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    73
  /* sets a writeable flag to the provided value
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    74
   *
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    75
   * - return status is one of the WriteableFlags::err enum values
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    76
   * - an eventual error message will be generated to the provided err_msg buffer
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    77
   */
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 47216
diff changeset
    78
  static JVMFlag::Error set_flag(const char* flag_name, const char* flag_value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg);
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    79
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    80
  /* sets a writeable flag to the provided value
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    81
   *
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    82
   * - return status is one of the WriteableFlags::err enum values
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    83
   * - an eventual error message will be generated to the provided err_msg buffer
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    84
   */
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 47216
diff changeset
    85
  static JVMFlag::Error set_flag(const char* flag_name, jvalue flag_value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg);
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    86
};
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    87
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    88
#endif /* SHARE_VM_SERVICES_WRITEABLEFLAG_HPP */