Merge "Fixed instruction decoding for throw-verification error format." into dalvik-dev
diff --git a/src/compiler/Compiler.h b/src/compiler/Compiler.h
index a1f7ffb..1e0439b 100644
--- a/src/compiler/Compiler.h
+++ b/src/compiler/Compiler.h
@@ -57,6 +57,7 @@
     kPromoteRegs,
     kTrackLiveTemps,
     kSkipLargeMethodOptimization,
+    kSafeOptimizations,
 };
 
 /* Type of allocation for memory tuning */
@@ -131,6 +132,7 @@
     kDebugExerciseResolveMethod,
     kDebugVerifyDataflow,
     kDebugShowMemoryUsage,
+    kDebugShowNops,
 };
 
 extern uint32_t compilerDebugFlags;
diff --git a/src/compiler/Frontend.cc b/src/compiler/Frontend.cc
index d7bf51f..7988829 100644
--- a/src/compiler/Frontend.cc
+++ b/src/compiler/Frontend.cc
@@ -33,6 +33,7 @@
      //(1 << kPromoteRegs) |
      //(1 << kTrackLiveTemps) |
      //(1 << kSkipLargeMethodOptimization) |
+     //(1 << kSafeOptimizations) |
      0;
 
 uint32_t compilerDebugFlags = 0 |     // Enable debug/testing modes
@@ -47,6 +48,7 @@
      //(1 << kDebugExerciseResolveMethod) |
      //(1 << kDebugVerifyDataflow) |
      //(1 << kDebugShowMemoryUsage) |
