src/hotspot/share/services/writeableFlags.hpp
author gziemski
Mon, 23 Apr 2018 14:51:16 -0500
changeset 49860 ca5216a2a2cc
parent 49857 31e07291ae29
child 49902 3661f31c6df4
permissions -rw-r--r--
8202151: [BACKOUT] Split globals.hpp to factor out the Flag class Summary: Backed out JDK-8081519 Reviewed-by: 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
/*
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents: 49857
diff changeset
     2
 * Copyright (c) 2015, 2017, 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
46560
388aa8d67c80 8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents: 31371
diff changeset
    28
#include "runtime/globals.hpp"
388aa8d67c80 8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents: 31371
diff changeset
    29
#include "utilities/formatBuffer.hpp"
388aa8d67c80 8181449: Fix debug.hpp / globalDefinitions.hpp dependency inversion
kbarrett
parents: 31371
diff changeset
    30
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    31
class WriteableFlags : AllStatic {
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    32
private:
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    33
  // a writeable flag setter accepting either 'jvalue' or 'char *' values
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents: 49857
diff changeset
    34
  static Flag::Error set_flag(const char* name, const void* value, Flag::Error(*setter)(Flag*, const void*, Flag::Flags, FormatBuffer<80>&), Flag::Flags origin, FormatBuffer<80>& err_msg);
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    35
  // a writeable flag setter accepting 'char *' values
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents: 49857
diff changeset
    36
  static Flag::Error set_flag_from_char(Flag* f, const void* value, Flag::Flags origin, FormatBuffer<80>& err_msg);
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    37
  // a writeable flag setter accepting 'jvalue' values
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents: 49857
diff changeset
    38
  static Flag::Error set_flag_from_jvalue(Flag* f, const void* value, Flag::Flags origin, FormatBuffer<80>& err_msg);
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    39
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    40
  // set a boolean global flag
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents: 49857
diff changeset
    41
  static Flag::Error set_bool_flag(const char* name, const char* value, Flag::Flags origin, FormatBuffer<80>& err_msg);
31236
d4d3011aa98e 8080947: Add uint as a valid VM flag type
david
parents: 28949
diff changeset
    42
  // set a int global flag
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents: 49857
diff changeset
    43
  static Flag::Error set_int_flag(const char* name, const char* value, Flag::Flags origin, FormatBuffer<80>& err_msg);
31236
d4d3011aa98e 8080947: Add uint as a valid VM flag type
david
parents: 28949
diff changeset
    44
  // set a uint global flag
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents: 49857
diff changeset
    45
  static Flag::Error set_uint_flag(const char* name, const char* value, Flag::Flags origin, FormatBuffer<80>& err_msg);
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    46
  // set a intx global flag
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents: 49857
diff changeset
    47
  static Flag::Error set_intx_flag(const char* name, const char* value, Flag::Flags origin, FormatBuffer<80>& err_msg);
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    48
  // set a uintx global flag
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents: 49857
diff changeset
    49
  static Flag::Error set_uintx_flag(const char* name, const char* value, Flag::Flags origin, FormatBuffer<80>& err_msg);
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    50
  // set a uint64_t global flag
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents: 49857
diff changeset
    51
  static Flag::Error set_uint64_t_flag(const char* name, const char* value, Flag::Flags origin, FormatBuffer<80>& err_msg);
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    52
  // set a size_t global flag using value from AttachOperation
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents: 49857
diff changeset
    53
  static Flag::Error set_size_t_flag(const char* name, const char* value, Flag::Flags origin, FormatBuffer<80>& err_msg);
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    54
  // set a boolean global flag
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents: 49857
diff changeset
    55
  static Flag::Error set_bool_flag(const char* name, bool value, Flag::Flags origin, FormatBuffer<80>& err_msg);
31236
d4d3011aa98e 8080947: Add uint as a valid VM flag type
david
parents: 28949
diff changeset
    56
  // set a int global flag
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents: 49857
diff changeset
    57
  static Flag::Error set_int_flag(const char* name, int value, Flag::Flags origin, FormatBuffer<80>& err_msg);
31236
d4d3011aa98e 8080947: Add uint as a valid VM flag type
david
parents: 28949
diff changeset
    58
  // set a uint global flag
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents: 49857
diff changeset
    59
  static Flag::Error set_uint_flag(const char* name, uint value, Flag::Flags origin, FormatBuffer<80>& err_msg);
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    60
  // set a intx global flag
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents: 49857
diff changeset
    61
  static Flag::Error set_intx_flag(const char* name, intx value, Flag::Flags origin, FormatBuffer<80>& err_msg);
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    62
  // set a uintx global flag
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents: 49857
diff changeset
    63
  static Flag::Error set_uintx_flag(const char* name, uintx value, Flag::Flags origin, FormatBuffer<80>& err_msg);
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    64
  // set a uint64_t global flag
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents: 49857
diff changeset
    65
  static Flag::Error set_uint64_t_flag(const char* name, uint64_t value, Flag::Flags origin, FormatBuffer<80>& err_msg);
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    66
  // set a size_t global flag using value from AttachOperation
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents: 49857
diff changeset
    67
  static Flag::Error set_size_t_flag(const char* name, size_t value, Flag::Flags origin, FormatBuffer<80>& err_msg);
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    68
  // set a string global flag
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents: 49857
diff changeset
    69
  static Flag::Error set_ccstr_flag(const char* name, const char* value, Flag::Flags origin, FormatBuffer<80>& err_msg);
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    70
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    71
public:
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    72
  /* 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
    73
   *
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    74
   * - 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
    75
   * - 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
    76
   */
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents: 49857
diff changeset
    77
  static Flag::Error set_flag(const char* flag_name, const char* flag_value, Flag::Flags origin, FormatBuffer<80>& err_msg);
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    78
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    79
  /* 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
    80
   *
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    81
   * - 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
    82
   * - 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
    83
   */
49860
ca5216a2a2cc 8202151: [BACKOUT] Split globals.hpp to factor out the Flag class
gziemski
parents: 49857
diff changeset
    84
  static Flag::Error set_flag(const char* flag_name, jvalue flag_value, Flag::Flags origin, FormatBuffer<80>& err_msg);
28949
c6f50d62ecef 8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff changeset
    85
};
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
#endif /* SHARE_VM_SERVICES_WRITEABLEFLAG_HPP */