author | dcubed |
Wed, 18 Sep 2019 20:49:13 -0400 | |
changeset 58223 | 778fc2dcbdaa |
parent 53244 | 9807daeb47c4 |
permissions | -rw-r--r-- |
28949
c6f50d62ecef
8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff
changeset
|
1 |
/* |
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52417
diff
changeset
|
2 |
* Copyright (c) 2015, 2019, 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 |
|
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52417
diff
changeset
|
25 |
#ifndef SHARE_SERVICES_WRITEABLEFLAGS_HPP |
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52417
diff
changeset
|
26 |
#define SHARE_SERVICES_WRITEABLEFLAGS_HPP |
28949
c6f50d62ecef
8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff
changeset
|
27 |
|
49902
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
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 |
49902
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
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 |
49902
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
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 |
49902
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
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 |
49902
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
diff
changeset
|
42 |
static JVMFlag::Error set_bool_flag(const char* name, const char* value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg); |
31236 | 43 |
// set a int global flag |
49902
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
diff
changeset
|
44 |
static JVMFlag::Error set_int_flag(const char* name, const char* value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg); |
31236 | 45 |
// set a uint global flag |
49902
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
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 |
49902
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
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 |
49902
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
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 |
49902
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
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 |
49902
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
diff
changeset
|
54 |
static JVMFlag::Error set_size_t_flag(const char* name, const char* value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg); |
52417
439b4a9b5a2e
8212883: Setting a double manageable flag with jcmd/jinfo crashes the JVM
tonyp
parents:
49902
diff
changeset
|
55 |
// set a double global flag using value from AttachOperation |
439b4a9b5a2e
8212883: Setting a double manageable flag with jcmd/jinfo crashes the JVM
tonyp
parents:
49902
diff
changeset
|
56 |
static JVMFlag::Error set_double_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
|
57 |
// set a boolean global flag |
49902
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
diff
changeset
|
58 |
static JVMFlag::Error set_bool_flag(const char* name, bool value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg); |
31236 | 59 |
// set a int global flag |
49902
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
diff
changeset
|
60 |
static JVMFlag::Error set_int_flag(const char* name, int value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg); |
31236 | 61 |
// set a uint global flag |
49902
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
diff
changeset
|
62 |
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
|
63 |
// set a intx global flag |
49902
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
diff
changeset
|
64 |
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
|
65 |
// set a uintx global flag |
49902
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
diff
changeset
|
66 |
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
|
67 |
// set a uint64_t global flag |
49902
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
diff
changeset
|
68 |
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
|
69 |
// set a size_t global flag using value from AttachOperation |
49902
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
diff
changeset
|
70 |
static JVMFlag::Error set_size_t_flag(const char* name, size_t value, JVMFlag::Flags origin, FormatBuffer<80>& err_msg); |
52417
439b4a9b5a2e
8212883: Setting a double manageable flag with jcmd/jinfo crashes the JVM
tonyp
parents:
49902
diff
changeset
|
71 |
// set a double global flag using value from AttachOperation |
439b4a9b5a2e
8212883: Setting a double manageable flag with jcmd/jinfo crashes the JVM
tonyp
parents:
49902
diff
changeset
|
72 |
static JVMFlag::Error set_double_flag(const char* name, double 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
|
73 |
// set a string global flag |
49902
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
diff
changeset
|
74 |
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
|
75 |
|
c6f50d62ecef
8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff
changeset
|
76 |
public: |
c6f50d62ecef
8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff
changeset
|
77 |
/* 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
|
78 |
* |
c6f50d62ecef
8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff
changeset
|
79 |
* - 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
|
80 |
* - 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
|
81 |
*/ |
49902
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
diff
changeset
|
82 |
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
|
83 |
|
c6f50d62ecef
8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff
changeset
|
84 |
/* 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
|
85 |
* |
c6f50d62ecef
8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff
changeset
|
86 |
* - 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
|
87 |
* - 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
|
88 |
*/ |
49902
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
diff
changeset
|
89 |
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
|
90 |
}; |
c6f50d62ecef
8067447: Factor out the shared implementation of the VM flags manipulation code
jbachorik
parents:
diff
changeset
|
91 |
|
53244
9807daeb47c4
8216167: Update include guards to reflect correct directories
coleenp
parents:
52417
diff
changeset
|
92 |
#endif // SHARE_SERVICES_WRITEABLEFLAGS_HPP |