+     //(1 << kDebugShowNops) |
      0;
 
 inline bool contentIsInsn(const u2* codePtr) {
diff --git a/src/compiler/Ralloc.cc b/src/compiler/Ralloc.cc
index 7223d7b..3353437 100644
--- a/src/compiler/Ralloc.cc
+++ b/src/compiler/Ralloc.cc
@@ -345,6 +345,7 @@
                 case 'D':
                     cUnit->regLocation[sReg].wide = true;
                     cUnit->regLocation[sReg+1].highWord = true;
+                    cUnit->regLocation[sReg+1].fp = true;
                     DCHECK_EQ(oatS2VReg(cUnit, sReg)+1,
                               oatS2VReg(cUnit, sReg+1));
                     cUnit->regLocation[sReg].fp = true;
diff --git a/src/compiler/codegen/CodegenUtil.cc b/src/compiler/codegen/CodegenUtil.cc
index 3cb426f..ad02c39 100644
--- a/src/compiler/codegen/CodegenUtil.cc
+++ b/src/compiler/codegen/CodegenUtil.cc
@@ -253,7 +253,7 @@
     LIR* lir = (LIR*) arg;
     int offset = lir->offset;
     int dest = lir->operands[0];
-    const bool dumpNop = false;
+    const bool dumpNop = (cUnit->enableDebug & (1 << kDebugShowNops));
 
     /* Handle pseudo-ops individually, and all regular insns as a group */
     switch(lir->opcode) {
diff --git a/src/compiler/codegen/GenCommon.cc b/src/compiler/codegen/GenCommon.cc
index 6792f61..3d46240 100644
--- a/src/compiler/codegen/GenCommon.cc
+++ b/src/compiler/codegen/GenCommon.cc
@@ -607,25 +607,13 @@
 
     for (int i = 0; i < numElems; i++) {
         oatResetRegPool(cUnit);
-        /* TUNING: move suspend count load into helper */
         LIR* lab = suspendLabel[i];
         LIR* resumeLab = (LIR*)lab->operands[0];
         cUnit->currentDalvikOffset = lab->operands[1];
         oatAppendLIR(cUnit, (LIR *)lab);
         int rTgt = loadHelper(cUnit, OFFSETOF_MEMBER(Thread,
                               pTestSuspendFromCode));
-        if (!cUnit->genDebugger) {
-            // use rSUSPEND for suspend count
-            loadWordDisp(cUnit, rSELF,
-                         Thread::SuspendCountOffset().Int32Value(), rSUSPEND);
-        }
         opReg(cUnit, kOpBlx, rTgt);
-        if ( cUnit->genDebugger) {
-            // use rSUSPEND for update debugger
-            loadWordDisp(cUnit, rSELF,
-                         OFFSETOF_MEMBER(Thread, pUpdateDebuggerFromCode),
-                         rSUSPEND);
-        }
         opUnconditionalBranch(cUnit, resumeLab);
     }
 #endif
@@ -930,7 +918,7 @@
         branch->target = target;
 #endif
         genBarrier(cUnit);
-        storeValue(cUnit, rlDest, getRetLoc(cUnit));
+        storeValue(cUnit, rlDest, oatGetReturn(cUnit));
     } else {
         int mReg = loadCurrMethod(cUnit);
         int resReg = oatAllocTemp(cUnit);
@@ -2137,11 +2125,17 @@
         return;
     }
     oatFlushAllRegs(cUnit);
-    LIR* branch;
     if (cUnit->genDebugger) {
         // If generating code for the debugger, always check for suspension
-        branch = opUnconditionalBranch(cUnit, NULL);
+        int rTgt = loadHelper(cUnit, OFFSETOF_MEMBER(Thread,
+                              pTestSuspendFromCode));
+        opReg(cUnit, kOpBlx, rTgt);
+        // Refresh rSUSPEND
+        loadWordDisp(cUnit, rSELF,
+                     OFFSETOF_MEMBER(Thread, pUpdateDebuggerFromCode),
+                     rSUSPEND);
     } else {
+        LIR* branch;
 #if defined(TARGET_ARM)
         // In non-debug case, only check periodically
         newLIR2(cUnit, kThumbSubRI8, rSUSPEND, 1);
@@ -2150,12 +2144,12 @@
         opRegImm(cUnit, kOpSub, rSUSPEND, 1);
         branch = opCmpImmBranch(cUnit, kCondEq, rSUSPEND, 0, NULL);
 #endif
+        LIR* retLab = newLIR0(cUnit, kPseudoTargetLabel);
+        LIR* target = rawLIR(cUnit, cUnit->currentDalvikOffset,
+                             kPseudoSuspendTarget, (intptr_t)retLab, mir->offset);
+        branch->target = (LIR*)target;
+        oatInsertGrowableList(cUnit, &cUnit->suspendLaunchpads, (intptr_t)target);
     }
-    LIR* retLab = newLIR0(cUnit, kPseudoTargetLabel);
-    LIR* target = rawLIR(cUnit, cUnit->currentDalvikOffset,
-                         kPseudoSuspendTarget, (intptr_t)retLab, mir->offset);
-    branch->target = (LIR*)target;
-    oatInsertGrowableList(cUnit, &cUnit->suspendLaunchpads, (intptr_t)target);
 #endif
 }
 
