From a60a7053cd9a25c89dedc810b8a539cad3d56b36 Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Mon, 12 Sep 2016 18:11:28 +0100 Subject: Remove custom CheckCast slow path caller saves for Baker CC. For Baker CC, CheckCast has both a read-barrier marking slow path and a pCheckCast slow path. When the latter is known to leave the method, i.e. known to throw outside a try-block, we do not need to save live registers for retrieval for the exception delivery and since the read-barrier marking does not need to save any registers either we were setting the custom slow path caller saves to empty to avoid reserving unnecessary spill space. Hovewer, this also leads to marking live references in caller-save registers in the register mask and while the read-barrier marking entrypoint doesn't care, it causes a stack walk for the pCheckCast to try and retrieve an unsaved register. For the time being, revert to the default caller saves. This is a partial revert of https://android-review.googlesource.com/254920 Test: Run ART test suite on host and Nexus 9. Bug: 29231980 Bug: 30212852 Change-Id: I4e22125f3d8903c97506aa2e6e66bea8e8e6baef --- compiler/optimizing/code_generator_arm.cc | 5 ----- compiler/optimizing/code_generator_arm64.cc | 5 ----- compiler/optimizing/code_generator_x86.cc | 5 ----- compiler/optimizing/code_generator_x86_64.cc | 5 ----- 4 files changed, 20 deletions(-) (limited to 'compiler/optimizing') diff --git a/compiler/optimizing/code_generator_arm.cc b/compiler/optimizing/code_generator_arm.cc index 4c41ac89e7..40c2b9c1ec 100644 --- a/compiler/optimizing/code_generator_arm.cc +++ b/compiler/optimizing/code_generator_arm.cc @@ -5738,7 +5738,6 @@ void LocationsBuilderARM::VisitCheckCast(HCheckCast* instruction) { bool throws_into_catch = instruction->CanThrowIntoCatchBlock(); TypeCheckKind type_check_kind = instruction->GetTypeCheckKind(); - bool baker_read_barrier_slow_path = false; switch (type_check_kind) { case TypeCheckKind::kExactCheck: case TypeCheckKind::kAbstractClassCheck: @@ -5747,7 +5746,6 @@ void LocationsBuilderARM::VisitCheckCast(HCheckCast* instruction) { call_kind = (throws_into_catch || kEmitCompilerReadBarrier) ? LocationSummary::kCallOnSlowPath : LocationSummary::kNoCall; // In fact, call on a fatal (non-returning) slow path. - baker_read_barrier_slow_path = kUseBakerReadBarrier && !throws_into_catch; break; case TypeCheckKind::kArrayCheck: case TypeCheckKind::kUnresolvedCheck: @@ -5757,9 +5755,6 @@ void LocationsBuilderARM::VisitCheckCast(HCheckCast* instruction) { } LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(instruction, call_kind); - if (baker_read_barrier_slow_path) { - locations->SetCustomSlowPathCallerSaves(RegisterSet()); // No caller-save registers. - } locations->SetInAt(0, Location::RequiresRegister()); locations->SetInAt(1, Location::RequiresRegister()); // Note that TypeCheckSlowPathARM uses this "temp" register too. diff --git a/compiler/optimizing/code_generator_arm64.cc b/compiler/optimizing/code_generator_arm64.cc index d586f1dc17..c00ab56a4c 100644 --- a/compiler/optimizing/code_generator_arm64.cc +++ b/compiler/optimizing/code_generator_arm64.cc @@ -3250,7 +3250,6 @@ void LocationsBuilderARM64::VisitCheckCast(HCheckCast* instruction) { bool throws_into_catch = instruction->CanThrowIntoCatchBlock(); TypeCheckKind type_check_kind = instruction->GetTypeCheckKind(); - bool baker_read_barrier_slow_path = false; switch (type_check_kind) { case TypeCheckKind::kExactCheck: case TypeCheckKind::kAbstractClassCheck: @@ -3259,7 +3258,6 @@ void LocationsBuilderARM64::VisitCheckCast(HCheckCast* instruction) { call_kind = (throws_into_catch || kEmitCompilerReadBarrier) ? LocationSummary::kCallOnSlowPath : LocationSummary::kNoCall; // In fact, call on a fatal (non-returning) slow path. - baker_read_barrier_slow_path = kUseBakerReadBarrier && !throws_into_catch; break; case TypeCheckKind::kArrayCheck: case TypeCheckKind::kUnresolvedCheck: @@ -3269,9 +3267,6 @@ void LocationsBuilderARM64::VisitCheckCast(HCheckCast* instruction) { } LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(instruction, call_kind); - if (baker_read_barrier_slow_path) { - locations->SetCustomSlowPathCallerSaves(RegisterSet()); // No caller-save registers. - } locations->SetInAt(0, Location::RequiresRegister()); locations->SetInAt(1, Location::RequiresRegister()); // Note that TypeCheckSlowPathARM64 uses this "temp" register too. diff --git a/compiler/optimizing/code_generator_x86.cc b/compiler/optimizing/code_generator_x86.cc index 64c47544f7..28db29cb58 100644 --- a/compiler/optimizing/code_generator_x86.cc +++ b/compiler/optimizing/code_generator_x86.cc @@ -6403,7 +6403,6 @@ void LocationsBuilderX86::VisitCheckCast(HCheckCast* instruction) { LocationSummary::CallKind call_kind = LocationSummary::kNoCall; bool throws_into_catch = instruction->CanThrowIntoCatchBlock(); TypeCheckKind type_check_kind = instruction->GetTypeCheckKind(); - bool baker_read_barrier_slow_path = false; switch (type_check_kind) { case TypeCheckKind::kExactCheck: case TypeCheckKind::kAbstractClassCheck: @@ -6412,7 +6411,6 @@ void LocationsBuilderX86::VisitCheckCast(HCheckCast* instruction) { call_kind = (throws_into_catch || kEmitCompilerReadBarrier) ? LocationSummary::kCallOnSlowPath : LocationSummary::kNoCall; // In fact, call on a fatal (non-returning) slow path. - baker_read_barrier_slow_path = kUseBakerReadBarrier && !throws_into_catch; break; case TypeCheckKind::kArrayCheck: case TypeCheckKind::kUnresolvedCheck: @@ -6421,9 +6419,6 @@ void LocationsBuilderX86::VisitCheckCast(HCheckCast* instruction) { break; } LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(instruction, call_kind); - if (baker_read_barrier_slow_path) { - locations->SetCustomSlowPathCallerSaves(RegisterSet()); // No caller-save registers. - } locations->SetInAt(0, Location::RequiresRegister()); locations->SetInAt(1, Location::Any()); // Note that TypeCheckSlowPathX86 uses this "temp" register too. diff --git a/compiler/optimizing/code_generator_x86_64.cc b/compiler/optimizing/code_generator_x86_64.cc index e1613082bb..88d98fc1e1 100644 --- a/compiler/optimizing/code_generator_x86_64.cc +++ b/compiler/optimizing/code_generator_x86_64.cc @@ -5825,7 +5825,6 @@ void LocationsBuilderX86_64::VisitCheckCast(HCheckCast* instruction) { LocationSummary::CallKind call_kind = LocationSummary::kNoCall; bool throws_into_catch = instruction->CanThrowIntoCatchBlock(); TypeCheckKind type_check_kind = instruction->GetTypeCheckKind(); - bool baker_read_barrier_slow_path = false; switch (type_check_kind) { case TypeCheckKind::kExactCheck: case TypeCheckKind::kAbstractClassCheck: @@ -5834,7 +5833,6 @@ void LocationsBuilderX86_64::VisitCheckCast(HCheckCast* instruction) { call_kind = (throws_into_catch || kEmitCompilerReadBarrier) ? LocationSummary::kCallOnSlowPath : LocationSummary::kNoCall; // In fact, call on a fatal (non-returning) slow path. - baker_read_barrier_slow_path = kUseBakerReadBarrier && !throws_into_catch; break; case TypeCheckKind::kArrayCheck: case TypeCheckKind::kUnresolvedCheck: @@ -5843,9 +5841,6 @@ void LocationsBuilderX86_64::VisitCheckCast(HCheckCast* instruction) { break; } LocationSummary* locations = new (GetGraph()->GetArena()) LocationSummary(instruction, call_kind); - if (baker_read_barrier_slow_path) { - locations->SetCustomSlowPathCallerSaves(RegisterSet()); // No caller-save registers. - } locations->SetInAt(0, Location::RequiresRegister()); locations->SetInAt(1, Location::Any()); // Note that TypeCheckSlowPathX86_64 uses this "temp" register too. -- cgit v1.2.3-59-g8ed1b