OSDN Git Service

Fix stack overflow for mutual recursion.
authorBrian Carlstrom <bdc@google.com>
Fri, 14 Mar 2014 01:10:08 +0000 (18:10 -0700)
committerMathieu Chartier <mathieuc@google.com>
Mon, 17 Mar 2014 22:22:35 +0000 (15:22 -0700)
commitc0f96d03a1855fda7d94332331b94860404874dd
tree3f1746ec20cbe5f2812b680935aac81eb142b971
parent773965c0168c5bd19d727ddb950c74382dcb9fa4
Fix stack overflow for mutual recursion.

There was an error where we would have a pc that was in the method
which generated the stack overflow. This didn't work however
because the stack overflow check was before we stored the method in
the stack. The result was that the stack overflow handler had a PC
which wasnt necessarily in the method at the top of the stack. This
is now fixed by always restoring the link register before branching
to the throw entrypoint.

Slight code size regression on ARM/Mips (unmeasured). Regression on ARM
is 4 bytes of code per stack overflow check. Some of this regression is
mitigated by having one less GC safepoint.

Also adds test case for StackOverflowError issue (from bdc).

Tests passing: ARM, X86, Mips
Phone booting: ARM

Bug: https://code.google.com/p/android/issues/detail?id=66411
Bug: 12967914
Change-Id: I96fe667799458b58d1f86671e051968f7be78d5d
12 files changed:
compiler/dex/quick/arm/utility_arm.cc
compiler/dex/quick/gen_common.cc
compiler/dex/quick/gen_invoke.cc
compiler/dex/quick/mips/mips_lir.h
compiler/dex/quick/mir_to_lir.h
compiler/dex/quick/x86/assemble_x86.cc
compiler/dex/quick/x86/call_x86.cc
compiler/dex/quick/x86/utility_x86.cc
compiler/dex/quick/x86/x86_lir.h
runtime/oat.cc
test/018-stack-overflow/expected.txt
test/018-stack-overflow/src/Main.java