diff --git a/src/compiler/codegen/GenInvoke.cc b/src/compiler/codegen/GenInvoke.cc
index 4698868..c2d0d18 100644
--- a/src/compiler/codegen/GenInvoke.cc
+++ b/src/compiler/codegen/GenInvoke.cc
@@ -43,38 +43,52 @@
     int lastArgReg = rARG3;
     int startVReg = cUnit->numDalvikRegisters - cUnit->numIns;
     /*
-     * Arguments passed in registers should be flushed
-     * to their backing locations in the frame for now.
-     * Also, we need to do initial assignment for promoted
-     * arguments.  NOTE: an older version of dx had an issue
-     * in which it would reuse static method argument registers.
+     * Copy incoming arguments to their proper home locations.
+     * NOTE: an older version of dx had an issue in which
+     * it would reuse static method argument registers.
      * This could result in the same Dalvik virtual register
-     * being promoted to both core and fp regs.  In those
-     * cases, copy argument to both.  This will be uncommon
-     * enough that it isn't worth attempting to optimize.
+     * being promoted to both core and fp regs. To account for this,
+     * we only copy to the corresponding promoted physical register
+     * if it matches the type of the SSA name for the incoming
+     * argument.  It is also possible that long and double arguments
+     * end up half-promoted.  In those cases, we must flush the promoted
+     * half to memory as well.
      */
     for (int i = 0; i < cUnit->numIns; i++) {
-        PromotionMap vMap = cUnit->promotionMap[startVReg + i];
+        PromotionMap* vMap = &cUnit->promotionMap[startVReg + i];
         if (i <= (lastArgReg - firstArgReg)) {
             // If arriving in register
-            if (vMap.coreLocation == kLocPhysReg) {
-                opRegCopy(cUnit, vMap.coreReg, firstArgReg + i);
+            bool needFlush = true;
+            RegLocation* tLoc = &cUnit->regLocation[startVReg + i];
+            if ((vMap->coreLocation == kLocPhysReg) && !tLoc->fp) {
+                opRegCopy(cUnit, vMap->coreReg, firstArgReg + i);
+                needFlush = false;
+            } else if ((vMap->fpLocation == kLocPhysReg) && tLoc->fp) {
+                opRegCopy(cUnit, vMap->fpReg, firstArgReg + i);
+                needFlush = false;
+            } else {
+                needFlush = true;
             }
-            if (vMap.fpLocation == kLocPhysReg) {
-                opRegCopy(cUnit, vMap.fpReg, firstArgReg + i);
+
+            // For wide args, force flush if only half is promoted
+            if (tLoc->wide) {
+                PromotionMap* pMap = vMap + (tLoc->highWord ? -1 : +1);
+                needFlush |= (pMap->coreLocation != vMap->coreLocation) ||
+                             (pMap->fpLocation != vMap->fpLocation);
             }
-            // Also put a copy in memory in case we're partially promoted
-            storeBaseDisp(cUnit, rSP, oatSRegOffset(cUnit, startVReg + i),
-                          firstArgReg + i, kWord);
+            if (needFlush) {
+                storeBaseDisp(cUnit, rSP, oatSRegOffset(cUnit, startVReg + i),
+                              firstArgReg + i, kWord);
+            }
         } else {
             // If arriving in frame & promoted
-            if (vMap.coreLocation == kLocPhysReg) {
+            if (vMap->coreLocation == kLocPhysReg) {
                 loadWordDisp(cUnit, rSP, oatSRegOffset(cUnit, startVReg + i),
-                             vMap.coreReg);
+                             vMap->coreReg);
             }
-            if (vMap.fpLocation == kLocPhysReg) {
+            if (vMap->fpLocation == kLocPhysReg) {
                 loadWordDisp(cUnit, rSP, oatSRegOffset(cUnit, startVReg + i),
-                             vMap.fpReg);
+                             vMap->fpReg);
             }
         }
     }
diff --git a/src/compiler/codegen/MethodCodegenDriver.cc b/src/compiler/codegen/MethodCodegenDriver.cc
index 8dd099e..db491f1 100644
--- a/src/compiler/codegen/MethodCodegenDriver.cc
+++ b/src/compiler/codegen/MethodCodegenDriver.cc
@@ -25,18 +25,21 @@
                             INVALID_REG, INVALID_REG, INVALID_SREG};
 
 /* Mark register usage state and return long retloc */
-RegLocation getRetLocWide(CompilationUnit* cUnit)
+RegLocation oatGetReturnWide(CompilationUnit* cUnit)
 {
     RegLocation res = LOC_C_RETURN_WIDE;
+    oatClobber(cUnit, res.lowReg);
+    oatClobber(cUnit, res.highReg);
     oatLockTemp(cUnit, res.lowReg);
     oatLockTemp(cUnit, res.highReg);
     oatMarkPair(cUnit, res.lowReg, res.highReg);
     return res;
 }
 
-RegLocation getRetLoc(CompilationUnit* cUnit)
+RegLocation oatGetReturn(CompilationUnit* cUnit)
 {
     RegLocation res = LOC_C_RETURN;
+    oatClobber(cUnit, res.lowReg);
     oatLockTemp(cUnit, res.lowReg);
     return res;
 }
@@ -178,31 +181,37 @@
             break;
 
         case Instruction::RETURN_VOID:
-            genSuspendTest(cUnit, mir);
+            if (!cUnit->attrs & METHOD_IS_LEAF) {
+                genSuspendTest(cUnit, mir);
+            }
             break;
 
         case Instruction::RETURN:
         case Instruction::RETURN_OBJECT:
-            genSuspendTest(cUnit, mir);
-            storeValue(cUnit, getRetLoc(cUnit), rlSrc[0]);
+            if (!cUnit->attrs & METHOD_IS_LEAF) {
+                genSuspendTest(cUnit, mir);
+            }
+            storeValue(cUnit, oatGetReturn(cUnit), rlSrc[0]);
             break;
 
         case Instruction::RETURN_WIDE:
-            genSuspendTest(cUnit, mir);
-            storeValueWide(cUnit, getRetLocWide(cUnit), rlSrc[0]);
+            if (!cUnit->attrs & METHOD_IS_LEAF) {
+                genSuspendTest(cUnit, mir);
+            }
+            storeValueWide(cUnit, oatGetReturnWide(cUnit), rlSrc[0]);
             break;
 
         case Instruction::MOVE_RESULT_WIDE:
             if (mir->optimizationFlags & MIR_INLINED)
                 break;  // Nop - combined w/ previous invoke
-            storeValueWide(cUnit, rlDest, getRetLocWide(cUnit));
+            storeValueWide(cUnit, rlDest, oatGetReturnWide(cUnit));
             break;
 
         case Instruction::MOVE_RESULT:
         case Instruction::MOVE_RESULT_OBJECT:
             if (mir->optimizationFlags & MIR_INLINED)
                 break;  // Nop - combined w/ previous invoke
-            storeValue(cUnit, rlDest, getRetLoc(cUnit));
+            storeValue(cUnit, rlDest, oatGetReturn(cUnit));
             break;
 
         case Instruction::MOVE:
@@ -849,7 +858,9 @@
 
     handleThrowLaunchpads(cUnit);
 
-    removeRedundantBranches(cUnit);
+    if (!(cUnit->disableOpt & (1 << kSafeOptimizations))) {
+        removeRedundantBranches(cUnit);
+    }
 }
 
 /* Needed by the ld/st optmizatons */
