author | phh |
Sat, 30 Nov 2019 14:33:05 -0800 | |
changeset 59330 | 5b96c12f909d |
parent 59241 | 23ecaf949f8f |
permissions | -rw-r--r-- |
39406
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
1 |
/* |
59241 | 2 |
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. |
39406
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
4 |
* |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
8 |
* |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
13 |
* accompanied this code). |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
14 |
* |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
18 |
* |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
21 |
* questions. |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
22 |
*/ |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
23 |
|
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
24 |
#include "precompiled.hpp" |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
25 |
#include "runtime/globals.hpp" |
49902
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
diff
changeset
|
26 |
#include "runtime/flags/flagSetting.hpp" |
58044 | 27 |
#include "runtime/flags/jvmFlag.hpp" |
39406
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
28 |
#include "unittest.hpp" |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
29 |
|
49902
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
diff
changeset
|
30 |
#define TEST_FLAG(f, type, value) \ |
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
diff
changeset
|
31 |
do { \ |
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
diff
changeset
|
32 |
ASSERT_TRUE(JVMFlag::find_flag(#f)->is_ ## type()); \ |
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
diff
changeset
|
33 |
type original_value = f; \ |
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
diff
changeset
|
34 |
{ \ |
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
diff
changeset
|
35 |
FLAG_GUARD(f); \ |
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
diff
changeset
|
36 |
f = value; \ |
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
diff
changeset
|
37 |
} \ |
3661f31c6df4
8202150: [REDO] Split globals.hpp to factor out the Flag class
gziemski
parents:
49860
diff
changeset
|
38 |
ASSERT_EQ(original_value, f); \ |
39406
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
39 |
} while (0) |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
40 |
|
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
41 |
TEST_VM(FlagGuard, bool_flag) { |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
42 |
TEST_FLAG(AlwaysActAsServerClassMachine, bool, true); |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
43 |
} |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
44 |
|
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
45 |
TEST_VM(FlagGuard, int_flag) { |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
46 |
TEST_FLAG(ParGCArrayScanChunk, int, 1337); |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
47 |
} |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
48 |
|
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
49 |
TEST_VM(FlagGuard, intx_flag) { |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
50 |
TEST_FLAG(RefDiscoveryPolicy, intx, 1337); |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
51 |
} |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
52 |
|
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
53 |
TEST_VM(FlagGuard, uint_flag) { |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
54 |
TEST_FLAG(ConcGCThreads, uint, 1337); |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
55 |
} |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
56 |
|
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
57 |
TEST_VM(FlagGuard, size_t_flag) { |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
58 |
TEST_FLAG(HeapSizePerGCThread, size_t, 1337); |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
59 |
} |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
60 |
|
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
61 |
TEST_VM(FlagGuard, uint64_t_flag) { |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
62 |
TEST_FLAG(MaxRAM, uint64_t, 1337); |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
63 |
} |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
64 |
|
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
65 |
TEST_VM(FlagGuard, double_flag) { |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
66 |
TEST_FLAG(CompileThresholdScaling, double, 3.141569); |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
67 |
} |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
68 |
|
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
69 |
TEST_VM(FlagGuard, ccstr_flag) { |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
70 |
TEST_FLAG(PerfDataSaveFile, ccstr, "/a/random/path"); |
e0a7495281a7
8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff
changeset
|
71 |
} |