[Compiler] Exit-path bug fix
Surprised that we haven't run into this before. The exit code for
a method involves stripping the frame. For frame sizes < 1024 this
can be accomplished with an add sp,#imm. For larger frames we need
to materialize the frame size in a temp register and then do a
register to register add.
The exit path code was failing to ensure that r0/r1 were not used
as temps in the large frame case - otherwise the return value could
be clobbered.
Change-Id: If2618e9522fb10597f0f8c8e8afffd20d73b5d37
diff --git a/src/compiler/codegen/arm/MethodCodegenDriver.cc b/src/compiler/codegen/arm/MethodCodegenDriver.cc
index 3e844fd..4efa27a 100644
--- a/src/compiler/codegen/arm/MethodCodegenDriver.cc
+++ b/src/compiler/codegen/arm/MethodCodegenDriver.cc
@@ -1658,6 +1658,13 @@
oatFreeTemp(cUnit, r2);
oatFreeTemp(cUnit, r3);
} else if (bb->blockType == kExitBlock) {
+ /*
+ * In the exit path, r0/r1 are live - make sure they aren't
+ * allocated by the register utilities as temps.
+ */
+ oatLockTemp(cUnit, r0);
+ oatLockTemp(cUnit, r1);
+
newLIR0(cUnit, kArmPseudoMethodExit);
/* If we're compiling for the debugger, generate an update callout */
if (cUnit->genDebugger) {