OSDN Git Service

Jit: Fix register usage bug - Issue 2518825 native crash running ARMv5te JIT
authorBill Buzbee <buzbee@google.com>
Tue, 16 Mar 2010 19:41:43 +0000 (12:41 -0700)
committerBill Buzbee <buzbee@google.com>
Tue, 16 Mar 2010 19:52:08 +0000 (12:52 -0700)
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

vm/compiler/codegen/arm/CodegenDriver.c

index df0825a..79a9fb3 100644 (file)
@@ -565,6 +565,16 @@ static void genArrayObjectPut(CompilationUnit *cUnit, MIR *mir,
     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);