aboutsummaryrefslogtreecommitdiff
path: root/vm/compiler/codegen/arm/CodegenDriver.c
diff options
context:
space:
mode:
authorBill Buzbee <buzbee@google.com>2010-02-16 14:40:01 -0800
committerBill Buzbee <buzbee@google.com>2010-02-16 15:55:29 -0800
commit6bbdd6b005ec5cb567ec9576190a7cd784248c5c (patch)
treea1965f5743bf35e3f120eb1f15185ef43efde5e6 /vm/compiler/codegen/arm/CodegenDriver.c
parent3efafc8d16027ad79c5ec4008d2cc4fec16c07f3 (diff)
Jit: Monitor exit, possible fix for Issue 2396073
Two problems with monitor-exit: 1. The Jit code wasn't checking for exception thrown following unlocks of fat locks using dvmUnlockObject(). 2. The mterp interpreter unlock code branched to handle exceptions thrown during dvmUnlockObject() with the wrong dalvik PC (the dPC of the unlock, rather than the instruction following the unlock). Similar issue with the x86 interpreter fixed. Also, deleted armv7-a MONITOR_ENTER template, which turned out to be identical to the armv5te one.
Diffstat (limited to 'vm/compiler/codegen/arm/CodegenDriver.c')
-rw-r--r--vm/compiler/codegen/arm/CodegenDriver.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/vm/compiler/codegen/arm/CodegenDriver.c b/vm/compiler/codegen/arm/CodegenDriver.c
index 99d392dd0..4048c0a6d 100644
--- a/vm/compiler/codegen/arm/CodegenDriver.c
+++ b/vm/compiler/codegen/arm/CodegenDriver.c
@@ -1276,6 +1276,15 @@ static void genMonitorPortable(CompilationUnit *cUnit, MIR *mir)
loadConstant(cUnit, r2, (int)dvmUnlockObject);
/* Do the call */
opReg(cUnit, kOpBlx, r2);
+ opRegImm(cUnit, kOpCmp, r0, 0); /* Did we throw? */
+ ArmLIR *branchOver = opCondBranch(cUnit, kArmCondNe);
+ loadConstant(cUnit, r0,
+ (int) (cUnit->method->insns + mir->offset +
+ dexGetInstrWidthAbs(gDvm.instrWidth, OP_MONITOR_EXIT)));
+ genDispatchToHandler(cUnit, TEMPLATE_THROW_EXCEPTION_COMMON);
+ ArmLIR *target = newLIR0(cUnit, kArmPseudoTargetLabel);
+ target->defMask = ENCODE_ALL;
+ branchOver->generic.target = (LIR *) target;
dvmCompilerColbberCallRegs(cUnit);
}
}