diff options
| author | Mattias Petersson <mattias.petersson@sonymobile.com> | 2012-06-07 16:39:21 +0200 |
|---|---|---|
| committer | Elliott Hughes <enh@google.com> | 2012-07-10 16:51:46 -0700 |
| commit | ac3da004fe02e855e2444ce76abf13f12e2e0050 (patch) | |
| tree | 0cf88b29f51d8734a6a864c62665bbda5579b8ff /vm/compiler/codegen/arm/CodegenDriver.cpp | |
| parent | 5220f12dca8ad2666a97e36862bf0d4767e3555e (diff) | |
Missing zero-checks in JIT compiler
Zero-checks were not generated by the JIT compiler for
some instructions. This caused crashes instead of
the expected ArithmeticException.
Change-Id: Ic8041741a7cccc1bd6b8c3c0723ba55a55af856b
Diffstat (limited to 'vm/compiler/codegen/arm/CodegenDriver.cpp')
| -rw-r--r-- | vm/compiler/codegen/arm/CodegenDriver.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/vm/compiler/codegen/arm/CodegenDriver.cpp b/vm/compiler/codegen/arm/CodegenDriver.cpp index d7017b0fe..d96aa6561 100644 --- a/vm/compiler/codegen/arm/CodegenDriver.cpp +++ b/vm/compiler/codegen/arm/CodegenDriver.cpp @@ -670,6 +670,7 @@ static bool genArithOpLong(CompilationUnit *cUnit, MIR *mir, OpKind firstOp = kOpBkpt; OpKind secondOp = kOpBkpt; bool callOut = false; + bool checkZero = false; void *callTgt; int retReg = r0; @@ -700,6 +701,7 @@ static bool genArithOpLong(CompilationUnit *cUnit, MIR *mir, case OP_DIV_LONG_2ADDR: callOut = true; retReg = r0; + checkZero = true; callTgt = (void*)__aeabi_ldivmod; break; /* NOTE - result is in r2/r3 instead of r0/r1 */ @@ -708,6 +710,7 @@ static bool genArithOpLong(CompilationUnit *cUnit, MIR *mir, callOut = true; callTgt = (void*)__aeabi_ldivmod; retReg = r2; + checkZero = true; break; case OP_AND_LONG_2ADDR: case OP_AND_LONG: @@ -746,9 +749,14 @@ static bool genArithOpLong(CompilationUnit *cUnit, MIR *mir, } else { // Adjust return regs in to handle case of rem returning r2/r3 dvmCompilerFlushAllRegs(cUnit); /* Send everything to home location */ + loadValueDirectWideFixed(cUnit, rlSrc2, r2, r3); loadValueDirectWideFixed(cUnit, rlSrc1, r0, r1); LOAD_FUNC_ADDR(cUnit, r14lr, (int) callTgt); - loadValueDirectWideFixed(cUnit, rlSrc2, r2, r3); + if (checkZero) { + int tReg = r12; // Using fixed registers during call sequence + opRegRegReg(cUnit, kOpOr, tReg, r2, r3); + genRegImmCheck(cUnit, kArmCondEq, tReg, 0, mir->offset, NULL); + } opReg(cUnit, kOpBlx, r14lr); dvmCompilerClobberCallRegs(cUnit); if (retReg == r0) |
