Bug Summary

File:jdk/test/hotspot/gtest/runtime/test_mutex.cpp
Warning:line 290, column 12
Value stored to 'monitor_rank_broken' during its initialization is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name test_mutex.cpp -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -mthread-model posix -fno-delete-null-pointer-checks -mframe-pointer=all -relaxed-aliasing -fmath-errno -fno-rounding-math -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -dwarf-column-info -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib/llvm-10/lib/clang/10.0.0 -I /home/daniel/Projects/java/jdk/build/linux-x86_64-server-fastdebug/hotspot/variant-server/libjvm/gtest/objs/precompiled -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -D __STDC_CONSTANT_MACROS -D _GNU_SOURCE -D _REENTRANT -D LIBC=gnu -D LINUX -D VM_LITTLE_ENDIAN -D _LP64=1 -D ASSERT -D CHECK_UNHANDLED_OOPS -D TARGET_ARCH_x86 -D INCLUDE_SUFFIX_OS=_linux -D INCLUDE_SUFFIX_CPU=_x86 -D INCLUDE_SUFFIX_COMPILER=_gcc -D TARGET_COMPILER_gcc -D AMD64 -D HOTSPOT_LIB_ARCH="amd64" -D COMPILER1 -D COMPILER2 -I /home/daniel/Projects/java/jdk/build/linux-x86_64-server-fastdebug/hotspot/variant-server/gensrc/adfiles -I /home/daniel/Projects/java/jdk/src/hotspot/share -I /home/daniel/Projects/java/jdk/src/hotspot/os/linux -I /home/daniel/Projects/java/jdk/src/hotspot/os/posix -I /home/daniel/Projects/java/jdk/src/hotspot/cpu/x86 -I /home/daniel/Projects/java/jdk/src/hotspot/os_cpu/linux_x86 -I /home/daniel/Projects/java/jdk/build/linux-x86_64-server-fastdebug/hotspot/variant-server/gensrc -I /home/daniel/Projects/java/jdk/src/hotspot/share/precompiled -I /home/daniel/Projects/java/jdk/src/hotspot/share/include -I /home/daniel/Projects/java/jdk/src/hotspot/os/posix/include -I /home/daniel/Projects/java/jdk/build/linux-x86_64-server-fastdebug/support/modules_include/java.base -I /home/daniel/Projects/java/jdk/build/linux-x86_64-server-fastdebug/support/modules_include/java.base/linux -I /home/daniel/Projects/java/jdk/src/java.base/share/native/libjimage -I /home/daniel/Projects/java/googletest/googletest/include -I /home/daniel/Projects/java/googletest/googlemock/include -I /home/daniel/Projects/java/jdk/test/hotspot/gtest -I /home/daniel/Projects/java/jdk/test/hotspot/gtest -D _FORTIFY_SOURCE=2 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/x86_64-linux-gnu/c++/7.5.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/x86_64-linux-gnu/c++/7.5.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/backward -internal-isystem /usr/local/include -internal-isystem /usr/lib/llvm-10/lib/clang/10.0.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -Wno-format-zero-length -Wno-unused-parameter -Wno-unused -Wno-parentheses -Wno-comment -Wno-unknown-pragmas -Wno-address -Wno-delete-non-virtual-dtor -Wno-char-subscripts -Wno-array-bounds -Wno-int-in-bool-context -Wno-ignored-qualifiers -Wno-missing-field-initializers -Wno-implicit-fallthrough -Wno-empty-body -Wno-strict-overflow -Wno-sequence-point -Wno-maybe-uninitialized -Wno-misleading-indentation -Wno-cast-function-type -Wno-shift-negative-value -Wno-undef -Wno-stringop-overflow -std=c++14 -fdeprecated-macro -fdebug-compilation-dir /home/daniel/Projects/java/jdk/make/hotspot -ferror-limit 19 -fmessage-length 0 -fvisibility hidden -stack-protector 1 -fno-rtti -fgnuc-version=4.2.1 -fobjc-runtime=gcc -fdiagnostics-show-option -vectorize-loops -vectorize-slp -analyzer-output=html -faddrsig -o /home/daniel/Projects/java/scan/2021-12-21-193737-8510-1 -x c++ /home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp
1/*
2 * Copyright (c) 2020, 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#include "precompiled.hpp"
25#include "runtime/interfaceSupport.inline.hpp"
26#include "runtime/mutex.hpp"
27#include "runtime/mutexLocker.hpp"
28#include "runtime/thread.hpp"
29#include "utilities/formatBuffer.hpp"
30#include "threadHelper.inline.hpp"
31#include "unittest.hpp"
32
33const int iterations = 10;
34static Mutex* m[iterations];
35static int i = 0;
36
37static void create_mutex(Thread* thr) {
38 m[i] = new Mutex(Mutex::nosafepoint, FormatBuffer<128>("MyLock#%u_lock", i));
39 i++;
40}
41
42TEST_VM(MutexName, mutex_name)class MutexName_mutex_name_vm_Test : public ::testing::Test {
public: MutexName_mutex_name_vm_Test() {} private: virtual void
TestBody(); static ::testing::TestInfo* const test_info_ __attribute__
((unused)); MutexName_mutex_name_vm_Test(MutexName_mutex_name_vm_Test
const &) = delete; void operator=(MutexName_mutex_name_vm_Test
const &) = delete;};::testing::TestInfo* const MutexName_mutex_name_vm_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexName", "mutex_name_vm", __null, __null, ::testing::internal
::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 42), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexName_mutex_name_vm_Test>
);void MutexName_mutex_name_vm_Test::TestBody()
{
43 // Create mutexes in threads, where the names are created on the thread
44 // stacks and then check that their names are correct.
45 for (int i = 0; i < iterations; i++) {
46 nomt_test_doer(create_mutex);
47 }
48 for (int i = 0; i < iterations; i++) {
49 FormatBuffer<128> f("MyLock#%u_lock", i);
50 ASSERT_STREQ(m[i]->name(), f.buffer())switch (0) case 0: default: if (const ::testing::AssertionResult
gtest_ar = (::testing::internal::CmpHelperSTREQ("m[i]->name()"
, "f.buffer()", m[i]->name(), f.buffer()))) ; else return ::
testing::internal::AssertHelper(::testing::TestPartResult::kFatalFailure
, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 50, gtest_ar.failure_message()) = ::testing::Message()
<< "Wrong name!";
51 }
52}
53
54#ifdef ASSERT1
55
56const Mutex::Rank rankA = Mutex::safepoint-5;
57const Mutex::Rank rankAplusOne = Mutex::safepoint-4;
58const Mutex::Rank rankAplusTwo = Mutex::safepoint-3;
59
60TEST_OTHER_VM(MutexRank, mutex_lock_rank_in_order)static void test_MutexRank_mutex_lock_rank_in_order_(); static
void child_MutexRank_mutex_lock_rank_in_order_() { ::testing
::FLAGS_gtest_throw_on_failure = true; test_MutexRank_mutex_lock_rank_in_order_
(); JavaVM* jvm[1]; jsize nVMs = 0; JNI_GetCreatedJavaVMs(&
jvm[0], 1, &nVMs); if (nVMs == 1) { int ret = jvm[0]->
DestroyJavaVM(); if (ret != 0) { fprintf(stderr, "Warning: DestroyJavaVM error %d\n"
, ret); } } fprintf(stderr, "OKIDOKI"); exit(0); } class MutexRank_mutex_lock_rank_in_order_other_vm_Test
: public ::testing::Test { public: MutexRank_mutex_lock_rank_in_order_other_vm_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_mutex_lock_rank_in_order_other_vm_Test
(MutexRank_mutex_lock_rank_in_order_other_vm_Test const &
) = delete; void operator=(MutexRank_mutex_lock_rank_in_order_other_vm_Test
const &) = delete;};::testing::TestInfo* const MutexRank_mutex_lock_rank_in_order_other_vm_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "mutex_lock_rank_in_order_other_vm", __null, __null
, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 60), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_mutex_lock_rank_in_order_other_vm_Test
>);void MutexRank_mutex_lock_rank_in_order_other_vm_Test::
TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= (".*OKIDOKI.*"); ::testing::internal::DeathTest* gtest_dt;
if (!::testing::internal::DeathTest::Create("child_MutexRank_mutex_lock_rank_in_order_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 60, &gtest_dt)) { goto gtest_label_60; } if (gtest_dt !=
__null) { ::testing::internal::scoped_ptr< ::testing::internal
::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt->
AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(0)(gtest_dt
->Wait()))) { goto gtest_label_60; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_mutex_lock_rank_in_order_()
; }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_60: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 60, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_mutex_lock_rank_in_order_(
)
{
61 JavaThread* THREAD__the_thread__ = JavaThread::current();
62 ThreadInVMfromNative invm(THREAD__the_thread__);
63
64 Mutex* mutex_rankA = new Mutex(rankA, "mutex_rankA");
65 Mutex* mutex_rankA_plus_one = new Mutex(rankAplusOne, "mutex_rankA_plus_one");
66
67 mutex_rankA_plus_one->lock();
68 mutex_rankA->lock();
69 mutex_rankA->unlock();
70 mutex_rankA_plus_one->unlock();
71}
72
73TEST_VM_ASSERT_MSG(MutexRank, mutex_lock_rank_out_of_orderA,static void test_MutexRank_mutex_lock_rank_out_of_orderA_(); static
void child_MutexRank_mutex_lock_rank_out_of_orderA_() { ::testing
::FLAGS_gtest_throw_on_failure = true; test_MutexRank_mutex_lock_rank_out_of_orderA_
(); exit(0); } class MutexRank_mutex_lock_rank_out_of_orderA_vm_assert_Test
: public ::testing::Test { public: MutexRank_mutex_lock_rank_out_of_orderA_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_mutex_lock_rank_out_of_orderA_vm_assert_Test
(MutexRank_mutex_lock_rank_out_of_orderA_vm_assert_Test const
&) = delete; void operator=(MutexRank_mutex_lock_rank_out_of_orderA_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_mutex_lock_rank_out_of_orderA_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "mutex_lock_rank_out_of_orderA_vm_assert", __null
, __null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 74), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_mutex_lock_rank_out_of_orderA_vm_assert_Test
>);void MutexRank_mutex_lock_rank_out_of_orderA_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".* Attempting to acquire lock mutex_rankA_plus_one/safepoint-4 out of order with lock mutex_rankA/safepoint-5 -- possible deadlock"
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexRank_mutex_lock_rank_out_of_orderA_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 74, &gtest_dt)) { goto gtest_label_74; } if (gtest_dt !=
__null) { ::testing::internal::scoped_ptr< ::testing::internal
::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt->
AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_74; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_mutex_lock_rank_out_of_orderA_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_74: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 74, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_mutex_lock_rank_out_of_orderA_
()
74 ".* Attempting to acquire lock mutex_rankA_plus_one/safepoint-4 out of order with lock mutex_rankA/safepoint-5 -- possible deadlock")static void test_MutexRank_mutex_lock_rank_out_of_orderA_(); static
void child_MutexRank_mutex_lock_rank_out_of_orderA_() { ::testing
::FLAGS_gtest_throw_on_failure = true; test_MutexRank_mutex_lock_rank_out_of_orderA_
(); exit(0); } class MutexRank_mutex_lock_rank_out_of_orderA_vm_assert_Test
: public ::testing::Test { public: MutexRank_mutex_lock_rank_out_of_orderA_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_mutex_lock_rank_out_of_orderA_vm_assert_Test
(MutexRank_mutex_lock_rank_out_of_orderA_vm_assert_Test const
&) = delete; void operator=(MutexRank_mutex_lock_rank_out_of_orderA_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_mutex_lock_rank_out_of_orderA_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "mutex_lock_rank_out_of_orderA_vm_assert", __null
, __null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 74), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_mutex_lock_rank_out_of_orderA_vm_assert_Test
>);void MutexRank_mutex_lock_rank_out_of_orderA_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".* Attempting to acquire lock mutex_rankA_plus_one/safepoint-4 out of order with lock mutex_rankA/safepoint-5 -- possible deadlock"
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexRank_mutex_lock_rank_out_of_orderA_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 74, &gtest_dt)) { goto gtest_label_74; } if (gtest_dt !=
__null) { ::testing::internal::scoped_ptr< ::testing::internal
::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt->
AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_74; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_mutex_lock_rank_out_of_orderA_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_74: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 74, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_mutex_lock_rank_out_of_orderA_
()
{
75 JavaThread* THREAD__the_thread__ = JavaThread::current();
76 ThreadInVMfromNative invm(THREAD__the_thread__);
77
78 Mutex* mutex_rankA = new Mutex(rankA, "mutex_rankA");
79 Mutex* mutex_rankA_plus_one = new Mutex(rankAplusOne, "mutex_rankA_plus_one");
80
81 mutex_rankA->lock();
82 mutex_rankA_plus_one->lock();
83 mutex_rankA_plus_one->unlock();
84 mutex_rankA->unlock();
85}
86
87TEST_VM_ASSERT_MSG(MutexRank, mutex_lock_rank_out_of_orderB,static void test_MutexRank_mutex_lock_rank_out_of_orderB_(); static
void child_MutexRank_mutex_lock_rank_out_of_orderB_() { ::testing
::FLAGS_gtest_throw_on_failure = true; test_MutexRank_mutex_lock_rank_out_of_orderB_
(); exit(0); } class MutexRank_mutex_lock_rank_out_of_orderB_vm_assert_Test
: public ::testing::Test { public: MutexRank_mutex_lock_rank_out_of_orderB_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_mutex_lock_rank_out_of_orderB_vm_assert_Test
(MutexRank_mutex_lock_rank_out_of_orderB_vm_assert_Test const
&) = delete; void operator=(MutexRank_mutex_lock_rank_out_of_orderB_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_mutex_lock_rank_out_of_orderB_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "mutex_lock_rank_out_of_orderB_vm_assert", __null
, __null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 88), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_mutex_lock_rank_out_of_orderB_vm_assert_Test
>);void MutexRank_mutex_lock_rank_out_of_orderB_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".* Attempting to acquire lock mutex_rankB/.* out of order with lock mutex_rankA/.* -- possible deadlock"
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexRank_mutex_lock_rank_out_of_orderB_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 88, &gtest_dt)) { goto gtest_label_88; } if (gtest_dt !=
__null) { ::testing::internal::scoped_ptr< ::testing::internal
::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt->
AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_88; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_mutex_lock_rank_out_of_orderB_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_88: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 88, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_mutex_lock_rank_out_of_orderB_
()
88 ".* Attempting to acquire lock mutex_rankB/.* out of order with lock mutex_rankA/.* -- possible deadlock")static void test_MutexRank_mutex_lock_rank_out_of_orderB_(); static
void child_MutexRank_mutex_lock_rank_out_of_orderB_() { ::testing
::FLAGS_gtest_throw_on_failure = true; test_MutexRank_mutex_lock_rank_out_of_orderB_
(); exit(0); } class MutexRank_mutex_lock_rank_out_of_orderB_vm_assert_Test
: public ::testing::Test { public: MutexRank_mutex_lock_rank_out_of_orderB_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_mutex_lock_rank_out_of_orderB_vm_assert_Test
(MutexRank_mutex_lock_rank_out_of_orderB_vm_assert_Test const
&) = delete; void operator=(MutexRank_mutex_lock_rank_out_of_orderB_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_mutex_lock_rank_out_of_orderB_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "mutex_lock_rank_out_of_orderB_vm_assert", __null
, __null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 88), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_mutex_lock_rank_out_of_orderB_vm_assert_Test
>);void MutexRank_mutex_lock_rank_out_of_orderB_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".* Attempting to acquire lock mutex_rankB/.* out of order with lock mutex_rankA/.* -- possible deadlock"
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexRank_mutex_lock_rank_out_of_orderB_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 88, &gtest_dt)) { goto gtest_label_88; } if (gtest_dt !=
__null) { ::testing::internal::scoped_ptr< ::testing::internal
::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt->
AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_88; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_mutex_lock_rank_out_of_orderB_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_88: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 88, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_mutex_lock_rank_out_of_orderB_
()
{
89 JavaThread* THREAD__the_thread__ = JavaThread::current();
90 ThreadInVMfromNative invm(THREAD__the_thread__);
91
92 Mutex* mutex_rankA = new Mutex(rankA, "mutex_rankA");
93 Mutex* mutex_rankB = new Mutex(rankA, "mutex_rankB");
94
95 mutex_rankA->lock();
96 mutex_rankB->lock();
97 mutex_rankB->unlock();
98 mutex_rankA->unlock();
99}
100
101TEST_OTHER_VM(MutexRank, mutex_trylock_rank_out_of_orderA)static void test_MutexRank_mutex_trylock_rank_out_of_orderA_(
); static void child_MutexRank_mutex_trylock_rank_out_of_orderA_
() { ::testing::FLAGS_gtest_throw_on_failure = true; test_MutexRank_mutex_trylock_rank_out_of_orderA_
(); JavaVM* jvm[1]; jsize nVMs = 0; JNI_GetCreatedJavaVMs(&
jvm[0], 1, &nVMs); if (nVMs == 1) { int ret = jvm[0]->
DestroyJavaVM(); if (ret != 0) { fprintf(stderr, "Warning: DestroyJavaVM error %d\n"
, ret); } } fprintf(stderr, "OKIDOKI"); exit(0); } class MutexRank_mutex_trylock_rank_out_of_orderA_other_vm_Test
: public ::testing::Test { public: MutexRank_mutex_trylock_rank_out_of_orderA_other_vm_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_mutex_trylock_rank_out_of_orderA_other_vm_Test
(MutexRank_mutex_trylock_rank_out_of_orderA_other_vm_Test const
&) = delete; void operator=(MutexRank_mutex_trylock_rank_out_of_orderA_other_vm_Test
const &) = delete;};::testing::TestInfo* const MutexRank_mutex_trylock_rank_out_of_orderA_other_vm_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "mutex_trylock_rank_out_of_orderA_other_vm", __null
, __null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 101), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_mutex_trylock_rank_out_of_orderA_other_vm_Test
>);void MutexRank_mutex_trylock_rank_out_of_orderA_other_vm_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= (".*OKIDOKI.*"); ::testing::internal::DeathTest* gtest_dt;
if (!::testing::internal::DeathTest::Create("child_MutexRank_mutex_trylock_rank_out_of_orderA_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 101, &gtest_dt)) { goto gtest_label_101; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(0)(gtest_dt
->Wait()))) { goto gtest_label_101; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_mutex_trylock_rank_out_of_orderA_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_101: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 101, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_mutex_trylock_rank_out_of_orderA_
()
{
102 JavaThread* THREAD__the_thread__ = JavaThread::current();
103 ThreadInVMfromNative invm(THREAD__the_thread__);
104
105 Mutex* mutex_rankA = new Mutex(rankA, "mutex_rankA");
106 Mutex* mutex_rankA_plus_one = new Mutex(rankAplusOne, "mutex_rankA_plus_one");
107 Mutex* mutex_rankA_plus_two = new Mutex(rankAplusTwo, "mutex_rankA_plus_two");
108
109 mutex_rankA_plus_one->lock();
110 mutex_rankA_plus_two->try_lock_without_rank_check();
111 mutex_rankA->lock();
112 mutex_rankA->unlock();
113 mutex_rankA_plus_two->unlock();
114 mutex_rankA_plus_one->unlock();
115}
116
117TEST_VM_ASSERT_MSG(MutexRank, mutex_trylock_rank_out_of_orderB,static void test_MutexRank_mutex_trylock_rank_out_of_orderB_(
); static void child_MutexRank_mutex_trylock_rank_out_of_orderB_
() { ::testing::FLAGS_gtest_throw_on_failure = true; test_MutexRank_mutex_trylock_rank_out_of_orderB_
(); exit(0); } class MutexRank_mutex_trylock_rank_out_of_orderB_vm_assert_Test
: public ::testing::Test { public: MutexRank_mutex_trylock_rank_out_of_orderB_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_mutex_trylock_rank_out_of_orderB_vm_assert_Test
(MutexRank_mutex_trylock_rank_out_of_orderB_vm_assert_Test const
&) = delete; void operator=(MutexRank_mutex_trylock_rank_out_of_orderB_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_mutex_trylock_rank_out_of_orderB_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "mutex_trylock_rank_out_of_orderB_vm_assert", __null
, __null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 118), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_mutex_trylock_rank_out_of_orderB_vm_assert_Test
>);void MutexRank_mutex_trylock_rank_out_of_orderB_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".* Attempting to acquire lock mutex_rankA_plus_one/.* out of order with lock mutex_rankA/.* -- possible deadlock"
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexRank_mutex_trylock_rank_out_of_orderB_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 118, &gtest_dt)) { goto gtest_label_118; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_118; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_mutex_trylock_rank_out_of_orderB_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_118: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 118, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_mutex_trylock_rank_out_of_orderB_
()
118 ".* Attempting to acquire lock mutex_rankA_plus_one/.* out of order with lock mutex_rankA/.* -- possible deadlock")static void test_MutexRank_mutex_trylock_rank_out_of_orderB_(
); static void child_MutexRank_mutex_trylock_rank_out_of_orderB_
() { ::testing::FLAGS_gtest_throw_on_failure = true; test_MutexRank_mutex_trylock_rank_out_of_orderB_
(); exit(0); } class MutexRank_mutex_trylock_rank_out_of_orderB_vm_assert_Test
: public ::testing::Test { public: MutexRank_mutex_trylock_rank_out_of_orderB_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_mutex_trylock_rank_out_of_orderB_vm_assert_Test
(MutexRank_mutex_trylock_rank_out_of_orderB_vm_assert_Test const
&) = delete; void operator=(MutexRank_mutex_trylock_rank_out_of_orderB_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_mutex_trylock_rank_out_of_orderB_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "mutex_trylock_rank_out_of_orderB_vm_assert", __null
, __null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 118), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_mutex_trylock_rank_out_of_orderB_vm_assert_Test
>);void MutexRank_mutex_trylock_rank_out_of_orderB_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".* Attempting to acquire lock mutex_rankA_plus_one/.* out of order with lock mutex_rankA/.* -- possible deadlock"
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexRank_mutex_trylock_rank_out_of_orderB_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 118, &gtest_dt)) { goto gtest_label_118; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_118; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_mutex_trylock_rank_out_of_orderB_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_118: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 118, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_mutex_trylock_rank_out_of_orderB_
()
{
119 JavaThread* THREAD__the_thread__ = JavaThread::current();
120 ThreadInVMfromNative invm(THREAD__the_thread__);
121
122 Mutex* mutex_rankA = new Mutex(rankA, "mutex_rankA");
123 Mutex* mutex_rankA_plus_one = new Mutex(rankAplusOne, "mutex_rankA_plus_one");
124
125 mutex_rankA->lock();
126 mutex_rankA_plus_one->try_lock_without_rank_check();
127 mutex_rankA_plus_one->unlock();
128 mutex_rankA_plus_one->try_lock();
129 mutex_rankA_plus_one->unlock();
130 mutex_rankA->unlock();
131}
132
133TEST_VM_ASSERT_MSG(MutexRank, mutex_lock_event_nosafepoint,static void test_MutexRank_mutex_lock_event_nosafepoint_(); static
void child_MutexRank_mutex_lock_event_nosafepoint_() { ::testing
::FLAGS_gtest_throw_on_failure = true; test_MutexRank_mutex_lock_event_nosafepoint_
(); exit(0); } class MutexRank_mutex_lock_event_nosafepoint_vm_assert_Test
: public ::testing::Test { public: MutexRank_mutex_lock_event_nosafepoint_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_mutex_lock_event_nosafepoint_vm_assert_Test
(MutexRank_mutex_lock_event_nosafepoint_vm_assert_Test const &
) = delete; void operator=(MutexRank_mutex_lock_event_nosafepoint_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_mutex_lock_event_nosafepoint_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "mutex_lock_event_nosafepoint_vm_assert", __null
, __null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 135), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_mutex_lock_event_nosafepoint_vm_assert_Test
>);void MutexRank_mutex_lock_event_nosafepoint_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".* Attempting to acquire lock mutex_rank_nosafepoint/nosafepoint out of order with lock mutex_rank_event/event "
"-- possible deadlock"); ::testing::internal::DeathTest* gtest_dt
; if (!::testing::internal::DeathTest::Create("child_MutexRank_mutex_lock_event_nosafepoint_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 135, &gtest_dt)) { goto gtest_label_135; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_135; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_mutex_lock_event_nosafepoint_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_135: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 135, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_mutex_lock_event_nosafepoint_
()
134 ".* Attempting to acquire lock mutex_rank_nosafepoint/nosafepoint out of order with lock mutex_rank_event/event "static void test_MutexRank_mutex_lock_event_nosafepoint_(); static
void child_MutexRank_mutex_lock_event_nosafepoint_() { ::testing
::FLAGS_gtest_throw_on_failure = true; test_MutexRank_mutex_lock_event_nosafepoint_
(); exit(0); } class MutexRank_mutex_lock_event_nosafepoint_vm_assert_Test
: public ::testing::Test { public: MutexRank_mutex_lock_event_nosafepoint_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_mutex_lock_event_nosafepoint_vm_assert_Test
(MutexRank_mutex_lock_event_nosafepoint_vm_assert_Test const &
) = delete; void operator=(MutexRank_mutex_lock_event_nosafepoint_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_mutex_lock_event_nosafepoint_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "mutex_lock_event_nosafepoint_vm_assert", __null
, __null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 135), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_mutex_lock_event_nosafepoint_vm_assert_Test
>);void MutexRank_mutex_lock_event_nosafepoint_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".* Attempting to acquire lock mutex_rank_nosafepoint/nosafepoint out of order with lock mutex_rank_event/event "
"-- possible deadlock"); ::testing::internal::DeathTest* gtest_dt
; if (!::testing::internal::DeathTest::Create("child_MutexRank_mutex_lock_event_nosafepoint_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 135, &gtest_dt)) { goto gtest_label_135; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_135; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_mutex_lock_event_nosafepoint_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_135: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 135, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_mutex_lock_event_nosafepoint_
()
135 "-- possible deadlock")static void test_MutexRank_mutex_lock_event_nosafepoint_(); static
void child_MutexRank_mutex_lock_event_nosafepoint_() { ::testing
::FLAGS_gtest_throw_on_failure = true; test_MutexRank_mutex_lock_event_nosafepoint_
(); exit(0); } class MutexRank_mutex_lock_event_nosafepoint_vm_assert_Test
: public ::testing::Test { public: MutexRank_mutex_lock_event_nosafepoint_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_mutex_lock_event_nosafepoint_vm_assert_Test
(MutexRank_mutex_lock_event_nosafepoint_vm_assert_Test const &
) = delete; void operator=(MutexRank_mutex_lock_event_nosafepoint_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_mutex_lock_event_nosafepoint_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "mutex_lock_event_nosafepoint_vm_assert", __null
, __null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 135), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_mutex_lock_event_nosafepoint_vm_assert_Test
>);void MutexRank_mutex_lock_event_nosafepoint_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".* Attempting to acquire lock mutex_rank_nosafepoint/nosafepoint out of order with lock mutex_rank_event/event "
"-- possible deadlock"); ::testing::internal::DeathTest* gtest_dt
; if (!::testing::internal::DeathTest::Create("child_MutexRank_mutex_lock_event_nosafepoint_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 135, &gtest_dt)) { goto gtest_label_135; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_135; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_mutex_lock_event_nosafepoint_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_135: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 135, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_mutex_lock_event_nosafepoint_
()
{
136 JavaThread* THREAD__the_thread__ = JavaThread::current();
137 ThreadInVMfromNative invm(THREAD__the_thread__);
138
139 Mutex* mutex_rank_event = new Mutex(Mutex::event, "mutex_rank_event");
140 Mutex* mutex_rank_safepoint = new Mutex(Mutex::nosafepoint, "mutex_rank_nosafepoint");
141
142 mutex_rank_event->lock_without_safepoint_check();
143 mutex_rank_safepoint->lock_without_safepoint_check();
144 mutex_rank_safepoint->unlock();
145 mutex_rank_event->unlock();
146}
147
148TEST_VM_ASSERT_MSG(MutexRank, mutex_lock_tty_nosafepoint,static void test_MutexRank_mutex_lock_tty_nosafepoint_(); static
void child_MutexRank_mutex_lock_tty_nosafepoint_() { ::testing
::FLAGS_gtest_throw_on_failure = true; test_MutexRank_mutex_lock_tty_nosafepoint_
(); exit(0); } class MutexRank_mutex_lock_tty_nosafepoint_vm_assert_Test
: public ::testing::Test { public: MutexRank_mutex_lock_tty_nosafepoint_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_mutex_lock_tty_nosafepoint_vm_assert_Test
(MutexRank_mutex_lock_tty_nosafepoint_vm_assert_Test const &
) = delete; void operator=(MutexRank_mutex_lock_tty_nosafepoint_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_mutex_lock_tty_nosafepoint_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "mutex_lock_tty_nosafepoint_vm_assert", __null,
__null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 150), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_mutex_lock_tty_nosafepoint_vm_assert_Test
>);void MutexRank_mutex_lock_tty_nosafepoint_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".* Attempting to acquire lock mutex_rank_nosafepoint/nosafepoint out of order with lock mutex_rank_tty/tty "
"-- possible deadlock"); ::testing::internal::DeathTest* gtest_dt
; if (!::testing::internal::DeathTest::Create("child_MutexRank_mutex_lock_tty_nosafepoint_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 150, &gtest_dt)) { goto gtest_label_150; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_150; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_mutex_lock_tty_nosafepoint_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_150: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 150, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_mutex_lock_tty_nosafepoint_
()
149 ".* Attempting to acquire lock mutex_rank_nosafepoint/nosafepoint out of order with lock mutex_rank_tty/tty "static void test_MutexRank_mutex_lock_tty_nosafepoint_(); static
void child_MutexRank_mutex_lock_tty_nosafepoint_() { ::testing
::FLAGS_gtest_throw_on_failure = true; test_MutexRank_mutex_lock_tty_nosafepoint_
(); exit(0); } class MutexRank_mutex_lock_tty_nosafepoint_vm_assert_Test
: public ::testing::Test { public: MutexRank_mutex_lock_tty_nosafepoint_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_mutex_lock_tty_nosafepoint_vm_assert_Test
(MutexRank_mutex_lock_tty_nosafepoint_vm_assert_Test const &
) = delete; void operator=(MutexRank_mutex_lock_tty_nosafepoint_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_mutex_lock_tty_nosafepoint_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "mutex_lock_tty_nosafepoint_vm_assert", __null,
__null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 150), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_mutex_lock_tty_nosafepoint_vm_assert_Test
>);void MutexRank_mutex_lock_tty_nosafepoint_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".* Attempting to acquire lock mutex_rank_nosafepoint/nosafepoint out of order with lock mutex_rank_tty/tty "
"-- possible deadlock"); ::testing::internal::DeathTest* gtest_dt
; if (!::testing::internal::DeathTest::Create("child_MutexRank_mutex_lock_tty_nosafepoint_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 150, &gtest_dt)) { goto gtest_label_150; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_150; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_mutex_lock_tty_nosafepoint_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_150: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 150, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_mutex_lock_tty_nosafepoint_
()
150 "-- possible deadlock")static void test_MutexRank_mutex_lock_tty_nosafepoint_(); static
void child_MutexRank_mutex_lock_tty_nosafepoint_() { ::testing
::FLAGS_gtest_throw_on_failure = true; test_MutexRank_mutex_lock_tty_nosafepoint_
(); exit(0); } class MutexRank_mutex_lock_tty_nosafepoint_vm_assert_Test
: public ::testing::Test { public: MutexRank_mutex_lock_tty_nosafepoint_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_mutex_lock_tty_nosafepoint_vm_assert_Test
(MutexRank_mutex_lock_tty_nosafepoint_vm_assert_Test const &
) = delete; void operator=(MutexRank_mutex_lock_tty_nosafepoint_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_mutex_lock_tty_nosafepoint_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "mutex_lock_tty_nosafepoint_vm_assert", __null,
__null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 150), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_mutex_lock_tty_nosafepoint_vm_assert_Test
>);void MutexRank_mutex_lock_tty_nosafepoint_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".* Attempting to acquire lock mutex_rank_nosafepoint/nosafepoint out of order with lock mutex_rank_tty/tty "
"-- possible deadlock"); ::testing::internal::DeathTest* gtest_dt
; if (!::testing::internal::DeathTest::Create("child_MutexRank_mutex_lock_tty_nosafepoint_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 150, &gtest_dt)) { goto gtest_label_150; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_150; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_mutex_lock_tty_nosafepoint_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_150: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 150, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_mutex_lock_tty_nosafepoint_
()
{
151 JavaThread* THREAD__the_thread__ = JavaThread::current();
152 ThreadInVMfromNative invm(THREAD__the_thread__);
153
154 Mutex* mutex_rank_tty = new Mutex(Mutex::tty, "mutex_rank_tty");
155 Mutex* mutex_rank_nosafepoint = new Mutex(Mutex::nosafepoint, "mutex_rank_nosafepoint");
156
157 mutex_rank_tty->lock_without_safepoint_check();
158 mutex_rank_nosafepoint->lock_without_safepoint_check();
159 mutex_rank_nosafepoint->unlock();
160 mutex_rank_tty->unlock();
161}
162
163TEST_OTHER_VM(MutexRank, monitor_wait_rank_in_order)static void test_MutexRank_monitor_wait_rank_in_order_(); static
void child_MutexRank_monitor_wait_rank_in_order_() { ::testing
::FLAGS_gtest_throw_on_failure = true; test_MutexRank_monitor_wait_rank_in_order_
(); JavaVM* jvm[1]; jsize nVMs = 0; JNI_GetCreatedJavaVMs(&
jvm[0], 1, &nVMs); if (nVMs == 1) { int ret = jvm[0]->
DestroyJavaVM(); if (ret != 0) { fprintf(stderr, "Warning: DestroyJavaVM error %d\n"
, ret); } } fprintf(stderr, "OKIDOKI"); exit(0); } class MutexRank_monitor_wait_rank_in_order_other_vm_Test
: public ::testing::Test { public: MutexRank_monitor_wait_rank_in_order_other_vm_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_monitor_wait_rank_in_order_other_vm_Test
(MutexRank_monitor_wait_rank_in_order_other_vm_Test const &
) = delete; void operator=(MutexRank_monitor_wait_rank_in_order_other_vm_Test
const &) = delete;};::testing::TestInfo* const MutexRank_monitor_wait_rank_in_order_other_vm_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "monitor_wait_rank_in_order_other_vm", __null, __null
, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 163), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_monitor_wait_rank_in_order_other_vm_Test
>);void MutexRank_monitor_wait_rank_in_order_other_vm_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= (".*OKIDOKI.*"); ::testing::internal::DeathTest* gtest_dt;
if (!::testing::internal::DeathTest::Create("child_MutexRank_monitor_wait_rank_in_order_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 163, &gtest_dt)) { goto gtest_label_163; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(0)(gtest_dt
->Wait()))) { goto gtest_label_163; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_monitor_wait_rank_in_order_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_163: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 163, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_monitor_wait_rank_in_order_
()
{
164 JavaThread* THREAD__the_thread__ = JavaThread::current();
165 ThreadInVMfromNative invm(THREAD__the_thread__);
166
167 Monitor* monitor_rankA = new Monitor(rankA, "monitor_rankA");
168 Monitor* monitor_rankA_plus_one = new Monitor(rankAplusOne, "monitor_rankA_plus_one");
169
170 monitor_rankA_plus_one->lock();
171 monitor_rankA->lock();
172 monitor_rankA->wait(1);
173 monitor_rankA->unlock();
174 monitor_rankA_plus_one->unlock();
175}
176
177TEST_VM_ASSERT_MSG(MutexRank, monitor_wait_rank_out_of_order,static void test_MutexRank_monitor_wait_rank_out_of_order_();
static void child_MutexRank_monitor_wait_rank_out_of_order_(
) { ::testing::FLAGS_gtest_throw_on_failure = true; test_MutexRank_monitor_wait_rank_out_of_order_
(); exit(0); } class MutexRank_monitor_wait_rank_out_of_order_vm_assert_Test
: public ::testing::Test { public: MutexRank_monitor_wait_rank_out_of_order_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_monitor_wait_rank_out_of_order_vm_assert_Test
(MutexRank_monitor_wait_rank_out_of_order_vm_assert_Test const
&) = delete; void operator=(MutexRank_monitor_wait_rank_out_of_order_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_monitor_wait_rank_out_of_order_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "monitor_wait_rank_out_of_order_vm_assert", __null
, __null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 179), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_monitor_wait_rank_out_of_order_vm_assert_Test
>);void MutexRank_monitor_wait_rank_out_of_order_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".* Attempting to wait on monitor monitor_rankA_plus_one/.* while holding lock monitor_rankA/.* "
"-- possible deadlock. Should wait on the least ranked monitor from all owned locks."
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexRank_monitor_wait_rank_out_of_order_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 179, &gtest_dt)) { goto gtest_label_179; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_179; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_monitor_wait_rank_out_of_order_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_179: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 179, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_monitor_wait_rank_out_of_order_
()
178 ".* Attempting to wait on monitor monitor_rankA_plus_one/.* while holding lock monitor_rankA/.* "static void test_MutexRank_monitor_wait_rank_out_of_order_();
static void child_MutexRank_monitor_wait_rank_out_of_order_(
) { ::testing::FLAGS_gtest_throw_on_failure = true; test_MutexRank_monitor_wait_rank_out_of_order_
(); exit(0); } class MutexRank_monitor_wait_rank_out_of_order_vm_assert_Test
: public ::testing::Test { public: MutexRank_monitor_wait_rank_out_of_order_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_monitor_wait_rank_out_of_order_vm_assert_Test
(MutexRank_monitor_wait_rank_out_of_order_vm_assert_Test const
&) = delete; void operator=(MutexRank_monitor_wait_rank_out_of_order_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_monitor_wait_rank_out_of_order_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "monitor_wait_rank_out_of_order_vm_assert", __null
, __null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 179), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_monitor_wait_rank_out_of_order_vm_assert_Test
>);void MutexRank_monitor_wait_rank_out_of_order_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".* Attempting to wait on monitor monitor_rankA_plus_one/.* while holding lock monitor_rankA/.* "
"-- possible deadlock. Should wait on the least ranked monitor from all owned locks."
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexRank_monitor_wait_rank_out_of_order_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 179, &gtest_dt)) { goto gtest_label_179; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_179; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_monitor_wait_rank_out_of_order_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_179: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 179, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_monitor_wait_rank_out_of_order_
()
179 "-- possible deadlock. Should wait on the least ranked monitor from all owned locks.")static void test_MutexRank_monitor_wait_rank_out_of_order_();
static void child_MutexRank_monitor_wait_rank_out_of_order_(
) { ::testing::FLAGS_gtest_throw_on_failure = true; test_MutexRank_monitor_wait_rank_out_of_order_
(); exit(0); } class MutexRank_monitor_wait_rank_out_of_order_vm_assert_Test
: public ::testing::Test { public: MutexRank_monitor_wait_rank_out_of_order_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_monitor_wait_rank_out_of_order_vm_assert_Test
(MutexRank_monitor_wait_rank_out_of_order_vm_assert_Test const
&) = delete; void operator=(MutexRank_monitor_wait_rank_out_of_order_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_monitor_wait_rank_out_of_order_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "monitor_wait_rank_out_of_order_vm_assert", __null
, __null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 179), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_monitor_wait_rank_out_of_order_vm_assert_Test
>);void MutexRank_monitor_wait_rank_out_of_order_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".* Attempting to wait on monitor monitor_rankA_plus_one/.* while holding lock monitor_rankA/.* "
"-- possible deadlock. Should wait on the least ranked monitor from all owned locks."
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexRank_monitor_wait_rank_out_of_order_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 179, &gtest_dt)) { goto gtest_label_179; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_179; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_monitor_wait_rank_out_of_order_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_179: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 179, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_monitor_wait_rank_out_of_order_
()
{
180 JavaThread* THREAD__the_thread__ = JavaThread::current();
181 ThreadInVMfromNative invm(THREAD__the_thread__);
182
183 Monitor* monitor_rankA = new Monitor(rankA, "monitor_rankA");
184 Monitor* monitor_rankA_plus_one = new Monitor(rankAplusOne, "monitor_rankA_plus_one");
185
186 monitor_rankA_plus_one->lock();
187 monitor_rankA->lock();
188 monitor_rankA_plus_one->wait(1);
189 monitor_rankA_plus_one->unlock();
190 monitor_rankA->unlock();
191}
192
193TEST_VM_ASSERT_MSG(MutexRank, monitor_wait_rank_out_of_order_trylock,static void test_MutexRank_monitor_wait_rank_out_of_order_trylock_
(); static void child_MutexRank_monitor_wait_rank_out_of_order_trylock_
() { ::testing::FLAGS_gtest_throw_on_failure = true; test_MutexRank_monitor_wait_rank_out_of_order_trylock_
(); exit(0); } class MutexRank_monitor_wait_rank_out_of_order_trylock_vm_assert_Test
: public ::testing::Test { public: MutexRank_monitor_wait_rank_out_of_order_trylock_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_monitor_wait_rank_out_of_order_trylock_vm_assert_Test
(MutexRank_monitor_wait_rank_out_of_order_trylock_vm_assert_Test
const &) = delete; void operator=(MutexRank_monitor_wait_rank_out_of_order_trylock_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_monitor_wait_rank_out_of_order_trylock_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "monitor_wait_rank_out_of_order_trylock_vm_assert"
, __null, __null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 195), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_monitor_wait_rank_out_of_order_trylock_vm_assert_Test
>);void MutexRank_monitor_wait_rank_out_of_order_trylock_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".* Attempting to wait on monitor monitor_rankA_plus_one/.* while holding lock monitor_rankA/.* "
"-- possible deadlock. Should wait on the least ranked monitor from all owned locks."
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexRank_monitor_wait_rank_out_of_order_trylock_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 195, &gtest_dt)) { goto gtest_label_195; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_195; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_monitor_wait_rank_out_of_order_trylock_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_195: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 195, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_monitor_wait_rank_out_of_order_trylock_
()
194 ".* Attempting to wait on monitor monitor_rankA_plus_one/.* while holding lock monitor_rankA/.* "static void test_MutexRank_monitor_wait_rank_out_of_order_trylock_
(); static void child_MutexRank_monitor_wait_rank_out_of_order_trylock_
() { ::testing::FLAGS_gtest_throw_on_failure = true; test_MutexRank_monitor_wait_rank_out_of_order_trylock_
(); exit(0); } class MutexRank_monitor_wait_rank_out_of_order_trylock_vm_assert_Test
: public ::testing::Test { public: MutexRank_monitor_wait_rank_out_of_order_trylock_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_monitor_wait_rank_out_of_order_trylock_vm_assert_Test
(MutexRank_monitor_wait_rank_out_of_order_trylock_vm_assert_Test
const &) = delete; void operator=(MutexRank_monitor_wait_rank_out_of_order_trylock_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_monitor_wait_rank_out_of_order_trylock_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "monitor_wait_rank_out_of_order_trylock_vm_assert"
, __null, __null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 195), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_monitor_wait_rank_out_of_order_trylock_vm_assert_Test
>);void MutexRank_monitor_wait_rank_out_of_order_trylock_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".* Attempting to wait on monitor monitor_rankA_plus_one/.* while holding lock monitor_rankA/.* "
"-- possible deadlock. Should wait on the least ranked monitor from all owned locks."
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexRank_monitor_wait_rank_out_of_order_trylock_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 195, &gtest_dt)) { goto gtest_label_195; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_195; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_monitor_wait_rank_out_of_order_trylock_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_195: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 195, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_monitor_wait_rank_out_of_order_trylock_
()
195 "-- possible deadlock. Should wait on the least ranked monitor from all owned locks.")static void test_MutexRank_monitor_wait_rank_out_of_order_trylock_
(); static void child_MutexRank_monitor_wait_rank_out_of_order_trylock_
() { ::testing::FLAGS_gtest_throw_on_failure = true; test_MutexRank_monitor_wait_rank_out_of_order_trylock_
(); exit(0); } class MutexRank_monitor_wait_rank_out_of_order_trylock_vm_assert_Test
: public ::testing::Test { public: MutexRank_monitor_wait_rank_out_of_order_trylock_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_monitor_wait_rank_out_of_order_trylock_vm_assert_Test
(MutexRank_monitor_wait_rank_out_of_order_trylock_vm_assert_Test
const &) = delete; void operator=(MutexRank_monitor_wait_rank_out_of_order_trylock_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_monitor_wait_rank_out_of_order_trylock_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "monitor_wait_rank_out_of_order_trylock_vm_assert"
, __null, __null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 195), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_monitor_wait_rank_out_of_order_trylock_vm_assert_Test
>);void MutexRank_monitor_wait_rank_out_of_order_trylock_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".* Attempting to wait on monitor monitor_rankA_plus_one/.* while holding lock monitor_rankA/.* "
"-- possible deadlock. Should wait on the least ranked monitor from all owned locks."
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexRank_monitor_wait_rank_out_of_order_trylock_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 195, &gtest_dt)) { goto gtest_label_195; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_195; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_monitor_wait_rank_out_of_order_trylock_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_195: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 195, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_monitor_wait_rank_out_of_order_trylock_
()
{
196 JavaThread* THREAD__the_thread__ = JavaThread::current();
197 ThreadInVMfromNative invm(THREAD__the_thread__);
198
199 Monitor* monitor_rankA = new Monitor(rankA, "monitor_rankA");
200 Monitor* monitor_rankA_plus_one = new Monitor(rankAplusOne, "monitor_rankA_plus_one");
201
202 monitor_rankA->lock();
203 monitor_rankA_plus_one->try_lock_without_rank_check();
204 monitor_rankA_plus_one->wait();
205 monitor_rankA_plus_one->unlock();
206 monitor_rankA->unlock();
207}
208
209TEST_VM_ASSERT_MSG(MutexRank, monitor_wait_rank_nosafepoint,static void test_MutexRank_monitor_wait_rank_nosafepoint_(); static
void child_MutexRank_monitor_wait_rank_nosafepoint_() { ::testing
::FLAGS_gtest_throw_on_failure = true; test_MutexRank_monitor_wait_rank_nosafepoint_
(); exit(0); } class MutexRank_monitor_wait_rank_nosafepoint_vm_assert_Test
: public ::testing::Test { public: MutexRank_monitor_wait_rank_nosafepoint_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_monitor_wait_rank_nosafepoint_vm_assert_Test
(MutexRank_monitor_wait_rank_nosafepoint_vm_assert_Test const
&) = delete; void operator=(MutexRank_monitor_wait_rank_nosafepoint_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_monitor_wait_rank_nosafepoint_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "monitor_wait_rank_nosafepoint_vm_assert", __null
, __null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 211), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_monitor_wait_rank_nosafepoint_vm_assert_Test
>);void MutexRank_monitor_wait_rank_nosafepoint_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".* Attempting to wait on monitor monitor_rank_nosafepoint_minus_one/.* while holding lock monitor_rank_nosafepoint/.*"
"-- possible deadlock. Should not block\\(wait\\) while holding a lock of rank nosafepoint or below."
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexRank_monitor_wait_rank_nosafepoint_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 211, &gtest_dt)) { goto gtest_label_211; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_211; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_monitor_wait_rank_nosafepoint_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_211: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 211, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_monitor_wait_rank_nosafepoint_
()
210 ".* Attempting to wait on monitor monitor_rank_nosafepoint_minus_one/.* while holding lock monitor_rank_nosafepoint/.*"static void test_MutexRank_monitor_wait_rank_nosafepoint_(); static
void child_MutexRank_monitor_wait_rank_nosafepoint_() { ::testing
::FLAGS_gtest_throw_on_failure = true; test_MutexRank_monitor_wait_rank_nosafepoint_
(); exit(0); } class MutexRank_monitor_wait_rank_nosafepoint_vm_assert_Test
: public ::testing::Test { public: MutexRank_monitor_wait_rank_nosafepoint_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_monitor_wait_rank_nosafepoint_vm_assert_Test
(MutexRank_monitor_wait_rank_nosafepoint_vm_assert_Test const
&) = delete; void operator=(MutexRank_monitor_wait_rank_nosafepoint_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_monitor_wait_rank_nosafepoint_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "monitor_wait_rank_nosafepoint_vm_assert", __null
, __null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 211), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_monitor_wait_rank_nosafepoint_vm_assert_Test
>);void MutexRank_monitor_wait_rank_nosafepoint_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".* Attempting to wait on monitor monitor_rank_nosafepoint_minus_one/.* while holding lock monitor_rank_nosafepoint/.*"
"-- possible deadlock. Should not block\\(wait\\) while holding a lock of rank nosafepoint or below."
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexRank_monitor_wait_rank_nosafepoint_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 211, &gtest_dt)) { goto gtest_label_211; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_211; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_monitor_wait_rank_nosafepoint_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_211: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 211, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_monitor_wait_rank_nosafepoint_
()
211 "-- possible deadlock. Should not block\\(wait\\) while holding a lock of rank nosafepoint or below.")static void test_MutexRank_monitor_wait_rank_nosafepoint_(); static
void child_MutexRank_monitor_wait_rank_nosafepoint_() { ::testing
::FLAGS_gtest_throw_on_failure = true; test_MutexRank_monitor_wait_rank_nosafepoint_
(); exit(0); } class MutexRank_monitor_wait_rank_nosafepoint_vm_assert_Test
: public ::testing::Test { public: MutexRank_monitor_wait_rank_nosafepoint_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_monitor_wait_rank_nosafepoint_vm_assert_Test
(MutexRank_monitor_wait_rank_nosafepoint_vm_assert_Test const
&) = delete; void operator=(MutexRank_monitor_wait_rank_nosafepoint_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_monitor_wait_rank_nosafepoint_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "monitor_wait_rank_nosafepoint_vm_assert", __null
, __null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 211), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_monitor_wait_rank_nosafepoint_vm_assert_Test
>);void MutexRank_monitor_wait_rank_nosafepoint_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".* Attempting to wait on monitor monitor_rank_nosafepoint_minus_one/.* while holding lock monitor_rank_nosafepoint/.*"
"-- possible deadlock. Should not block\\(wait\\) while holding a lock of rank nosafepoint or below."
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexRank_monitor_wait_rank_nosafepoint_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 211, &gtest_dt)) { goto gtest_label_211; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_211; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_monitor_wait_rank_nosafepoint_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_211: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 211, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_monitor_wait_rank_nosafepoint_
()
{
212 JavaThread* THREAD__the_thread__ = JavaThread::current();
213 ThreadInVMfromNative invm(THREAD__the_thread__);
214
215 Monitor* monitor_rank_nosafepoint = new Monitor(Mutex::nosafepoint, "monitor_rank_nosafepoint");
216 Monitor* monitor_rank_nosafepoint_minus_one = new Monitor(Mutex::nosafepoint - 1,
217 "monitor_rank_nosafepoint_minus_one");
218
219 monitor_rank_nosafepoint->lock_without_safepoint_check();
220 monitor_rank_nosafepoint_minus_one->lock_without_safepoint_check();
221 monitor_rank_nosafepoint_minus_one->wait_without_safepoint_check(1);
222 monitor_rank_nosafepoint_minus_one->unlock();
223 monitor_rank_nosafepoint->unlock();
224}
225
226// NonJavaThreads can't wait while holding tty lock or below.
227class VM_MutexWaitTTY : public VM_GTestExecuteAtSafepoint {
228 public:
229 void doit() {
230 Monitor* monitor_rank_tty = new Monitor(Mutex::tty, "monitor_rank_tty");
231 Monitor* monitor_rank_event = new Monitor(Mutex::event, "monitor_rank_event");
232
233 monitor_rank_tty->lock_without_safepoint_check();
234 monitor_rank_event->lock_without_safepoint_check();
235 monitor_rank_event->wait_without_safepoint_check(1);
236 monitor_rank_event->unlock();
237 monitor_rank_tty->unlock();
238 }
239};
240
241TEST_VM_ASSERT_MSG(MutexRank, monitor_wait_event_tty,static void test_MutexRank_monitor_wait_event_tty_(); static void
child_MutexRank_monitor_wait_event_tty_() { ::testing::FLAGS_gtest_throw_on_failure
= true; test_MutexRank_monitor_wait_event_tty_(); exit(0); }
class MutexRank_monitor_wait_event_tty_vm_assert_Test : public
::testing::Test { public: MutexRank_monitor_wait_event_tty_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_monitor_wait_event_tty_vm_assert_Test
(MutexRank_monitor_wait_event_tty_vm_assert_Test const &)
= delete; void operator=(MutexRank_monitor_wait_event_tty_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_monitor_wait_event_tty_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "monitor_wait_event_tty_vm_assert", __null, __null
, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 243), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_monitor_wait_event_tty_vm_assert_Test
>);void MutexRank_monitor_wait_event_tty_vm_assert_Test::TestBody
() { switch (0) case 0: default: if (::testing::internal::AlwaysTrue
()) { const ::testing::internal::RE& gtest_regex = ("assert failed: "
".* Attempting to wait on monitor monitor_rank_event/event while holding lock monitor_rank_tty/tty "
"-- possible deadlock. Should not block\\(wait\\) while holding a lock of rank tty or below."
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexRank_monitor_wait_event_tty_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 243, &gtest_dt)) { goto gtest_label_243; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_243; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_monitor_wait_event_tty_(); }
; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_243: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 243, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_monitor_wait_event_tty_()
242 ".* Attempting to wait on monitor monitor_rank_event/event while holding lock monitor_rank_tty/tty "static void test_MutexRank_monitor_wait_event_tty_(); static void
child_MutexRank_monitor_wait_event_tty_() { ::testing::FLAGS_gtest_throw_on_failure
= true; test_MutexRank_monitor_wait_event_tty_(); exit(0); }
class MutexRank_monitor_wait_event_tty_vm_assert_Test : public
::testing::Test { public: MutexRank_monitor_wait_event_tty_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_monitor_wait_event_tty_vm_assert_Test
(MutexRank_monitor_wait_event_tty_vm_assert_Test const &)
= delete; void operator=(MutexRank_monitor_wait_event_tty_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_monitor_wait_event_tty_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "monitor_wait_event_tty_vm_assert", __null, __null
, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 243), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_monitor_wait_event_tty_vm_assert_Test
>);void MutexRank_monitor_wait_event_tty_vm_assert_Test::TestBody
() { switch (0) case 0: default: if (::testing::internal::AlwaysTrue
()) { const ::testing::internal::RE& gtest_regex = ("assert failed: "
".* Attempting to wait on monitor monitor_rank_event/event while holding lock monitor_rank_tty/tty "
"-- possible deadlock. Should not block\\(wait\\) while holding a lock of rank tty or below."
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexRank_monitor_wait_event_tty_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 243, &gtest_dt)) { goto gtest_label_243; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_243; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_monitor_wait_event_tty_(); }
; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_243: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 243, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_monitor_wait_event_tty_()
243 "-- possible deadlock. Should not block\\(wait\\) while holding a lock of rank tty or below.")static void test_MutexRank_monitor_wait_event_tty_(); static void
child_MutexRank_monitor_wait_event_tty_() { ::testing::FLAGS_gtest_throw_on_failure
= true; test_MutexRank_monitor_wait_event_tty_(); exit(0); }
class MutexRank_monitor_wait_event_tty_vm_assert_Test : public
::testing::Test { public: MutexRank_monitor_wait_event_tty_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_monitor_wait_event_tty_vm_assert_Test
(MutexRank_monitor_wait_event_tty_vm_assert_Test const &)
= delete; void operator=(MutexRank_monitor_wait_event_tty_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_monitor_wait_event_tty_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "monitor_wait_event_tty_vm_assert", __null, __null
, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 243), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_monitor_wait_event_tty_vm_assert_Test
>);void MutexRank_monitor_wait_event_tty_vm_assert_Test::TestBody
() { switch (0) case 0: default: if (::testing::internal::AlwaysTrue
()) { const ::testing::internal::RE& gtest_regex = ("assert failed: "
".* Attempting to wait on monitor monitor_rank_event/event while holding lock monitor_rank_tty/tty "
"-- possible deadlock. Should not block\\(wait\\) while holding a lock of rank tty or below."
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexRank_monitor_wait_event_tty_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 243, &gtest_dt)) { goto gtest_label_243; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_243; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_monitor_wait_event_tty_(); }
; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_243: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 243, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_monitor_wait_event_tty_()
{
244 VM_MutexWaitTTY op;
245 ThreadInVMfromNative invm(JavaThread::current());
246 VMThread::execute(&op);
247}
248
249TEST_VM_ASSERT_MSG(MutexRank, monitor_wait_tty_nosafepoint,static void test_MutexRank_monitor_wait_tty_nosafepoint_(); static
void child_MutexRank_monitor_wait_tty_nosafepoint_() { ::testing
::FLAGS_gtest_throw_on_failure = true; test_MutexRank_monitor_wait_tty_nosafepoint_
(); exit(0); } class MutexRank_monitor_wait_tty_nosafepoint_vm_assert_Test
: public ::testing::Test { public: MutexRank_monitor_wait_tty_nosafepoint_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_monitor_wait_tty_nosafepoint_vm_assert_Test
(MutexRank_monitor_wait_tty_nosafepoint_vm_assert_Test const &
) = delete; void operator=(MutexRank_monitor_wait_tty_nosafepoint_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_monitor_wait_tty_nosafepoint_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "monitor_wait_tty_nosafepoint_vm_assert", __null
, __null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 251), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_monitor_wait_tty_nosafepoint_vm_assert_Test
>);void MutexRank_monitor_wait_tty_nosafepoint_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".* Attempting to wait on monitor monitor_rank_tty/.* while holding lock monitor_rank_nosafepoint/.* "
"-- possible deadlock. Should not block\\(wait\\) while holding a lock of rank nosafepoint or below."
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexRank_monitor_wait_tty_nosafepoint_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 251, &gtest_dt)) { goto gtest_label_251; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_251; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_monitor_wait_tty_nosafepoint_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_251: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 251, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_monitor_wait_tty_nosafepoint_
()
250 ".* Attempting to wait on monitor monitor_rank_tty/.* while holding lock monitor_rank_nosafepoint/.* "static void test_MutexRank_monitor_wait_tty_nosafepoint_(); static
void child_MutexRank_monitor_wait_tty_nosafepoint_() { ::testing
::FLAGS_gtest_throw_on_failure = true; test_MutexRank_monitor_wait_tty_nosafepoint_
(); exit(0); } class MutexRank_monitor_wait_tty_nosafepoint_vm_assert_Test
: public ::testing::Test { public: MutexRank_monitor_wait_tty_nosafepoint_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_monitor_wait_tty_nosafepoint_vm_assert_Test
(MutexRank_monitor_wait_tty_nosafepoint_vm_assert_Test const &
) = delete; void operator=(MutexRank_monitor_wait_tty_nosafepoint_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_monitor_wait_tty_nosafepoint_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "monitor_wait_tty_nosafepoint_vm_assert", __null
, __null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 251), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_monitor_wait_tty_nosafepoint_vm_assert_Test
>);void MutexRank_monitor_wait_tty_nosafepoint_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".* Attempting to wait on monitor monitor_rank_tty/.* while holding lock monitor_rank_nosafepoint/.* "
"-- possible deadlock. Should not block\\(wait\\) while holding a lock of rank nosafepoint or below."
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexRank_monitor_wait_tty_nosafepoint_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 251, &gtest_dt)) { goto gtest_label_251; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_251; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_monitor_wait_tty_nosafepoint_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_251: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 251, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_monitor_wait_tty_nosafepoint_
()
251 "-- possible deadlock. Should not block\\(wait\\) while holding a lock of rank nosafepoint or below.")static void test_MutexRank_monitor_wait_tty_nosafepoint_(); static
void child_MutexRank_monitor_wait_tty_nosafepoint_() { ::testing
::FLAGS_gtest_throw_on_failure = true; test_MutexRank_monitor_wait_tty_nosafepoint_
(); exit(0); } class MutexRank_monitor_wait_tty_nosafepoint_vm_assert_Test
: public ::testing::Test { public: MutexRank_monitor_wait_tty_nosafepoint_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_monitor_wait_tty_nosafepoint_vm_assert_Test
(MutexRank_monitor_wait_tty_nosafepoint_vm_assert_Test const &
) = delete; void operator=(MutexRank_monitor_wait_tty_nosafepoint_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_monitor_wait_tty_nosafepoint_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "monitor_wait_tty_nosafepoint_vm_assert", __null
, __null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 251), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_monitor_wait_tty_nosafepoint_vm_assert_Test
>);void MutexRank_monitor_wait_tty_nosafepoint_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".* Attempting to wait on monitor monitor_rank_tty/.* while holding lock monitor_rank_nosafepoint/.* "
"-- possible deadlock. Should not block\\(wait\\) while holding a lock of rank nosafepoint or below."
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexRank_monitor_wait_tty_nosafepoint_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 251, &gtest_dt)) { goto gtest_label_251; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_251; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_monitor_wait_tty_nosafepoint_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_251: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 251, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_monitor_wait_tty_nosafepoint_
()
{
252 JavaThread* THREAD__the_thread__ = JavaThread::current();
253 ThreadInVMfromNative invm(THREAD__the_thread__);
254
255 Monitor* monitor_rank_nosafepoint = new Monitor(Mutex::nosafepoint, "monitor_rank_nosafepoint");
256 Monitor* monitor_rank_tty = new Monitor(Mutex::tty, "monitor_rank_tty");
257
258 monitor_rank_nosafepoint->lock_without_safepoint_check();
259 monitor_rank_tty->lock_without_safepoint_check();
260 monitor_rank_tty->wait_without_safepoint_check(1);
261 monitor_rank_tty->unlock();
262 monitor_rank_nosafepoint->unlock();
263}
264
265TEST_VM_ASSERT_MSG(MutexRank, monitor_nosafepoint_vm_block,static void test_MutexRank_monitor_nosafepoint_vm_block_(); static
void child_MutexRank_monitor_nosafepoint_vm_block_() { ::testing
::FLAGS_gtest_throw_on_failure = true; test_MutexRank_monitor_nosafepoint_vm_block_
(); exit(0); } class MutexRank_monitor_nosafepoint_vm_block_vm_assert_Test
: public ::testing::Test { public: MutexRank_monitor_nosafepoint_vm_block_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_monitor_nosafepoint_vm_block_vm_assert_Test
(MutexRank_monitor_nosafepoint_vm_block_vm_assert_Test const &
) = delete; void operator=(MutexRank_monitor_nosafepoint_vm_block_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_monitor_nosafepoint_vm_block_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "monitor_nosafepoint_vm_block_vm_assert", __null
, __null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 266), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_monitor_nosafepoint_vm_block_vm_assert_Test
>);void MutexRank_monitor_nosafepoint_vm_block_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".*Locks that don't check for safepoint should always allow the vm to block: monitor_rank_nosafepoint"
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexRank_monitor_nosafepoint_vm_block_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 266, &gtest_dt)) { goto gtest_label_266; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_266; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_monitor_nosafepoint_vm_block_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_266: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 266, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_monitor_nosafepoint_vm_block_
()
266 ".*Locks that don't check for safepoint should always allow the vm to block: monitor_rank_nosafepoint")static void test_MutexRank_monitor_nosafepoint_vm_block_(); static
void child_MutexRank_monitor_nosafepoint_vm_block_() { ::testing
::FLAGS_gtest_throw_on_failure = true; test_MutexRank_monitor_nosafepoint_vm_block_
(); exit(0); } class MutexRank_monitor_nosafepoint_vm_block_vm_assert_Test
: public ::testing::Test { public: MutexRank_monitor_nosafepoint_vm_block_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_monitor_nosafepoint_vm_block_vm_assert_Test
(MutexRank_monitor_nosafepoint_vm_block_vm_assert_Test const &
) = delete; void operator=(MutexRank_monitor_nosafepoint_vm_block_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_monitor_nosafepoint_vm_block_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "monitor_nosafepoint_vm_block_vm_assert", __null
, __null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 266), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_monitor_nosafepoint_vm_block_vm_assert_Test
>);void MutexRank_monitor_nosafepoint_vm_block_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".*Locks that don't check for safepoint should always allow the vm to block: monitor_rank_nosafepoint"
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexRank_monitor_nosafepoint_vm_block_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 266, &gtest_dt)) { goto gtest_label_266; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_266; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_monitor_nosafepoint_vm_block_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_266: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 266, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_monitor_nosafepoint_vm_block_
()
{
267 JavaThread* THREAD__the_thread__ = JavaThread::current();
268 ThreadInVMfromNative invm(THREAD__the_thread__);
269
270 Monitor* monitor_rank_nosafepoint = new Monitor(Mutex::nosafepoint, "monitor_rank_nosafepoint", false);
271 monitor_rank_nosafepoint->lock_without_safepoint_check();
272 monitor_rank_nosafepoint->unlock();
273}
274
275TEST_VM_ASSERT_MSG(MutexRank, monitor_negative_rank,static void test_MutexRank_monitor_negative_rank_(); static void
child_MutexRank_monitor_negative_rank_() { ::testing::FLAGS_gtest_throw_on_failure
= true; test_MutexRank_monitor_negative_rank_(); exit(0); } class
MutexRank_monitor_negative_rank_vm_assert_Test : public ::testing
::Test { public: MutexRank_monitor_negative_rank_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_monitor_negative_rank_vm_assert_Test
(MutexRank_monitor_negative_rank_vm_assert_Test const &) =
delete; void operator=(MutexRank_monitor_negative_rank_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_monitor_negative_rank_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "monitor_negative_rank_vm_assert", __null, __null
, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 276), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_monitor_negative_rank_vm_assert_Test
>);void MutexRank_monitor_negative_rank_vm_assert_Test::TestBody
() { switch (0) case 0: default: if (::testing::internal::AlwaysTrue
()) { const ::testing::internal::RE& gtest_regex = ("assert failed: "
".*Bad lock rank"); ::testing::internal::DeathTest* gtest_dt
; if (!::testing::internal::DeathTest::Create("child_MutexRank_monitor_negative_rank_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 276, &gtest_dt)) { goto gtest_label_276; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_276; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_monitor_negative_rank_(); }
; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_276: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 276, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_monitor_negative_rank_()
276 ".*Bad lock rank")static void test_MutexRank_monitor_negative_rank_(); static void
child_MutexRank_monitor_negative_rank_() { ::testing::FLAGS_gtest_throw_on_failure
= true; test_MutexRank_monitor_negative_rank_(); exit(0); } class
MutexRank_monitor_negative_rank_vm_assert_Test : public ::testing
::Test { public: MutexRank_monitor_negative_rank_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_monitor_negative_rank_vm_assert_Test
(MutexRank_monitor_negative_rank_vm_assert_Test const &) =
delete; void operator=(MutexRank_monitor_negative_rank_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_monitor_negative_rank_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "monitor_negative_rank_vm_assert", __null, __null
, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 276), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_monitor_negative_rank_vm_assert_Test
>);void MutexRank_monitor_negative_rank_vm_assert_Test::TestBody
() { switch (0) case 0: default: if (::testing::internal::AlwaysTrue
()) { const ::testing::internal::RE& gtest_regex = ("assert failed: "
".*Bad lock rank"); ::testing::internal::DeathTest* gtest_dt
; if (!::testing::internal::DeathTest::Create("child_MutexRank_monitor_negative_rank_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 276, &gtest_dt)) { goto gtest_label_276; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_276; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_monitor_negative_rank_(); }
; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_276: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 276, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_monitor_negative_rank_()
{
277 JavaThread* THREAD__the_thread__ = JavaThread::current();
278 ThreadInVMfromNative invm(THREAD__the_thread__);
279
280 Monitor* monitor_rank_broken = new Monitor(Mutex::safepoint-100, "monitor_rank_broken");
281 monitor_rank_broken->lock_without_safepoint_check();
282 monitor_rank_broken->unlock();
283}
284
285TEST_VM_ASSERT_MSG(MutexRank, monitor_overlapping_oopstorage_rank,static void test_MutexRank_monitor_overlapping_oopstorage_rank_
(); static void child_MutexRank_monitor_overlapping_oopstorage_rank_
() { ::testing::FLAGS_gtest_throw_on_failure = true; test_MutexRank_monitor_overlapping_oopstorage_rank_
(); exit(0); } class MutexRank_monitor_overlapping_oopstorage_rank_vm_assert_Test
: public ::testing::Test { public: MutexRank_monitor_overlapping_oopstorage_rank_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_monitor_overlapping_oopstorage_rank_vm_assert_Test
(MutexRank_monitor_overlapping_oopstorage_rank_vm_assert_Test
const &) = delete; void operator=(MutexRank_monitor_overlapping_oopstorage_rank_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_monitor_overlapping_oopstorage_rank_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "monitor_overlapping_oopstorage_rank_vm_assert"
, __null, __null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 286), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_monitor_overlapping_oopstorage_rank_vm_assert_Test
>);void MutexRank_monitor_overlapping_oopstorage_rank_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".*Rank oopstorage-4 overlaps with tty-1"
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexRank_monitor_overlapping_oopstorage_rank_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 286, &gtest_dt)) { goto gtest_label_286; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_286; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_monitor_overlapping_oopstorage_rank_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_286: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 286, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_monitor_overlapping_oopstorage_rank_
()
286 ".*Rank oopstorage-4 overlaps with tty-1")static void test_MutexRank_monitor_overlapping_oopstorage_rank_
(); static void child_MutexRank_monitor_overlapping_oopstorage_rank_
() { ::testing::FLAGS_gtest_throw_on_failure = true; test_MutexRank_monitor_overlapping_oopstorage_rank_
(); exit(0); } class MutexRank_monitor_overlapping_oopstorage_rank_vm_assert_Test
: public ::testing::Test { public: MutexRank_monitor_overlapping_oopstorage_rank_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_monitor_overlapping_oopstorage_rank_vm_assert_Test
(MutexRank_monitor_overlapping_oopstorage_rank_vm_assert_Test
const &) = delete; void operator=(MutexRank_monitor_overlapping_oopstorage_rank_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_monitor_overlapping_oopstorage_rank_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "monitor_overlapping_oopstorage_rank_vm_assert"
, __null, __null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 286), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_monitor_overlapping_oopstorage_rank_vm_assert_Test
>);void MutexRank_monitor_overlapping_oopstorage_rank_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".*Rank oopstorage-4 overlaps with tty-1"
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexRank_monitor_overlapping_oopstorage_rank_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 286, &gtest_dt)) { goto gtest_label_286; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_286; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_monitor_overlapping_oopstorage_rank_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_286: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 286, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_monitor_overlapping_oopstorage_rank_
()
{
287 JavaThread* THREAD__the_thread__ = JavaThread::current();
288 ThreadInVMfromNative invm(THREAD__the_thread__);
289
290 Monitor* monitor_rank_broken = new Monitor(Mutex::oopstorage-4, "monitor_rank_broken");
Value stored to 'monitor_rank_broken' during its initialization is never read
291}
292
293TEST_VM_ASSERT_MSG(MutexRank, monitor_overlapping_safepoint_rank,static void test_MutexRank_monitor_overlapping_safepoint_rank_
(); static void child_MutexRank_monitor_overlapping_safepoint_rank_
() { ::testing::FLAGS_gtest_throw_on_failure = true; test_MutexRank_monitor_overlapping_safepoint_rank_
(); exit(0); } class MutexRank_monitor_overlapping_safepoint_rank_vm_assert_Test
: public ::testing::Test { public: MutexRank_monitor_overlapping_safepoint_rank_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_monitor_overlapping_safepoint_rank_vm_assert_Test
(MutexRank_monitor_overlapping_safepoint_rank_vm_assert_Test const
&) = delete; void operator=(MutexRank_monitor_overlapping_safepoint_rank_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_monitor_overlapping_safepoint_rank_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "monitor_overlapping_safepoint_rank_vm_assert",
__null, __null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 294), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_monitor_overlapping_safepoint_rank_vm_assert_Test
>);void MutexRank_monitor_overlapping_safepoint_rank_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".*Rank safepoint-40 overlaps with service-5"
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexRank_monitor_overlapping_safepoint_rank_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 294, &gtest_dt)) { goto gtest_label_294; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_294; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_monitor_overlapping_safepoint_rank_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_294: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 294, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_monitor_overlapping_safepoint_rank_
()
294 ".*Rank safepoint-40 overlaps with service-5")static void test_MutexRank_monitor_overlapping_safepoint_rank_
(); static void child_MutexRank_monitor_overlapping_safepoint_rank_
() { ::testing::FLAGS_gtest_throw_on_failure = true; test_MutexRank_monitor_overlapping_safepoint_rank_
(); exit(0); } class MutexRank_monitor_overlapping_safepoint_rank_vm_assert_Test
: public ::testing::Test { public: MutexRank_monitor_overlapping_safepoint_rank_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_monitor_overlapping_safepoint_rank_vm_assert_Test
(MutexRank_monitor_overlapping_safepoint_rank_vm_assert_Test const
&) = delete; void operator=(MutexRank_monitor_overlapping_safepoint_rank_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_monitor_overlapping_safepoint_rank_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "monitor_overlapping_safepoint_rank_vm_assert",
__null, __null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 294), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_monitor_overlapping_safepoint_rank_vm_assert_Test
>);void MutexRank_monitor_overlapping_safepoint_rank_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".*Rank safepoint-40 overlaps with service-5"
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexRank_monitor_overlapping_safepoint_rank_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 294, &gtest_dt)) { goto gtest_label_294; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_294; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_monitor_overlapping_safepoint_rank_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_294: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 294, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_monitor_overlapping_safepoint_rank_
()
{
295 JavaThread* THREAD__the_thread__ = JavaThread::current();
296 ThreadInVMfromNative invm(THREAD__the_thread__);
297
298 Monitor* monitor_rank_broken = new Monitor(Mutex::safepoint-40, "monitor_rank_broken");
299}
300
301TEST_VM_ASSERT_MSG(MutexRank, monitor_overlapping_safepoint_rank2,static void test_MutexRank_monitor_overlapping_safepoint_rank2_
(); static void child_MutexRank_monitor_overlapping_safepoint_rank2_
() { ::testing::FLAGS_gtest_throw_on_failure = true; test_MutexRank_monitor_overlapping_safepoint_rank2_
(); exit(0); } class MutexRank_monitor_overlapping_safepoint_rank2_vm_assert_Test
: public ::testing::Test { public: MutexRank_monitor_overlapping_safepoint_rank2_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_monitor_overlapping_safepoint_rank2_vm_assert_Test
(MutexRank_monitor_overlapping_safepoint_rank2_vm_assert_Test
const &) = delete; void operator=(MutexRank_monitor_overlapping_safepoint_rank2_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_monitor_overlapping_safepoint_rank2_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "monitor_overlapping_safepoint_rank2_vm_assert"
, __null, __null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 302), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_monitor_overlapping_safepoint_rank2_vm_assert_Test
>);void MutexRank_monitor_overlapping_safepoint_rank2_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".*Rank safepoint-1-39 overlaps with service-5"
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexRank_monitor_overlapping_safepoint_rank2_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 302, &gtest_dt)) { goto gtest_label_302; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_302; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_monitor_overlapping_safepoint_rank2_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_302: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 302, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_monitor_overlapping_safepoint_rank2_
()
302 ".*Rank safepoint-1-39 overlaps with service-5")static void test_MutexRank_monitor_overlapping_safepoint_rank2_
(); static void child_MutexRank_monitor_overlapping_safepoint_rank2_
() { ::testing::FLAGS_gtest_throw_on_failure = true; test_MutexRank_monitor_overlapping_safepoint_rank2_
(); exit(0); } class MutexRank_monitor_overlapping_safepoint_rank2_vm_assert_Test
: public ::testing::Test { public: MutexRank_monitor_overlapping_safepoint_rank2_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexRank_monitor_overlapping_safepoint_rank2_vm_assert_Test
(MutexRank_monitor_overlapping_safepoint_rank2_vm_assert_Test
const &) = delete; void operator=(MutexRank_monitor_overlapping_safepoint_rank2_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexRank_monitor_overlapping_safepoint_rank2_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexRank", "monitor_overlapping_safepoint_rank2_vm_assert"
, __null, __null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 302), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexRank_monitor_overlapping_safepoint_rank2_vm_assert_Test
>);void MutexRank_monitor_overlapping_safepoint_rank2_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".*Rank safepoint-1-39 overlaps with service-5"
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexRank_monitor_overlapping_safepoint_rank2_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 302, &gtest_dt)) { goto gtest_label_302; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_302; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexRank_monitor_overlapping_safepoint_rank2_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_302: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 302, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexRank_monitor_overlapping_safepoint_rank2_
()
{
303 JavaThread* THREAD__the_thread__ = JavaThread::current();
304 ThreadInVMfromNative invm(THREAD__the_thread__);
305
306 Monitor* monitor_rank_ok = new Monitor(Mutex::safepoint-1, "monitor_rank_ok");
307 Monitor* monitor_rank_broken = new Monitor(monitor_rank_ok->rank()-39, "monitor_rank_broken");
308}
309
310// Test mismatched safepoint check flag on lock declaration vs. lock acquisition.
311TEST_VM_ASSERT_MSG(MutexSafepoint, always_check,static void test_MutexSafepoint_always_check_(); static void child_MutexSafepoint_always_check_
() { ::testing::FLAGS_gtest_throw_on_failure = true; test_MutexSafepoint_always_check_
(); exit(0); } class MutexSafepoint_always_check_vm_assert_Test
: public ::testing::Test { public: MutexSafepoint_always_check_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexSafepoint_always_check_vm_assert_Test
(MutexSafepoint_always_check_vm_assert_Test const &) = delete
; void operator=(MutexSafepoint_always_check_vm_assert_Test const
&) = delete;};::testing::TestInfo* const MutexSafepoint_always_check_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexSafepoint", "always_check_vm_assert", __null, __null, ::
testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 312), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexSafepoint_always_check_vm_assert_Test
>);void MutexSafepoint_always_check_vm_assert_Test::TestBody
() { switch (0) case 0: default: if (::testing::internal::AlwaysTrue
()) { const ::testing::internal::RE& gtest_regex = ("assert failed: "
".*This lock should always have a safepoint check for Java threads: SFPT_Test_lock"
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexSafepoint_always_check_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 312, &gtest_dt)) { goto gtest_label_312; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_312; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexSafepoint_always_check_(); }; gtest_dt
->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE);
break; } default: break; } } } else gtest_label_312: return ::
testing::internal::AssertHelper(::testing::TestPartResult::kFatalFailure
, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 312, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexSafepoint_always_check_()
312 ".*This lock should always have a safepoint check for Java threads: SFPT_Test_lock")static void test_MutexSafepoint_always_check_(); static void child_MutexSafepoint_always_check_
() { ::testing::FLAGS_gtest_throw_on_failure = true; test_MutexSafepoint_always_check_
(); exit(0); } class MutexSafepoint_always_check_vm_assert_Test
: public ::testing::Test { public: MutexSafepoint_always_check_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexSafepoint_always_check_vm_assert_Test
(MutexSafepoint_always_check_vm_assert_Test const &) = delete
; void operator=(MutexSafepoint_always_check_vm_assert_Test const
&) = delete;};::testing::TestInfo* const MutexSafepoint_always_check_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexSafepoint", "always_check_vm_assert", __null, __null, ::
testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 312), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexSafepoint_always_check_vm_assert_Test
>);void MutexSafepoint_always_check_vm_assert_Test::TestBody
() { switch (0) case 0: default: if (::testing::internal::AlwaysTrue
()) { const ::testing::internal::RE& gtest_regex = ("assert failed: "
".*This lock should always have a safepoint check for Java threads: SFPT_Test_lock"
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexSafepoint_always_check_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 312, &gtest_dt)) { goto gtest_label_312; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_312; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexSafepoint_always_check_(); }; gtest_dt
->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE);
break; } default: break; } } } else gtest_label_312: return ::
testing::internal::AssertHelper(::testing::TestPartResult::kFatalFailure
, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 312, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexSafepoint_always_check_()
{
313 MutexLocker ml(new Mutex(Mutex::safepoint, "SFPT_Test_lock"),
314 Mutex::_no_safepoint_check_flag);
315}
316
317TEST_VM_ASSERT_MSG(MutexSafepoint, never_check,static void test_MutexSafepoint_never_check_(); static void child_MutexSafepoint_never_check_
() { ::testing::FLAGS_gtest_throw_on_failure = true; test_MutexSafepoint_never_check_
(); exit(0); } class MutexSafepoint_never_check_vm_assert_Test
: public ::testing::Test { public: MutexSafepoint_never_check_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexSafepoint_never_check_vm_assert_Test
(MutexSafepoint_never_check_vm_assert_Test const &) = delete
; void operator=(MutexSafepoint_never_check_vm_assert_Test const
&) = delete;};::testing::TestInfo* const MutexSafepoint_never_check_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexSafepoint", "never_check_vm_assert", __null, __null, ::
testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 318), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexSafepoint_never_check_vm_assert_Test
>);void MutexSafepoint_never_check_vm_assert_Test::TestBody
() { switch (0) case 0: default: if (::testing::internal::AlwaysTrue
()) { const ::testing::internal::RE& gtest_regex = ("assert failed: "
".*This lock should not be taken with a safepoint check: SFPT_Test_lock"
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexSafepoint_never_check_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 318, &gtest_dt)) { goto gtest_label_318; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_318; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexSafepoint_never_check_(); }; gtest_dt
->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE);
break; } default: break; } } } else gtest_label_318: return ::
testing::internal::AssertHelper(::testing::TestPartResult::kFatalFailure
, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 318, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexSafepoint_never_check_()
318 ".*This lock should not be taken with a safepoint check: SFPT_Test_lock")static void test_MutexSafepoint_never_check_(); static void child_MutexSafepoint_never_check_
() { ::testing::FLAGS_gtest_throw_on_failure = true; test_MutexSafepoint_never_check_
(); exit(0); } class MutexSafepoint_never_check_vm_assert_Test
: public ::testing::Test { public: MutexSafepoint_never_check_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexSafepoint_never_check_vm_assert_Test
(MutexSafepoint_never_check_vm_assert_Test const &) = delete
; void operator=(MutexSafepoint_never_check_vm_assert_Test const
&) = delete;};::testing::TestInfo* const MutexSafepoint_never_check_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexSafepoint", "never_check_vm_assert", __null, __null, ::
testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 318), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexSafepoint_never_check_vm_assert_Test
>);void MutexSafepoint_never_check_vm_assert_Test::TestBody
() { switch (0) case 0: default: if (::testing::internal::AlwaysTrue
()) { const ::testing::internal::RE& gtest_regex = ("assert failed: "
".*This lock should not be taken with a safepoint check: SFPT_Test_lock"
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexSafepoint_never_check_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 318, &gtest_dt)) { goto gtest_label_318; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_318; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexSafepoint_never_check_(); }; gtest_dt
->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE);
break; } default: break; } } } else gtest_label_318: return ::
testing::internal::AssertHelper(::testing::TestPartResult::kFatalFailure
, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 318, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexSafepoint_never_check_()
{
319 MutexLocker ml(new Mutex(Mutex::nosafepoint, "SFPT_Test_lock"),
320 Mutex::_safepoint_check_flag);
321}
322
323TEST_VM_ASSERT_MSG(MutexSafepoint, possible_safepoint_lock,static void test_MutexSafepoint_possible_safepoint_lock_(); static
void child_MutexSafepoint_possible_safepoint_lock_() { ::testing
::FLAGS_gtest_throw_on_failure = true; test_MutexSafepoint_possible_safepoint_lock_
(); exit(0); } class MutexSafepoint_possible_safepoint_lock_vm_assert_Test
: public ::testing::Test { public: MutexSafepoint_possible_safepoint_lock_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexSafepoint_possible_safepoint_lock_vm_assert_Test
(MutexSafepoint_possible_safepoint_lock_vm_assert_Test const &
) = delete; void operator=(MutexSafepoint_possible_safepoint_lock_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexSafepoint_possible_safepoint_lock_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexSafepoint", "possible_safepoint_lock_vm_assert", __null
, __null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 324), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexSafepoint_possible_safepoint_lock_vm_assert_Test
>);void MutexSafepoint_possible_safepoint_lock_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".* Possible safepoint reached by thread that does not allow it"
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexSafepoint_possible_safepoint_lock_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 324, &gtest_dt)) { goto gtest_label_324; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_324; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexSafepoint_possible_safepoint_lock_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_324: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 324, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexSafepoint_possible_safepoint_lock_
()
324 ".* Possible safepoint reached by thread that does not allow it")static void test_MutexSafepoint_possible_safepoint_lock_(); static
void child_MutexSafepoint_possible_safepoint_lock_() { ::testing
::FLAGS_gtest_throw_on_failure = true; test_MutexSafepoint_possible_safepoint_lock_
(); exit(0); } class MutexSafepoint_possible_safepoint_lock_vm_assert_Test
: public ::testing::Test { public: MutexSafepoint_possible_safepoint_lock_vm_assert_Test
() {} private: virtual void TestBody(); static ::testing::TestInfo
* const test_info_ __attribute__ ((unused)); MutexSafepoint_possible_safepoint_lock_vm_assert_Test
(MutexSafepoint_possible_safepoint_lock_vm_assert_Test const &
) = delete; void operator=(MutexSafepoint_possible_safepoint_lock_vm_assert_Test
const &) = delete;};::testing::TestInfo* const MutexSafepoint_possible_safepoint_lock_vm_assert_Test
::test_info_ = ::testing::internal::MakeAndRegisterTestInfo(
"MutexSafepoint", "possible_safepoint_lock_vm_assert", __null
, __null, ::testing::internal::CodeLocation("/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 324), (::testing::internal::GetTestTypeId()), ::testing::Test
::SetUpTestCase, ::testing::Test::TearDownTestCase, new ::testing
::internal::TestFactoryImpl< MutexSafepoint_possible_safepoint_lock_vm_assert_Test
>);void MutexSafepoint_possible_safepoint_lock_vm_assert_Test
::TestBody() { switch (0) case 0: default: if (::testing::internal
::AlwaysTrue()) { const ::testing::internal::RE& gtest_regex
= ("assert failed: " ".* Possible safepoint reached by thread that does not allow it"
); ::testing::internal::DeathTest* gtest_dt; if (!::testing::
internal::DeathTest::Create("child_MutexSafepoint_possible_safepoint_lock_()"
, &gtest_regex, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 324, &gtest_dt)) { goto gtest_label_324; } if (gtest_dt
!= __null) { ::testing::internal::scoped_ptr< ::testing::
internal::DeathTest> gtest_dt_ptr(gtest_dt); switch (gtest_dt
->AssumeRole()) { case ::testing::internal::DeathTest::OVERSEE_TEST
: if (!gtest_dt->Passed(::testing::ExitedWithCode(1)(gtest_dt
->Wait()))) { goto gtest_label_324; } break; case ::testing
::internal::DeathTest::EXECUTE_TEST: { ::testing::internal::DeathTest
::ReturnSentinel gtest_sentinel(gtest_dt); if (::testing::internal
::AlwaysTrue()) { child_MutexSafepoint_possible_safepoint_lock_
(); }; gtest_dt->Abort(::testing::internal::DeathTest::TEST_DID_NOT_DIE
); break; } default: break; } } } else gtest_label_324: return
::testing::internal::AssertHelper(::testing::TestPartResult::
kFatalFailure, "/home/daniel/Projects/java/jdk/test/hotspot/gtest/runtime/test_mutex.cpp"
, 324, ::testing::internal::DeathTest::LastMessage()) = ::testing
::Message(); } void test_MutexSafepoint_possible_safepoint_lock_
()
{
325 JavaThread* thread = JavaThread::current();
326 ThreadInVMfromNative in_native(thread);
327 MutexLocker ml(new Mutex(Mutex::nosafepoint, "SpecialTest_lock"),
328 Mutex::_no_safepoint_check_flag);
329 thread->print_thread_state_on(tty);
330 // If the lock above succeeds, try to safepoint to test the NSV implied with this nosafepoint lock.
331 ThreadBlockInVM tbivm(thread);
332 thread->print_thread_state_on(tty);
333}
334#endif // ASSERT