From 6bbdd6b005ec5cb567ec9576190a7cd784248c5c Mon Sep 17 00:00:00 2001 From: Bill Buzbee Date: Tue, 16 Feb 2010 14:40:01 -0800 Subject: 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. --- vm/compiler/codegen/arm/CodegenDriver.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'vm/compiler/codegen/arm/CodegenDriver.c') 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); } } -- cgit v1.2.3