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