From 75969963213c39a029e01c3b9440fb388d793afb Mon Sep 17 00:00:00 2001 From: Goran Jakovljevic Date: Tue, 27 Oct 2015 12:29:07 +0100 Subject: [PATCH] MIPS32: Move code from RA to T9 in longjump Do not use the return address. It should not be clobbered as we may need it, e.g., for single-frame deopt. This fixes following tests: * 449-checker-bce * 534-checker-bce-deoptimization * 535-deopt-and-inlining Change-Id: Ic94a2897c7336da094a8937ab1bc4a02a680de53 --- runtime/arch/mips/context_mips.cc | 4 ++-- runtime/arch/mips/context_mips.h | 9 +++++---- runtime/arch/mips/quick_entrypoints_mips.S | 2 +- test/Android.run-test.mk | 3 --- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/runtime/arch/mips/context_mips.cc b/runtime/arch/mips/context_mips.cc index 4dedb3339..375a03ace 100644 --- a/runtime/arch/mips/context_mips.cc +++ b/runtime/arch/mips/context_mips.cc @@ -28,11 +28,11 @@ void MipsContext::Reset() { std::fill_n(gprs_, arraysize(gprs_), nullptr); std::fill_n(fprs_, arraysize(fprs_), nullptr); gprs_[SP] = &sp_; - gprs_[RA] = &ra_; + gprs_[T9] = &t9_; gprs_[A0] = &arg0_; // Initialize registers with easy to spot debug values. sp_ = MipsContext::kBadGprBase + SP; - ra_ = MipsContext::kBadGprBase + RA; + t9_ = MipsContext::kBadGprBase + T9; arg0_ = 0; } diff --git a/runtime/arch/mips/context_mips.h b/runtime/arch/mips/context_mips.h index f1e290559..7dcff630d 100644 --- a/runtime/arch/mips/context_mips.h +++ b/runtime/arch/mips/context_mips.h @@ -41,7 +41,7 @@ class MipsContext : public Context { } void SetPC(uintptr_t new_pc) OVERRIDE { - SetGPR(RA, new_pc); + SetGPR(T9, new_pc); } bool IsAccessibleGPR(uint32_t reg) OVERRIDE { @@ -86,9 +86,10 @@ class MipsContext : public Context { // Pointers to registers in the stack, initialized to null except for the special cases below. uintptr_t* gprs_[kNumberOfCoreRegisters]; uint32_t* fprs_[kNumberOfFRegisters]; - // Hold values for sp and ra (return address) if they are not located within a stack frame, as - // well as the first argument. - uintptr_t sp_, ra_, arg0_; + // Hold values for sp and t9 if they are not located within a stack frame. We use t9 for the + // PC (as ra is required to be valid for single-frame deopt and must not be clobbered). We + // also need the first argument for single-frame deopt. + uintptr_t sp_, t9_, arg0_; }; } // namespace mips } // namespace art diff --git a/runtime/arch/mips/quick_entrypoints_mips.S b/runtime/arch/mips/quick_entrypoints_mips.S index ba58c3fcc..0691f2a62 100644 --- a/runtime/arch/mips/quick_entrypoints_mips.S +++ b/runtime/arch/mips/quick_entrypoints_mips.S @@ -374,7 +374,7 @@ ENTRY art_quick_do_long_jump lw $ra, 124($a0) lw $a0, 16($a0) move $v0, $zero # clear result registers r0 and r1 - jalr $zero, $ra # do long jump + jalr $zero, $t9 # do long jump move $v1, $zero END art_quick_do_long_jump diff --git a/test/Android.run-test.mk b/test/Android.run-test.mk index 5bbbbc1f5..6ce3d9472 100644 --- a/test/Android.run-test.mk +++ b/test/Android.run-test.mk @@ -441,11 +441,8 @@ TEST_ART_BROKEN_DEFAULT_RUN_TESTS := # Known broken tests for the mips32 optimizing compiler backend. TEST_ART_BROKEN_OPTIMIZING_MIPS_RUN_TESTS := \ 441-checker-inliner \ - 449-checker-bce \ 510-checker-try-catch \ 521-checker-array-set-null \ - 529-checker-unresolved \ - 534-checker-bce-deoptimization \ 536-checker-intrinsic-optimization \ ifeq (mips,$(TARGET_ARCH)) -- 2.11.0