diff --git a/src/compiler/codegen/RallocUtil.cc b/src/compiler/codegen/RallocUtil.cc
index bb2abba..232b304 100644
--- a/src/compiler/codegen/RallocUtil.cc
+++ b/src/compiler/codegen/RallocUtil.cc
@@ -1143,10 +1143,6 @@
         // Promote fpRegs
         for (int i = 0; (fpRegs[i].count > 0) && (i < numRegs); i++) {
             if (cUnit->promotionMap[fpRegs[i].sReg].fpLocation != kLocPhysReg) {
-                if (fpRegs[i].sReg >= cUnit->numRegs) {
-                    // don't promote arg regs
-                    continue;
-                }
                 int reg = oatAllocPreservedFPReg(cUnit, fpRegs[i].sReg,
                     fpRegs[i].doubleStart);
                 if (reg < 0) {
@@ -1159,10 +1155,6 @@
         for (int i = 0; (coreRegs[i].count > 0) && i < numRegs; i++) {
             if (cUnit->promotionMap[coreRegs[i].sReg].coreLocation !=
                     kLocPhysReg) {
-                if (coreRegs[i].sReg >= cUnit->numRegs) {
-                    // don't promote arg regs
-                    continue;
-                }
                 int reg = oatAllocPreservedCoreReg(cUnit, coreRegs[i].sReg);
                 if (reg < 0) {
                    break;  // No more left
diff --git a/src/compiler/codegen/arm/ArmRallocUtil.cc b/src/compiler/codegen/arm/ArmRallocUtil.cc
index d44d7cf..3335f59 100644
--- a/src/compiler/codegen/arm/ArmRallocUtil.cc
+++ b/src/compiler/codegen/arm/ArmRallocUtil.cc
@@ -134,17 +134,6 @@
     oatClobber(cUnit, fr15);
 }
 
-extern RegLocation oatGetReturnWide(CompilationUnit* cUnit)
-{
-    RegLocation res = LOC_C_RETURN_WIDE;
-    oatClobber(cUnit, r0);
-    oatClobber(cUnit, r1);
-    oatMarkInUse(cUnit, r0);
-    oatMarkInUse(cUnit, r1);
-    oatMarkPair(cUnit, res.lowReg, res.highReg);
-    return res;
-}
-
 extern RegLocation oatGetReturnWideAlt(CompilationUnit* cUnit)
 {
     RegLocation res = LOC_C_RETURN_WIDE;
@@ -158,14 +147,6 @@
     return res;
 }
 
-extern RegLocation oatGetReturn(CompilationUnit* cUnit)
-{
-    RegLocation res = LOC_C_RETURN;
-    oatClobber(cUnit, r0);
-    oatMarkInUse(cUnit, r0);
-    return res;
-}
-
 extern RegLocation oatGetReturnAlt(CompilationUnit* cUnit)
 {
     RegLocation res = LOC_C_RETURN;
diff --git a/src/compiler/codegen/arm/Assemble.cc b/src/compiler/codegen/arm/Assemble.cc
index a1f7bd7..2c13107 100644
--- a/src/compiler/codegen/arm/Assemble.cc
+++ b/src/compiler/codegen/arm/Assemble.cc
@@ -1142,7 +1142,8 @@
                 intptr_t target = targetLIR->offset;
                 int delta = target - pc;
                 lir->operands[0] = delta >> 1;
-                if (lir->operands[0] == 0) {  // Useless branch?
+                if (!(cUnit->disableOpt & (1 << kSafeOptimizations)) &&
+                    lir->operands[0] == 0) {  // Useless branch
                     lir->flags.isNop = true;
                     res = kRetryAll;
                 }
@@ -1157,12 +1158,13 @@
                     lir->operands[0] = 0;
                     oatSetupResourceMasks(lir);
                     res = kRetryAll;
-                }
-                lir->operands[0] = delta >> 1;
-                if ((lir->operands[0] == 0) ||
-                    (lir->operands[0] == -1)) {  // Useless branch?
-                    lir->flags.isNop = true;
-                    res = kRetryAll;
+                } else {
+                    lir->operands[0] = delta >> 1;
+                    if (!(cUnit->disableOpt & (1 << kSafeOptimizations)) &&
+                        lir->operands[0] == -1) {  // Useless branch
+                        lir->flags.isNop = true;
+                        res = kRetryAll;
+                    }
                 }
             } else if (lir->opcode == kThumbBlx1) {
                 DCHECK(NEXT_LIR(lir)->opcode == kThumbBlx2);
diff --git a/src/compiler/codegen/arm/Codegen.h b/src/compiler/codegen/arm/Codegen.h
index 3b866ce..09ff964 100644
--- a/src/compiler/codegen/arm/Codegen.h
+++ b/src/compiler/codegen/arm/Codegen.h
@@ -49,7 +49,6 @@
 
 int loadHelper(CompilationUnit* cUnit, int offset);
 LIR* callRuntimeHelper(CompilationUnit* cUnit, int reg);
-RegLocation getRetLoc(CompilationUnit* cUnit);
 LIR* loadConstant(CompilationUnit* cUnit, int reg, int immVal);
 void opRegCopyWide(CompilationUnit* cUnit, int destLo, int destHi,
                    int srcLo, int srcHi);
diff --git a/src/compiler/codegen/arm/Thumb2/Factory.cc b/src/compiler/codegen/arm/Thumb2/Factory.cc
index b6df8e3..1810573 100644
--- a/src/compiler/codegen/arm/Thumb2/Factory.cc
+++ b/src/compiler/codegen/arm/Thumb2/Factory.cc
@@ -1039,7 +1039,7 @@
         }
     }
     LIR* res = rawLIR(cUnit, cUnit->currentDalvikOffset, opcode, rDest, rSrc);
-    if (rDest == rSrc) {
+    if (!(cUnit->disableOpt && (1 << kSafeOptimizations)) && rDest == rSrc) {
         res->flags.isNop = true;
     }
     return res;
diff --git a/src/compiler/codegen/arm/Thumb2/Gen.cc b/src/compiler/codegen/arm/Thumb2/Gen.cc
index 1351992..557e87b 100644
--- a/src/compiler/codegen/arm/Thumb2/Gen.cc
+++ b/src/compiler/codegen/arm/Thumb2/Gen.cc
@@ -437,7 +437,7 @@
     else
          opcode = kThumbMovRR_L2H;
     res = rawLIR(cUnit, cUnit->currentDalvikOffset, opcode, rDest, rSrc);
-    if (rDest == rSrc) {
+    if (!(cUnit->disableOpt & (1 << kSafeOptimizations)) && rDest == rSrc) {
         res->flags.isNop = true;
     }
     return res;
diff --git a/src/compiler/codegen/mips/Codegen.h b/src/compiler/codegen/mips/Codegen.h
index 520d638..ca4e712 100644
--- a/src/compiler/codegen/mips/Codegen.h
+++ b/src/compiler/codegen/mips/Codegen.h
@@ -53,7 +53,6 @@
 
 int loadHelper(CompilationUnit* cUnit, int offset);
 LIR* callRuntimeHelper(CompilationUnit* cUnit, int reg);
-RegLocation getRetLoc(CompilationUnit* cUnit);
 LIR* loadConstant(CompilationUnit* cUnit, int reg, int immVal);
 void opRegCopyWide(CompilationUnit* cUnit, int destLo, int destHi,
                    int srcLo, int srcHi);
diff --git a/src/compiler/codegen/mips/Mips32/Factory.cc b/src/compiler/codegen/mips/Mips32/Factory.cc
index ecc0180..360fbb7 100644
--- a/src/compiler/codegen/mips/Mips32/Factory.cc
+++ b/src/compiler/codegen/mips/Mips32/Factory.cc
@@ -74,7 +74,7 @@
         }
     }
     LIR* res = rawLIR(cUnit, cUnit->currentDalvikOffset, opcode, rSrc, rDest);
-    if (rDest == rSrc) {
+    if (!(cUnit->disableOpt & (1 << kSafeOptimizations)) && rDest == rSrc) {
         res->flags.isNop = true;
     }
     return res;
diff --git a/src/compiler/codegen/mips/Mips32/Gen.cc b/src/compiler/codegen/mips/Mips32/Gen.cc
index 2bb2f7a..e86a942 100644
--- a/src/compiler/codegen/mips/Mips32/Gen.cc
+++ b/src/compiler/codegen/mips/Mips32/Gen.cc
@@ -450,7 +450,7 @@
 #endif
     LIR* res = rawLIR(cUnit, cUnit->currentDalvikOffset, kMipsMove,
                       rDest, rSrc);
-    if (rDest == rSrc) {
+    if (!(cUnit->disableOpt && (1 << kSafeOptimizations)) && rDest == rSrc) {
         res->flags.isNop = true;
     }
     return res;
diff --git a/src/compiler/codegen/mips/MipsRallocUtil.cc b/src/compiler/codegen/mips/MipsRallocUtil.cc
index 3cad4d9..22a19db 100644
--- a/src/compiler/codegen/mips/MipsRallocUtil.cc
+++ b/src/compiler/codegen/mips/MipsRallocUtil.cc
@@ -140,17 +140,6 @@
     oatClobber(cUnit, r_F15);
 }
 
-extern RegLocation oatGetReturnWide(CompilationUnit* cUnit)
-{
-    RegLocation res = LOC_C_RETURN_WIDE;
-    oatClobber(cUnit, res.lowReg);
-    oatClobber(cUnit, res.highReg);
-    oatMarkInUse(cUnit, res.lowReg);
-    oatMarkInUse(cUnit, res.highReg);
-    oatMarkPair(cUnit, res.lowReg, res.highReg);
-    return res;
-}
-
 extern RegLocation oatGetReturnWideAlt(CompilationUnit* cUnit)
 {
     RegLocation res = LOC_C_RETURN_WIDE_ALT;
@@ -170,14 +159,6 @@
     return res;
 }
 
-extern RegLocation oatGetReturnAlt(CompilationUnit* cUnit)
-{
-    RegLocation res = LOC_C_RETURN_ALT;
-    oatClobber(cUnit, res.lowReg);
-    oatMarkInUse(cUnit, res.lowReg);
-    return res;
-}
-
 extern RegisterInfo* oatGetRegInfo(CompilationUnit* cUnit, int reg)
 {
     return FPREG(reg) ? &cUnit->regPool->FPRegs[reg & FP_REG_MASK]
diff --git a/src/compiler/codegen/x86/Codegen.h b/src/compiler/codegen/x86/Codegen.h
index 2fb2df2..e8b66de 100644
--- a/src/compiler/codegen/x86/Codegen.h
+++ b/src/compiler/codegen/x86/Codegen.h
@@ -53,7 +53,6 @@
 
 int loadHelper(CompilationUnit* cUnit, int offset);
 LIR* callRuntimeHelper(CompilationUnit* cUnit, int reg);
-RegLocation getRetLoc(CompilationUnit* cUnit);
 LIR* loadConstant(CompilationUnit* cUnit, int reg, int immVal);
 void opRegCopyWide(CompilationUnit* cUnit, int destLo, int destHi,
                    int srcLo, int srcHi);
diff --git a/src/compiler/codegen/x86/X86RallocUtil.cc b/src/compiler/codegen/x86/X86RallocUtil.cc
index ec9b4b1..cd630a8 100644
--- a/src/compiler/codegen/x86/X86RallocUtil.cc
+++ b/src/compiler/codegen/x86/X86RallocUtil.cc
@@ -149,56 +149,6 @@
 #endif
 }
 
-extern RegLocation oatGetReturnWide(CompilationUnit* cUnit)
-{
-    RegLocation res = LOC_C_RETURN_WIDE;
-    oatClobber(cUnit, res.lowReg);
-    oatClobber(cUnit, res.highReg);
-    oatMarkInUse(cUnit, res.lowReg);
-    oatMarkInUse(cUnit, res.highReg);
-    oatMarkPair(cUnit, res.lowReg, res.highReg);
-    return res;
-}
-
-extern RegLocation oatGetReturnWideAlt(CompilationUnit* cUnit)
-{
-    UNIMPLEMENTED(WARNING) << "oatGetReturnWideAlt";
-    return oatGetReturnWide(cUnit);
-#if 0
-    // May not need this - it is used when calling a combined
-    // div/rem helper.  Quotient in regular return, remainder in alt regs
-    RegLocation res = LOC_C_RETURN_WIDE_ALT;
-    oatClobber(cUnit, res.lowReg);
-    oatClobber(cUnit, res.highReg);
-    oatMarkInUse(cUnit, res.lowReg);
-    oatMarkInUse(cUnit, res.highReg);
-    oatMarkPair(cUnit, res.lowReg, res.highReg);
-    return res;
-#endif
-}
-
-extern RegLocation oatGetReturn(CompilationUnit* cUnit)
-{
-    RegLocation res = LOC_C_RETURN;
-    oatClobber(cUnit, res.lowReg);
-    oatMarkInUse(cUnit, res.lowReg);
-    return res;
-}
-
-extern RegLocation oatGetReturnAlt(CompilationUnit* cUnit)
-{
-    UNIMPLEMENTED(WARNING) << "oatGetReturnWideAlt";
-    return oatGetReturn(cUnit);
-#if 0
-    // May not need this - it is used when calling a combined
-    // div/rem helper.  Quotient in regular return, remainder in alt regs
-    RegLocation res = LOC_C_RETURN_ALT;
-    oatClobber(cUnit, res.lowReg);
-    oatMarkInUse(cUnit, res.lowReg);
-    return res;
-#endif
-}
-
 extern RegisterInfo* oatGetRegInfo(CompilationUnit* cUnit, int reg)
 {
     return FPREG(reg) ? &cUnit->regPool->FPRegs[reg & FP_REG_MASK]