diff options
-rw-r--r-- | tests/082-inline-execute/src/Main.java | 7 | ||||
-rw-r--r-- | vm/compiler/Dataflow.c | 2 | ||||
-rw-r--r-- | vm/compiler/codegen/arm/CodegenDriver.c | 29 |
3 files changed, 21 insertions, 17 deletions
diff --git a/tests/082-inline-execute/src/Main.java b/tests/082-inline-execute/src/Main.java index ac2b94641..b512091cf 100644 --- a/tests/082-inline-execute/src/Main.java +++ b/tests/082-inline-execute/src/Main.java @@ -138,8 +138,15 @@ public class Main { String sub = offset.substring(3, 13); String str32 = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; String str33 = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxy"; + String lc = "abcdefg"; + String uc = "ABCDEFG"; Object blah = new Object(); + for (int i = 0; i < 100; i++) { + String y = lc.toUpperCase(); + Assert.assertTrue(y.equals(uc)); + } + Assert.assertEquals(str32.compareTo(str33), -1); Assert.assertEquals(str33.compareTo(str32), 1); diff --git a/vm/compiler/Dataflow.c b/vm/compiler/Dataflow.c index d520d8454..787ac1506 100644 --- a/vm/compiler/Dataflow.c +++ b/vm/compiler/Dataflow.c @@ -747,7 +747,7 @@ int dvmCompilerDataFlowAttributes[kMirOpLast] = { DF_FORMAT_35C, // EF OP_EXECUTE_INLINE_RANGE - DF_NOP, + DF_FORMAT_3RC, // F0 OP_INVOKE_DIRECT_EMPTY DF_NOP, diff --git a/vm/compiler/codegen/arm/CodegenDriver.c b/vm/compiler/codegen/arm/CodegenDriver.c index 35460ed01..37fd65fdb 100644 --- a/vm/compiler/codegen/arm/CodegenDriver.c +++ b/vm/compiler/codegen/arm/CodegenDriver.c @@ -3289,15 +3289,14 @@ static bool genInlinedIndexOf(CompilationUnit *cUnit, MIR *mir, bool singleI) /* - * NOTE: We assume here that the special native inline routines - * are side-effect free. By making this assumption, we can safely - * re-execute the routine from the interpreter if it decides it - * wants to throw an exception. We still need to EXPORT_PC(), though. + * NOTE: Handles both range and non-range versions (arguments + * have already been normalized by this point). */ -static bool handleFmt3inline(CompilationUnit *cUnit, MIR *mir) +static bool handleExecuteInline(CompilationUnit *cUnit, MIR *mir) { DecodedInstruction *dInsn = &mir->dalvikInsn; switch( mir->dalvikInsn.opCode) { + case OP_EXECUTE_INLINE_RANGE: case OP_EXECUTE_INLINE: { unsigned int i; const InlineOperation* inLineTable = dvmGetInlineOpsTable(); @@ -3370,7 +3369,14 @@ static bool handleFmt3inline(CompilationUnit *cUnit, MIR *mir) } opReg(cUnit, kOpBlx, r4PC); opRegImm(cUnit, kOpAdd, r13, 8); - genZeroCheck(cUnit, r0, mir->offset, NULL); + opRegImm(cUnit, kOpCmp, r0, 0); /* NULL? */ + ArmLIR *branchOver = opCondBranch(cUnit, kArmCondNe); + loadConstant(cUnit, r0, + (int) (cUnit->method->insns + mir->offset)); + genDispatchToHandler(cUnit, TEMPLATE_THROW_EXCEPTION_COMMON); + ArmLIR *target = newLIR0(cUnit, kArmPseudoTargetLabel); + target->defMask = ENCODE_ALL; + branchOver->generic.target = (LIR *) target; break; } default: @@ -3379,13 +3385,6 @@ static bool handleFmt3inline(CompilationUnit *cUnit, MIR *mir) return false; } -static bool handleFmt3rinline(CompilationUnit *cUnit, MIR *mir) -{ - /* For OP_EXECUTE_INLINE_RANGE */ - genInterpSingleStep(cUnit, mir); - return false; -} - static bool handleFmt51l(CompilationUnit *cUnit, MIR *mir) { //TUNING: We're using core regs here - not optimal when target is a double @@ -3955,10 +3954,8 @@ void dvmCompilerMIR2LIR(CompilationUnit *cUnit) labelList); break; case kFmt3inline: - notHandled = handleFmt3inline(cUnit, mir); - break; case kFmt3rinline: - notHandled = handleFmt3rinline(cUnit, mir); + notHandled = handleExecuteInline(cUnit, mir); break; case kFmt51l: notHandled = handleFmt51l(cUnit, mir); |