summaryrefslogtreecommitdiff
path: root/compiler/optimizing/instruction_simplifier_test.cc
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2021-06-01 09:26:55 +0100
committer Vladimir Marko <vmarko@google.com> 2021-06-01 12:50:50 +0000
commit1d326f94a3fdd6292ccdf0022cedfb2a2b8acfee (patch)
tree17fde709095f46eff040585e694b621676e5d0c0 /compiler/optimizing/instruction_simplifier_test.cc
parent654f01cd509ca11eae22177d4e764f1241fb3a53 (diff)
Avoid race on Thread::tlsPtr_::top_handle_scope.
Require mutator lock for that field and update tests to hold the mutator lock when needed. This prevents GC thread that executes a thread roots flip on behalf of suspended threads from racing against construction or destruction of handle scopes by those threads and possibly seeing invalid values. Test: m test-art-host-gtest Test: testrunner.py --host --optimizing Bug: 189439174 Change-Id: I268a0ef6e5aa838347956febca0d3b6e02fe3ae5
Diffstat (limited to 'compiler/optimizing/instruction_simplifier_test.cc')
-rw-r--r--compiler/optimizing/instruction_simplifier_test.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/compiler/optimizing/instruction_simplifier_test.cc b/compiler/optimizing/instruction_simplifier_test.cc
index ac0bdb93c3..2063eedb28 100644
--- a/compiler/optimizing/instruction_simplifier_test.cc
+++ b/compiler/optimizing/instruction_simplifier_test.cc
@@ -127,7 +127,8 @@ class InstanceOfInstructionSimplifierTestGroup
// target_phi = PHI[param2, param3, obj2]
// return PredFieldGet[val_phi, target_phi] => PredFieldGet[val_phi, target_phi]
TEST_F(InstructionSimplifierTest, SimplifyPredicatedFieldGetNoMerge) {
- VariableSizedHandleScope vshs(Thread::Current());
+ ScopedObjectAccess soa(Thread::Current());
+ VariableSizedHandleScope vshs(soa.Self());
CreateGraph(&vshs);
AdjacencyListGraph blks(SetupFromAdjacencyList("entry",
"exit",
@@ -219,7 +220,8 @@ TEST_F(InstructionSimplifierTest, SimplifyPredicatedFieldGetNoMerge) {
// target_phi = PHI[param2, param3, obj2]
// return PredFieldGet[val_phi, target_phi] => PredFieldGet[3, target_phi]
TEST_F(InstructionSimplifierTest, SimplifyPredicatedFieldGetMerge) {
- VariableSizedHandleScope vshs(Thread::Current());
+ ScopedObjectAccess soa(Thread::Current());
+ VariableSizedHandleScope vshs(soa.Self());
CreateGraph(&vshs);
AdjacencyListGraph blks(SetupFromAdjacencyList("entry",
"exit",
@@ -308,7 +310,8 @@ TEST_F(InstructionSimplifierTest, SimplifyPredicatedFieldGetMerge) {
// target_phi = PHI[obj1, obj2]
// return PredFieldGet[val_phi, target_phi] => FieldGet[target_phi]
TEST_F(InstructionSimplifierTest, SimplifyPredicatedFieldGetNoNull) {
- VariableSizedHandleScope vshs(Thread::Current());
+ ScopedObjectAccess soa(Thread::Current());
+ VariableSizedHandleScope vshs(soa.Self());
CreateGraph(&vshs);
AdjacencyListGraph blks(SetupFromAdjacencyList("entry",
"exit",
@@ -394,7 +397,8 @@ TEST_F(InstructionSimplifierTest, SimplifyPredicatedFieldGetNoNull) {
// EXIT
// return obj.field
TEST_P(InstanceOfInstructionSimplifierTestGroup, ExactClassInstanceOfOther) {
- VariableSizedHandleScope vshs(Thread::Current());
+ ScopedObjectAccess soa(Thread::Current());
+ VariableSizedHandleScope vshs(soa.Self());
InitGraph(/*handles=*/&vshs);
AdjacencyListGraph blks(SetupFromAdjacencyList("entry",
@@ -483,7 +487,8 @@ TEST_P(InstanceOfInstructionSimplifierTestGroup, ExactClassInstanceOfOther) {
// EXIT
// return obj
TEST_P(InstanceOfInstructionSimplifierTestGroup, ExactClassCheckCastOther) {
- VariableSizedHandleScope vshs(Thread::Current());
+ ScopedObjectAccess soa(Thread::Current());
+ VariableSizedHandleScope vshs(soa.Self());
InitGraph(/*handles=*/&vshs);
AdjacencyListGraph blks(SetupFromAdjacencyList("entry", "exit", {{"entry", "exit"}}));