1 | /* |
2 | * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. |
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 | * |
5 | * This code is free software; you can redistribute it and/or modify it |
6 | * under the terms of the GNU General Public License version 2 only, as |
7 | * published by the Free Software Foundation. |
8 | * |
9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
12 | * version 2 for more details (a copy is included in the LICENSE file that |
13 | * accompanied this code). |
14 | * |
15 | * You should have received a copy of the GNU General Public License version |
16 | * 2 along with this work; if not, write to the Free Software Foundation, |
17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
18 | * |
19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 | * or visit www.oracle.com if you need additional information or have any |
21 | * questions. |
22 | * |
23 | */ |
24 | |
25 | #ifndef SHARE_RUNTIME_FLAGS_JVMFLAGWRITEABLELIST_HPP |
26 | #define SHARE_RUNTIME_FLAGS_JVMFLAGWRITEABLELIST_HPP |
27 | |
28 | #include "utilities/growableArray.hpp" |
29 | |
30 | class JVMFlagWriteable : public CHeapObj<mtArguments> { |
31 | public: |
32 | enum WriteableType { |
33 | // can be set without any limits |
34 | Always = 0, |
35 | // can only be set once, either via command lines or during runtime |
36 | Once = 1, |
37 | // can only be set on command line (multiple times allowed) |
38 | CommandLineOnly = 2 |
39 | }; |
40 | private: |
41 | const char* _name; |
42 | WriteableType _type; |
43 | bool _writeable; |
44 | bool _startup_done; |
45 | public: |
46 | // the "name" argument must be a string literal |
47 | JVMFlagWriteable(const char* name, WriteableType type) { _name=name; _type=type; _writeable=true; _startup_done=false; } |
48 | ~JVMFlagWriteable() {} |
49 | const char* name() { return _name; } |
50 | const WriteableType type() { return _type; } |
51 | bool is_writeable(void); |
52 | void mark_once(void); |
53 | void mark_startup(void); |
54 | }; |
55 | |
56 | class JVMFlagWriteableList : public AllStatic { |
57 | static GrowableArray<JVMFlagWriteable*>* _controls; |
58 | public: |
59 | static void init(); |
60 | static int length() { return (_controls != NULL) ? _controls->length() : 0; } |
61 | static JVMFlagWriteable* at(int i) { return (_controls != NULL) ? _controls->at(i) : NULL; } |
62 | static JVMFlagWriteable* find(const char* name); |
63 | static void add(JVMFlagWriteable* range) { _controls->append(range); } |
64 | static void mark_startup(void); |
65 | }; |
66 | |
67 | #endif // SHARE_RUNTIME_FLAGS_JVMFLAGWRITEABLELIST_HPP |
68 | |