diff options
| author | 2011-09-30 17:25:59 -0700 | |
|---|---|---|
| committer | 2011-09-30 17:33:16 -0700 | |
| commit | 81bc509784e1bf20f9d92ce01ab9702123e2ef92 (patch) | |
| tree | 727f94397f0b09714a7ecc38c093267067054364 /src/compiler/codegen | |
| parent | 14134a10e9bbaff0faf314dc00c1a1aeef8ef86b (diff) | |
Silence a misleading compiler warning.
Now we use this code for wide volatiles, it can't always complain about
the field being unresolved.
Change-Id: Ieb0663d654f8af99890d4925cd8897f5c95c6001
Diffstat (limited to 'src/compiler/codegen')
| -rw-r--r-- | src/compiler/codegen/arm/MethodCodegenDriver.cc | 12 | ||||
| -rw-r--r-- | src/compiler/codegen/arm/Thumb2/Gen.cc | 22 |
2 files changed, 19 insertions, 15 deletions
diff --git a/src/compiler/codegen/arm/MethodCodegenDriver.cc b/src/compiler/codegen/arm/MethodCodegenDriver.cc index 9e026bea9f..80118d81fb 100644 --- a/src/compiler/codegen/arm/MethodCodegenDriver.cc +++ b/src/compiler/codegen/arm/MethodCodegenDriver.cc @@ -187,8 +187,7 @@ STATIC void genSput(CompilationUnit* cUnit, MIR* mir, RegLocation rlSrc) oatFlushAllRegs(cUnit); if (SLOW_FIELD_PATH || field == NULL) { // Slow path - LOG(INFO) << "Field " << fieldNameFromIndex(cUnit->method, fieldIdx) - << " unresolved at compile time"; + warnIfUnresolved(cUnit, fieldIdx, field); int funcOffset = isObject ? OFFSETOF_MEMBER(Thread, pSetObjStatic) : OFFSETOF_MEMBER(Thread, pSet32Static); loadWordDisp(cUnit, rSELF, funcOffset, rLR); @@ -252,8 +251,7 @@ STATIC void genSputWide(CompilationUnit* cUnit, MIR* mir, RegLocation rlSrc) bool isVolatile = false; #endif if (SLOW_FIELD_PATH || field == NULL || isVolatile) { - LOG(INFO) << "Field " << fieldNameFromIndex(cUnit->method, fieldIdx) - << " unresolved at compile time"; + warnIfUnresolved(cUnit, fieldIdx, field); loadWordDisp(cUnit, rSELF, OFFSETOF_MEMBER(Thread, pSet64Static), rLR); loadConstant(cUnit, r0, mir->dalvikInsn.vB); loadCurrMethodDirect(cUnit, r1); @@ -304,8 +302,7 @@ STATIC void genSgetWide(CompilationUnit* cUnit, MIR* mir, #endif oatFlushAllRegs(cUnit); if (SLOW_FIELD_PATH || field == NULL || isVolatile) { - LOG(INFO) << "Field " << fieldNameFromIndex(cUnit->method, fieldIdx) - << " unresolved at compile time"; + warnIfUnresolved(cUnit, fieldIdx, field); loadWordDisp(cUnit, rSELF, OFFSETOF_MEMBER(Thread, pGet64Static), rLR); loadConstant(cUnit, r0, mir->dalvikInsn.vB); loadCurrMethodDirect(cUnit, r1); @@ -354,9 +351,8 @@ STATIC void genSget(CompilationUnit* cUnit, MIR* mir, (mir->dalvikInsn.opcode == OP_SGET_OBJECT_VOLATILE)); oatFlushAllRegs(cUnit); if (SLOW_FIELD_PATH || field == NULL) { - LOG(INFO) << "Field " << fieldNameFromIndex(cUnit->method, fieldIdx) - << " unresolved at compile time"; // Slow path + warnIfUnresolved(cUnit, fieldIdx, field); int funcOffset = isObject ? OFFSETOF_MEMBER(Thread, pGetObjStatic) : OFFSETOF_MEMBER(Thread, pGet32Static); loadWordDisp(cUnit, rSELF, funcOffset, rLR); diff --git a/src/compiler/codegen/arm/Thumb2/Gen.cc b/src/compiler/codegen/arm/Thumb2/Gen.cc index 173aa64e44..5ef768776a 100644 --- a/src/compiler/codegen/arm/Thumb2/Gen.cc +++ b/src/compiler/codegen/arm/Thumb2/Gen.cc @@ -37,6 +37,15 @@ std::string fieldNameFromIndex(const Method* method, uint32_t fieldIdx) return class_name + "." + field_name; } +void warnIfUnresolved(CompilationUnit* cUnit, int fieldIdx, Field* field) { + if (field == NULL) { + LOG(INFO) << "Field " << fieldNameFromIndex(cUnit->method, fieldIdx) + << " unresolved at compile time"; + } else { + // We also use the slow path for wide volatile fields. + } +} + /* * Construct an s4 from two consecutive half-words of switch data. * This needs to check endianness because the DEX optimizer only swaps @@ -403,12 +412,11 @@ STATIC void markGCCard(CompilationUnit* cUnit, int valReg, int tgtAddrReg) * Helper function for Iget/put when field not resolved at compile time. * Will trash call temps and return with the field offset in r0. */ -STATIC void getFieldOffset(CompilationUnit* cUnit, MIR* mir) +STATIC void getFieldOffset(CompilationUnit* cUnit, MIR* mir, Field* fieldPtr) { int fieldIdx = mir->dalvikInsn.vC; oatFlushAllRegs(cUnit); - LOG(INFO) << "Field " << fieldNameFromIndex(cUnit->method, fieldIdx) - << " unresolved at compile time"; + warnIfUnresolved(cUnit, fieldIdx, fieldPtr); oatLockCallTemps(cUnit); // Explicit register usage loadCurrMethodDirect(cUnit, r1); // arg1 <= Method* loadWordDisp(cUnit, r1, @@ -447,7 +455,7 @@ STATIC void genIGet(CompilationUnit* cUnit, MIR* mir, OpSize size, RegLocation rlResult; RegisterClass regClass = oatRegClassBySize(size); if (SLOW_FIELD_PATH || fieldPtr == NULL) { - getFieldOffset(cUnit, mir); + getFieldOffset(cUnit, mir, fieldPtr); // Field offset in r0 rlObj = loadValue(cUnit, rlObj, kCoreReg); rlResult = oatEvalLoc(cUnit, rlDest, regClass, true); @@ -481,7 +489,7 @@ STATIC void genIPut(CompilationUnit* cUnit, MIR* mir, OpSize size, GetResolvedField(mir->dalvikInsn.vC); RegisterClass regClass = oatRegClassBySize(size); if (SLOW_FIELD_PATH || fieldPtr == NULL) { - getFieldOffset(cUnit, mir); + getFieldOffset(cUnit, mir, fieldPtr); // Field offset in r0 rlObj = loadValue(cUnit, rlObj, kCoreReg); rlSrc = loadValue(cUnit, rlSrc, regClass); @@ -525,7 +533,7 @@ STATIC void genIGetWide(CompilationUnit* cUnit, MIR* mir, RegLocation rlDest, bool isVolatile = false; #endif if ((fieldPtr == NULL) || isVolatile) { - getFieldOffset(cUnit, mir); + getFieldOffset(cUnit, mir, fieldPtr); // Field offset in r0 rlObj = loadValue(cUnit, rlObj, kCoreReg); rlResult = oatEvalLoc(cUnit, rlDest, kAnyReg, true); @@ -563,7 +571,7 @@ STATIC void genIPutWide(CompilationUnit* cUnit, MIR* mir, RegLocation rlSrc, bool isVolatile = false; #endif if ((fieldPtr == NULL) || isVolatile) { - getFieldOffset(cUnit, mir); + getFieldOffset(cUnit, mir, fieldPtr); // Field offset in r0 rlObj = loadValue(cUnit, rlObj, kCoreReg); rlSrc = loadValueWide(cUnit, rlSrc, kAnyReg); |