From f6e206c820fe75a341c98ef12410475d33028640 Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Thu, 7 Aug 2014 20:25:41 +0100 Subject: [PATCH] Support x86_64 stack overflow checks in opt compiler. Also re-enable SignalTest on optimizing-32. Change-Id: I2ca13f6f9ea775c654ee07cc5026c985263d6380 --- build/Android.common_test.mk | 12 ----------- compiler/optimizing/code_generator_x86.cc | 10 ++++----- compiler/optimizing/code_generator_x86_64.cc | 31 ++++++++++++++-------------- 3 files changed, 21 insertions(+), 32 deletions(-) diff --git a/build/Android.common_test.mk b/build/Android.common_test.mk index 7e38157e9..52d1ee31a 100644 --- a/build/Android.common_test.mk +++ b/build/Android.common_test.mk @@ -26,18 +26,6 @@ ART_TARGET_CFLAGS += -DART_TARGET_NATIVETEST_DIR=${ART_TARGET_NATIVETEST_DIR} # List of known broken tests that we won't attempt to execute. The test name must be the full # rule name such as test-art-host-oat-optimizing-HelloWorld64. ART_TEST_KNOWN_BROKEN := \ - test-art-host-run-test-gcstress-optimizing-no-prebuild-004-SignalTest32 \ - test-art-host-run-test-gcstress-optimizing-prebuild-004-SignalTest32 \ - test-art-host-run-test-gcstress-optimizing-norelocate-004-SignalTest32 \ - test-art-host-run-test-gcstress-optimizing-relocate-004-SignalTest32 \ - test-art-host-run-test-gcverify-optimizing-no-prebuild-004-SignalTest32 \ - test-art-host-run-test-gcverify-optimizing-prebuild-004-SignalTest32 \ - test-art-host-run-test-gcverify-optimizing-norelocate-004-SignalTest32 \ - test-art-host-run-test-gcverify-optimizing-relocate-004-SignalTest32 \ - test-art-host-run-test-optimizing-no-prebuild-004-SignalTest32 \ - test-art-host-run-test-optimizing-prebuild-004-SignalTest32 \ - test-art-host-run-test-optimizing-norelocate-004-SignalTest32 \ - test-art-host-run-test-optimizing-relocate-004-SignalTest32 \ test-art-target-run-test-gcstress-optimizing-prebuild-004-SignalTest32 \ test-art-target-run-test-gcstress-optimizing-norelocate-004-SignalTest32 \ test-art-target-run-test-gcstress-default-prebuild-004-SignalTest32 \ diff --git a/compiler/optimizing/code_generator_x86.cc b/compiler/optimizing/code_generator_x86.cc index 226463811..ab53b1763 100644 --- a/compiler/optimizing/code_generator_x86.cc +++ b/compiler/optimizing/code_generator_x86.cc @@ -15,16 +15,16 @@ */ #include "code_generator_x86.h" -#include "gc/accounting/card_table.h" -#include "utils/assembler.h" -#include "utils/stack_checks.h" -#include "utils/x86/assembler_x86.h" -#include "utils/x86/managed_register_x86.h" #include "entrypoints/quick/quick_entrypoints.h" +#include "gc/accounting/card_table.h" #include "mirror/array.h" #include "mirror/art_method.h" #include "thread.h" +#include "utils/assembler.h" +#include "utils/stack_checks.h" +#include "utils/x86/assembler_x86.h" +#include "utils/x86/managed_register_x86.h" namespace art { diff --git a/compiler/optimizing/code_generator_x86_64.cc b/compiler/optimizing/code_generator_x86_64.cc index 2ff2a1710..e4259f51b 100644 --- a/compiler/optimizing/code_generator_x86_64.cc +++ b/compiler/optimizing/code_generator_x86_64.cc @@ -35,7 +35,7 @@ x86_64::X86_64ManagedRegister Location::AsX86_64() const { namespace x86_64 { -static constexpr bool kExplicitStackOverflowCheck = true; +static constexpr bool kExplicitStackOverflowCheck = false; // Some x86_64 instructions require a register to be available as temp. static constexpr Register TMP = R11; @@ -208,25 +208,26 @@ void CodeGeneratorX86_64::GenerateFrameEntry() { static const int kFakeReturnRegister = 16; core_spill_mask_ |= (1 << kFakeReturnRegister); + bool skip_overflow_check = IsLeafMethod() + && !IsLargeFrame(GetFrameSize(), InstructionSet::kX86_64); + + if (!skip_overflow_check && !kExplicitStackOverflowCheck) { + __ testq(CpuRegister(RAX), Address( + CpuRegister(RSP), -static_cast(GetStackOverflowReservedBytes(kX86_64)))); + RecordPcInfo(0); + } + // The return PC has already been pushed on the stack. __ subq(CpuRegister(RSP), Immediate(GetFrameSize() - kNumberOfPushedRegistersAtEntry * kX86_64WordSize)); - bool skip_overflow_check = IsLeafMethod() - && !IsLargeFrame(GetFrameSize(), InstructionSet::kX86_64); - - if (!skip_overflow_check) { - if (kExplicitStackOverflowCheck) { - SlowPathCode* slow_path = new (GetGraph()->GetArena()) StackOverflowCheckSlowPathX86_64(); - AddSlowPath(slow_path); + if (!skip_overflow_check && kExplicitStackOverflowCheck) { + SlowPathCode* slow_path = new (GetGraph()->GetArena()) StackOverflowCheckSlowPathX86_64(); + AddSlowPath(slow_path); - __ gs()->cmpq(CpuRegister(RSP), - Address::Absolute(Thread::StackEndOffset(), true)); - __ j(kLess, slow_path->GetEntryLabel()); - } else { - __ testq(CpuRegister(RAX), Address( - CpuRegister(RSP), -static_cast(GetStackOverflowReservedBytes(kX86_64)))); - } + __ gs()->cmpq(CpuRegister(RSP), + Address::Absolute(Thread::StackEndOffset(), true)); + __ j(kLess, slow_path->GetEntryLabel()); } __ movl(Address(CpuRegister(RSP), kCurrentMethodStackOffset), CpuRegister(RDI)); -- 2.11.0