Jit: Fix register usage bug - Issue 2518825 native crash running ARMv5te JIT
Change I8ca61804 added a call to dvmCanPutArrayElement for APUT_OBJECT,
but did so in a way that violated register usage restrictions. This change
tells the register allocation system what registers we expect to remain
live across the call to dvmCanPutArrayElement.
Change-Id: Icd83b888ba60768a196070d62d07d12c7a3c73c6
diff --git a/vm/compiler/codegen/arm/CodegenDriver.c b/vm/compiler/codegen/arm/CodegenDriver.c
index df0825a..79a9fb3 100644
--- a/vm/compiler/codegen/arm/CodegenDriver.c
+++ b/vm/compiler/codegen/arm/CodegenDriver.c
@@ -565,6 +565,16 @@
loadWordDisp(cUnit, r0, offsetof(Object, clazz), r0);
opReg(cUnit, kOpBlx, r2);
dvmCompilerClobberCallRegs(cUnit);
+
+ /*
+ * Using fixed registers here, and counting on r4 and r7 being
+ * preserved across the above call. Tell the register allocation
+ * utilities about the regs we are using directly
+ */
+ dvmCompilerLockTemp(cUnit, regPtr); // r4PC
+ dvmCompilerLockTemp(cUnit, regIndex); // r7
+ dvmCompilerLockTemp(cUnit, r0);
+
/* Bad? - roll back and re-execute if so */
genRegImmCheck(cUnit, kArmCondEq, r0, 0, mir->offset, pcrLabel);