test/hotspot/gtest/runtime/test_globals.cpp
author gziemski
Mon, 23 Apr 2018 10:59:39 -0500
changeset 49857 31e07291ae29
parent 47216 71c04702a3d5
child 49860 ca5216a2a2cc
permissions -rw-r--r--
8081519: Split globals.hpp to factor out the Flag class Summary: Factored out Flag out go globals, renamed to JVMFlag Reviewed-by: coleenp, dholmes, kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
39406
e0a7495281a7 8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff changeset
     1
/*
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 47216
diff changeset
     2
 * Copyright (c) 2016, 2018, 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"
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 47216
diff changeset
    26
#include "runtime/flags/flagSetting.hpp"
39406
e0a7495281a7 8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff changeset
    27
#include "unittest.hpp"
e0a7495281a7 8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff changeset
    28
49857
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 47216
diff changeset
    29
#define TEST_FLAG(f, type, value)                                \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 47216
diff changeset
    30
  do {                                                           \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 47216
diff changeset
    31
    ASSERT_TRUE(JVMFlag::find_flag(#f)->is_ ## type());          \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 47216
diff changeset
    32
    type original_value = f;                                     \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 47216
diff changeset
    33
    {                                                            \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 47216
diff changeset
    34
      FLAG_GUARD(f);                                             \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 47216
diff changeset
    35
      f = value;                                                 \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 47216
diff changeset
    36
    }                                                            \
31e07291ae29 8081519: Split globals.hpp to factor out the Flag class
gziemski
parents: 47216
diff changeset
    37
    ASSERT_EQ(original_value, f);                                \
39406
e0a7495281a7 8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff changeset
    38
  } while (0)
e0a7495281a7 8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff changeset
    39
e0a7495281a7 8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff changeset
    40
TEST_VM(FlagGuard, bool_flag) {
e0a7495281a7 8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff changeset
    41
  TEST_FLAG(AlwaysActAsServerClassMachine, bool, true);
e0a7495281a7 8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff changeset
    42
}
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
TEST_VM(FlagGuard, int_flag) {
e0a7495281a7 8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff changeset
    45
  TEST_FLAG(ParGCArrayScanChunk, int, 1337);
e0a7495281a7 8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff changeset
    46
}
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
TEST_VM(FlagGuard, intx_flag) {
e0a7495281a7 8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff changeset
    49
  TEST_FLAG(RefDiscoveryPolicy, intx, 1337);
e0a7495281a7 8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff changeset
    50
}
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
TEST_VM(FlagGuard, uint_flag) {
e0a7495281a7 8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff changeset
    53
  TEST_FLAG(ConcGCThreads, uint, 1337);
e0a7495281a7 8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff changeset
    54
}
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
TEST_VM(FlagGuard, uintx_flag) {
44522
b10606c613ef 8177963: Parallel GC fails fast when per-thread task log overflows
ysr
parents: 41705
diff changeset
    57
  TEST_FLAG(GCTaskTimeStampEntries, uint, 1337);
39406
e0a7495281a7 8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff changeset
    58
}
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
TEST_VM(FlagGuard, size_t_flag) {
e0a7495281a7 8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff changeset
    61
  TEST_FLAG(HeapSizePerGCThread, size_t, 1337);
e0a7495281a7 8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff changeset
    62
}
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
TEST_VM(FlagGuard, uint64_t_flag) {
e0a7495281a7 8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff changeset
    65
  TEST_FLAG(MaxRAM, uint64_t, 1337);
e0a7495281a7 8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff changeset
    66
}
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
TEST_VM(FlagGuard, double_flag) {
e0a7495281a7 8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff changeset
    69
  TEST_FLAG(CompileThresholdScaling, double, 3.141569);
e0a7495281a7 8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff changeset
    70
}
e0a7495281a7 8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff changeset
    71
e0a7495281a7 8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff changeset
    72
TEST_VM(FlagGuard, ccstr_flag) {
e0a7495281a7 8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff changeset
    73
  TEST_FLAG(PerfDataSaveFile, ccstr, "/a/random/path");
e0a7495281a7 8159370: Add FlagGuard for easier modification of flags for unit tests
ehelin
parents:
diff changeset
    74
}