summaryrefslogtreecommitdiff
path: root/src/compiler/codegen/arm/MethodCodegenDriver.cc
diff options
context:
space:
mode:
author buzbee <buzbee@google.com> 2011-10-05 12:56:36 -0700
committer buzbee <buzbee@google.com> 2011-10-05 13:11:35 -0700
commit99f272349671e14ceada1cc795ce4c66a38ddd3e (patch)
treeebd4a5c4c1ac47d837174daaf4684ae7b26c7b60 /src/compiler/codegen/arm/MethodCodegenDriver.cc
parent3ddc0d1108a00e14b60c60edcdeff3b81f9e35f9 (diff)
Special-case Object.<init> invoke
Identify direct invokes to Object.<init> and handle them similar to the old-word OP_INVOKE_OBJECT_INIT_xxx. Also, added missing null check for range-style invoke-direct and invoke-interface. Change-Id: I5789db4e85609b780063c4788fa40d627a6988c4
Diffstat (limited to 'src/compiler/codegen/arm/MethodCodegenDriver.cc')
-rw-r--r--src/compiler/codegen/arm/MethodCodegenDriver.cc23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/compiler/codegen/arm/MethodCodegenDriver.cc b/src/compiler/codegen/arm/MethodCodegenDriver.cc
index 922e25b4e6..fb665e68fa 100644
--- a/src/compiler/codegen/arm/MethodCodegenDriver.cc
+++ b/src/compiler/codegen/arm/MethodCodegenDriver.cc
@@ -817,8 +817,6 @@ STATIC int genDalvikArgsNoRange(CompilationUnit* cUnit, MIR* mir,
callState = loadArgRegs(cUnit, mir, dInsn, callState, nextCallInsn,
rollback, skipThis);
- //TODO: better to move this into CallInsn lists
- // Load direct & need a "this" null check?
if (pcrLabel) {
*pcrLabel = genNullCheck(cUnit, oatSSASrc(mir,0), r1, mir);
}
@@ -920,6 +918,9 @@ STATIC int genDalvikArgsRange(CompilationUnit* cUnit, MIR* mir,
rollback, skipThis);
callState = nextCallInsn(cUnit, mir, dInsn, callState, rollback);
+ if (pcrLabel) {
+ *pcrLabel = genNullCheck(cUnit, oatSSASrc(mir,0), r1, mir);
+ }
return callState;
}
@@ -947,6 +948,24 @@ STATIC void genInvokeStaticDirect(CompilationUnit* cUnit, MIR* mir,
// Explicit register usage
oatLockCallTemps(cUnit);
+ // Is this the special "Ljava/lang/Object;.<init>:()V" case?
+ if (mir->dalvikInsn.opcode == OP_INVOKE_DIRECT) {
+ int idx = mir->dalvikInsn.vB;
+ Method* target = cUnit->method->GetDexCacheResolvedMethods()->Get(idx);
+ if (target) {
+ if (PrettyMethod(target) == "java.lang.Object.<init>()V") {
+ RegLocation rlArg = oatGetSrc(cUnit, mir, 0);
+ loadValueDirectFixed(cUnit, rlArg, r0);
+ loadWordDisp(cUnit, rSELF,
+ OFFSETOF_MEMBER(Thread, pObjectInit), rLR);
+ genNullCheck(cUnit, oatSSASrc(mir,0), r0, mir);
+ opReg(cUnit, kOpBlx, rLR);
+ oatClobberCalleeSave(cUnit);
+ return;
+ }
+ }
+ }
+
if (range) {
callState = genDalvikArgsRange(cUnit, mir, dInsn, callState, pNullCk,
nextCallInsn, NULL, false);