diff options
58 files changed, 69 insertions, 199 deletions
diff --git a/vm/CheckJni.c b/vm/CheckJni.c index c43b1c68c..3c87eaf99 100644 --- a/vm/CheckJni.c +++ b/vm/CheckJni.c @@ -878,7 +878,6 @@ static void checkMethodArgsV(JNIEnv* env, jmethodID methodID, va_list args, const Method* meth = (const Method*) methodID; const char* desc = meth->shorty; - ClassObject* clazz; LOGV("V-checking %s.%s:%s...\n", meth->clazz->descriptor, meth->name, desc); @@ -901,7 +900,6 @@ static void checkMethodArgsV(JNIEnv* env, jmethodID methodID, va_list args, } } -bail: JNI_EXIT(); #endif } @@ -918,7 +916,6 @@ static void checkMethodArgsA(JNIEnv* env, jmethodID methodID, jvalue* args, const Method* meth = (const Method*) methodID; const char* desc = meth->shorty; - ClassObject* clazz; int idx = 0; LOGV("A-checking %s.%s:%s...\n", meth->clazz->descriptor, meth->name, desc); @@ -932,7 +929,6 @@ static void checkMethodArgsA(JNIEnv* env, jmethodID methodID, jvalue* args, idx++; } -bail: JNI_EXIT(); #endif } @@ -1174,8 +1170,6 @@ static void* releaseGuardedPACopy(JNIEnv* env, jarray jarr, void* dataBuf, int mode) { ArrayObject* arrObj = (ArrayObject*) dvmDecodeIndirectRef(env, jarr); - PrimitiveType primType = arrObj->obj.clazz->elementClass->primitiveType; - //int len = array->length * dvmPrimitiveTypeWidth(primType); bool release, copyBack; u1* result; diff --git a/vm/Debugger.c b/vm/Debugger.c index 2f57046b7..5bf3ec0f0 100644 --- a/vm/Debugger.c +++ b/vm/Debugger.c @@ -293,10 +293,12 @@ static RefTypeId classObjectToRefTypeId(ClassObject* clazz) { return (RefTypeId) registerObject((Object*) clazz, kRefTypeId, true); } +#if 0 static RefTypeId classObjectToRefTypeIdNoReg(ClassObject* clazz) { return (RefTypeId) registerObject((Object*) clazz, kRefTypeId, false); } +#endif static ClassObject* refTypeIdToClassObject(RefTypeId id) { assert(objectIsRegistered(id, kRefTypeId) || !gDvm.debuggerConnected); @@ -1340,7 +1342,6 @@ void dvmDbgOutputLineTable(RefTypeId refTypeId, MethodId methodId, { Method* method; u8 start, end; - int i; DebugCallbackContext context; memset (&context, 0, sizeof(DebugCallbackContext)); @@ -26,6 +26,7 @@ # LOCAL_CFLAGS += -fstrict-aliasing -Wstrict-aliasing=2 -fno-align-jumps #LOCAL_CFLAGS += -DUSE_INDIRECT_REF +LOCAL_CFLAGS += -Wall -Wextra -Wno-unused-parameter # # Optional features. These may impact the size or performance of the VM. diff --git a/vm/Exception.c b/vm/Exception.c index 13b051e50..5e01dfc1b 100644 --- a/vm/Exception.c +++ b/vm/Exception.c @@ -1109,7 +1109,7 @@ ArrayObject* dvmGetStackTrace(const Object* ostackData) { const ArrayObject* stackData = (const ArrayObject*) ostackData; const int* intVals; - int i, stackSize; + int stackSize; stackSize = stackData->length / 2; intVals = (const int*) stackData->contents; diff --git a/vm/IndirectRefTable.c b/vm/IndirectRefTable.c index bea0a0f88..7a531a510 100644 --- a/vm/IndirectRefTable.c +++ b/vm/IndirectRefTable.c @@ -129,7 +129,7 @@ static inline void updateSlotAdd(IndirectRefTable* pRef, Object* obj, int slot) static inline void updateSlotRemove(IndirectRefTable* pRef, int slot) { if (pRef->slotData != NULL) { - IndirectRefSlot* pSlot = &pRef->slotData[slot]; + //IndirectRefSlot* pSlot = &pRef->slotData[slot]; //LOGI("+++ remove [%d] slot %d, serial now %d\n", // pRef->kind, slot, pSlot->serial); } @@ -144,7 +144,6 @@ IndirectRef dvmAddToIndirectRefTable(IndirectRefTable* pRef, u4 cookie, IRTSegmentState prevState; prevState.all = cookie; int topIndex = pRef->segmentState.parts.topIndex; - int bottomIndex = prevState.parts.topIndex; assert(obj != NULL); assert(dvmIsValidObject(obj)); @@ -195,7 +194,7 @@ IndirectRef dvmAddToIndirectRefTable(IndirectRefTable* pRef, u4 cookie, Object** pScan = &pRef->table[topIndex - 1]; assert(*pScan != NULL); while (*--pScan != NULL) { - assert(pScan >= pRef->table + bottomIndex); + assert(pScan >= pRef->table + prevState.parts.topIndex); } updateSlotAdd(pRef, obj, pScan - pRef->table); result = dvmObjectToIndirectRef(pRef, obj, pScan - pRef->table, @@ -835,7 +835,6 @@ static int dvmProcessOptions(int argc, const char* const argv[], strncmp(argv[i], "-agentlib:jdwp=", 15) == 0) { const char* tail; - bool result = false; if (argv[i][1] == 'X') tail = argv[i] + 10; diff --git a/vm/InlineNative.c b/vm/InlineNative.c index 384232614..232395808 100644 --- a/vm/InlineNative.c +++ b/vm/InlineNative.c @@ -225,7 +225,7 @@ static bool javaLangString_compareTo(u4 arg0, u4 arg1, u4 arg2, u4 arg3, ArrayObject* compArray; const u2* thisChars; const u2* compChars; - int i, minCount, countDiff; + int minCount, countDiff; thisCount = dvmGetFieldInt((Object*) arg0, STRING_FIELDOFF_COUNT); compCount = dvmGetFieldInt((Object*) arg1, STRING_FIELDOFF_COUNT); @@ -251,6 +251,7 @@ static bool javaLangString_compareTo(u4 arg0, u4 arg1, u4 arg2, u4 arg3, */ int otherRes = __memcmp16(thisChars, compChars, minCount); # ifdef CHECK_MEMCMP16 + int i; for (i = 0; i < minCount; i++) { if (thisChars[i] != compChars[i]) { pResult->i = (s4) thisChars[i] - (s4) compChars[i]; @@ -273,6 +274,7 @@ static bool javaLangString_compareTo(u4 arg0, u4 arg1, u4 arg2, u4 arg3, * the characters that overlap, and if they're all the same then return * the difference in lengths. */ + int i; for (i = 0; i < minCount; i++) { if (thisChars[i] != compChars[i]) { pResult->i = (s4) thisChars[i] - (s4) compChars[i]; @@ -324,7 +326,6 @@ static bool javaLangString_equals(u4 arg0, u4 arg1, u4 arg2, u4 arg3, ArrayObject* compArray; const u2* thisChars; const u2* compChars; - int i; /* quick length check */ thisCount = dvmGetFieldInt((Object*) arg0, STRING_FIELDOFF_COUNT); @@ -363,6 +364,7 @@ static bool javaLangString_equals(u4 arg0, u4 arg1, u4 arg2, u4 arg3, * meaningful comparison when the strings don't match (could also test * with palindromes). */ + int i; //for (i = 0; i < thisCount; i++) for (i = thisCount-1; i >= 0; --i) { diff --git a/vm/JarFile.c b/vm/JarFile.c index fbadf9c3d..a0d24d177 100644 --- a/vm/JarFile.c +++ b/vm/JarFile.c @@ -276,7 +276,7 @@ tryArchive: if (newFile) { u8 startWhen, extractWhen, endWhen; bool result; - off_t dexOffset, fileLen; + off_t dexOffset; dexOffset = lseek(fd, 0, SEEK_CUR); result = (dexOffset > 0); @@ -859,7 +859,6 @@ static jobject addGlobalReference(Object* obj) } #endif -bail: dvmUnlockMutex(&gDvm.jniGlobalRefLock); return jobj; } @@ -956,7 +955,7 @@ static jweak createWeakGlobalRef(JNIEnv* env, jobject jobj) JValue unused; dvmCallMethod(self, gDvm.methJavaLangRefPhantomReference_init, phantomObj, - &unused, jobj, NULL); + &unused, obj, NULL); dvmReleaseTrackedAlloc(phantomObj, self); if (dvmCheckException(self)) { @@ -1248,8 +1247,6 @@ jobjectRefType dvmGetJNIRefType(JNIEnv* env, jobject jobj) #else ReferenceTable* pRefTable = getLocalRefTable(env); Thread* self = dvmThreadSelf(); - //Object** top; - Object** ptr; if (dvmIsWeakGlobalRef(jobj)) { return JNIWeakGlobalRefType; @@ -1975,7 +1972,7 @@ static jobject ToReflectedField(JNIEnv* env, jclass jcls, jfieldID fieldID, { JNI_ENTER(); ClassObject* clazz = (ClassObject*) dvmDecodeIndirectRef(env, jcls); - Object* obj = dvmCreateReflectObjForField(jcls, (Field*) fieldID); + Object* obj = dvmCreateReflectObjForField(clazz, (Field*) fieldID); dvmReleaseTrackedAlloc(obj, NULL); jobject jobj = addLocalReference(env, obj); JNI_EXIT(); @@ -323,7 +323,7 @@ bool dvmIsBitSet(const BitVector* pBits, int num) */ int dvmCountSetBits(const BitVector* pBits) { - int word, bit; + int word; int count = 0; for (word = 0; word < pBits->storageSize; word++) { diff --git a/vm/Native.c b/vm/Native.c index 967482cfc..83f32b40b 100644 --- a/vm/Native.c +++ b/vm/Native.c @@ -213,7 +213,6 @@ static SharedLib* findSharedLibEntry(const char* pathName) static SharedLib* addSharedLibEntry(SharedLib* pLib) { u4 hash = dvmComputeUtf8Hash(pLib->pathName); - void* ent; /* * Do the lookup with the "add" flag set. If we add it, we will get diff --git a/vm/PointerSet.c b/vm/PointerSet.c index 6cc6e7966..2c96a744a 100644 --- a/vm/PointerSet.c +++ b/vm/PointerSet.c @@ -30,6 +30,7 @@ struct PointerSet { /* * Verify that the set is in sorted order. */ +#ifndef NDEBUG static bool verifySorted(PointerSet* pSet) { const void* last = NULL; @@ -44,7 +45,7 @@ static bool verifySorted(PointerSet* pSet) return true; } - +#endif /* * Allocate a new PointerSet. @@ -181,7 +182,7 @@ bool dvmPointerSetAddEntry(PointerSet* pSet, const void* ptr) */ bool dvmPointerSetRemoveEntry(PointerSet* pSet, const void* ptr) { - int i, where; + int where; if (!dvmPointerSetHas(pSet, ptr, &where)) return false; diff --git a/vm/Profile.c b/vm/Profile.c index b079988a0..bc5e05a42 100644 --- a/vm/Profile.c +++ b/vm/Profile.c @@ -278,7 +278,7 @@ static int dumpMarkedMethods(void* vclazz, void* vfp) FILE* fp = (FILE*) vfp; Method* meth; char* name; - int i, lineNum; + int i; dexStringCacheInit(&stringCache); diff --git a/vm/StdioConverter.c b/vm/StdioConverter.c index 54ceb0b96..efc1e8959 100644 --- a/vm/StdioConverter.c +++ b/vm/StdioConverter.c @@ -172,7 +172,6 @@ static void* stdioConverterThreadStart(void* arg) * Read until shutdown time. */ while (!gDvm.haltStdioConverter) { - ssize_t actual; fd_set readfds; int maxFd, fdCount; @@ -374,7 +374,7 @@ static void logContentionEvent(Thread *self, u4 waitMs, u4 samplePercent) u4 relativePc; char eventBuffer[132]; const char *fileName; - char procName[33], *selfName, *ownerName; + char procName[33], *selfName; char *cp; size_t len; int fd; @@ -430,7 +430,6 @@ static void logContentionEvent(Thread *self, u4 waitMs, u4 samplePercent) */ static void lockMonitor(Thread* self, Monitor* mon) { - Thread *owner; ThreadStatus oldStatus; u4 waitThreshold, samplePercent; u8 waitStart, waitEnd, waitMs; diff --git a/vm/Thread.c b/vm/Thread.c index 6410bb416..8a3fa53e4 100644 --- a/vm/Thread.c +++ b/vm/Thread.c @@ -1723,7 +1723,6 @@ static void threadExitUncaughtException(Thread* self, Object* group) { Object* exception; Object* handlerObj; - ClassObject* throwable; Method* uncaughtHandler = NULL; InstField* threadHandler; @@ -4104,6 +4103,7 @@ static void gcScanReferenceTable(ReferenceTable *refTable) } } +#ifdef USE_INDIRECT_REF static void gcScanIndirectRefTable(IndirectRefTable* pRefTable) { Object** op = pRefTable->table; @@ -4117,6 +4117,7 @@ static void gcScanIndirectRefTable(IndirectRefTable* pRefTable) op++; } } +#endif /* * Scan a Thread and mark any objects it references. diff --git a/vm/alloc/HeapSource.c b/vm/alloc/HeapSource.c index 3f0c7b5f2..31df82327 100644 --- a/vm/alloc/HeapSource.c +++ b/vm/alloc/HeapSource.c @@ -539,7 +539,6 @@ dvmHeapSourceShutdown(GcHeap **gcHeap) { if (*gcHeap != NULL && (*gcHeap)->heapSource != NULL) { HeapSource *hs; - size_t i; hs = (*gcHeap)->heapSource; @@ -635,7 +634,7 @@ void dvmHeapSourceGetObjectBitmaps(HeapBitmap liveBits[], HeapBitmap markBits[], { HeapSource *hs = gHs; uintptr_t base, max; - size_t i, offset; + size_t i; HS_BOILERPLATE(); @@ -670,7 +669,7 @@ void dvmHeapSourceSwapBitmaps(void) void dvmMarkImmuneObjects(const char *immuneLimit) { char *dst, *src; - size_t i, offset, index, length; + size_t i, index, length; /* * Copy the contents of the live bit vector for immune object diff --git a/vm/analysis/CodeVerify.c b/vm/analysis/CodeVerify.c index 91f541484..becce81da 100644 --- a/vm/analysis/CodeVerify.c +++ b/vm/analysis/CodeVerify.c @@ -114,7 +114,9 @@ typedef struct RegisterTable { /* fwd */ +#ifndef NDEBUG static void checkMergeTab(void); +#endif static bool isInitMethod(const Method* meth); static RegType getInvocationThis(const RegType* insnRegs,\ const int insnRegCount, const DecodedInstruction* pDecInsn, @@ -540,10 +542,12 @@ static bool isInitMethod(const Method* meth) /* * Is this method a class initializer? */ +#if 0 static bool isClassInitMethod(const Method* meth) { return (*meth->name == '<' && strcmp(meth->name+1, "clinit>") == 0); } +#endif /* * Look up a class reference given as a simple string descriptor. @@ -1338,8 +1342,6 @@ static ClassObject* getFieldClass(const Method* meth, const Field* field) static inline RegType getRegisterType(const RegType* insnRegs, const int insnRegCount, u4 vsrc, VerifyError* pFailure) { - RegType type; - if (vsrc >= (u4) insnRegCount) { *pFailure = VERIFY_ERROR_GENERIC; return kRegTypeUnknown; @@ -3105,10 +3107,7 @@ bool dvmVerifyCodeFlow(Method* meth, InsnFlags* insnFlags, { bool result = false; const int insnsSize = dvmGetMethodInsnsSize(meth); - const u2* insns = meth->insns; const bool generateRegisterMap = gDvm.generateRegisterMaps; - int i, offset; - bool isConditional; RegisterTable regTable; memset(®Table, 0, sizeof(regTable)); @@ -3258,11 +3257,10 @@ static bool doCodeVerification(Method* meth, InsnFlags* insnFlags, RegisterTable* regTable, UninitInstanceMap* uninitMap) { const int insnsSize = dvmGetMethodInsnsSize(meth); - const u2* insns = meth->insns; RegType workRegs[meth->registersSize + kExtraRegs]; bool result = false; bool debugVerbose = false; - int insnIdx, startGuess, prevAddr; + int insnIdx, startGuess; /* * Begin by marking the first instruction as "changed". @@ -3520,7 +3518,6 @@ static bool verifyInstruction(Method* meth, InsnFlags* insnFlags, const DexFile* pDexFile = meth->clazz->pDvmDex->pDexFile; RegType entryRegs[meth->registersSize + kExtraRegs]; ClassObject* resClass; - const char* className; int branchTarget = 0; const int insnRegCount = meth->registersSize; RegType tmpType; @@ -4062,7 +4059,6 @@ static bool verifyInstruction(Method* meth, InsnFlags* insnFlags, case OP_IF_NE: { RegType type1, type2; - bool tmpResult; type1 = getRegisterType(workRegs, insnRegCount, decInsn.vA, &failure); @@ -4488,7 +4484,6 @@ aput_1nr_common: goto iget_1nr_common; iget_1nr_common: { - ClassObject* fieldClass; InstField* instField; RegType objType, fieldType; @@ -4521,7 +4516,6 @@ iget_1nr_common: case OP_IGET_WIDE_VOLATILE: { RegType dstType; - ClassObject* fieldClass; InstField* instField; RegType objType; @@ -4609,7 +4603,6 @@ iget_1nr_common: iput_1nr_common: { RegType srcType, fieldType, objType; - ClassObject* fieldClass; InstField* instField; srcType = getRegisterType(workRegs, insnRegCount, decInsn.vA, @@ -4665,7 +4658,6 @@ iput_1nr_common: checkWidePair(tmpType, typeHi, &failure); } if (VERIFY_OK(failure)) { - ClassObject* fieldClass; InstField* instField; RegType objType; @@ -5125,7 +5117,6 @@ sput_1nr_common: * do this for all registers that have the same object * instance in them, not just the "this" register. */ - int uidx = regTypeToUninitIndex(thisType); markRefsAsInitialized(workRegs, insnRegCount, uninitMap, thisType, &failure); if (!VERIFY_OK(failure)) @@ -5683,7 +5674,6 @@ sput_1nr_common: */ if ((nextFlags & kInstrCanThrow) != 0 && dvmInsnIsInTry(insnFlags, insnIdx)) { - DexFile* pDexFile = meth->clazz->pDvmDex->pDexFile; const DexCode* pCode = dvmGetMethodCode(meth); DexCatchIterator iterator; diff --git a/vm/analysis/DexPrepare.c b/vm/analysis/DexPrepare.c index 5756cd0ce..b3ddcd1c8 100644 --- a/vm/analysis/DexPrepare.c +++ b/vm/analysis/DexPrepare.c @@ -667,7 +667,6 @@ bool dvmContinueOptimization(int fd, off_t dexOffset, long dexLength, optHdr.flags = headerFlags; optHdr.checksum = optChecksum; - ssize_t actual; lseek(fd, 0, SEEK_SET); if (sysWriteFully(fd, &optHdr, sizeof(optHdr), "DexOpt opt header") != 0) goto bail; @@ -1239,11 +1238,10 @@ bail: static int writeDependencies(int fd, u4 modWhen, u4 crc) { u1* buf = NULL; - ssize_t actual; int result = -1; ssize_t bufLen; ClassPathEntry* cpe; - int i, numDeps; + int numDeps; /* * Count up the number of completed entries in the bootclasspath. @@ -1307,7 +1305,6 @@ static int writeDependencies(int fd, u4 modWhen, u4 crc) */ static bool writeChunk(int fd, u4 type, const void* data, size_t size) { - ssize_t actual; union { /* save a syscall by grouping these together */ char raw[8]; struct { diff --git a/vm/analysis/DexVerify.c b/vm/analysis/DexVerify.c index 8f4ee7fde..9309a11f5 100644 --- a/vm/analysis/DexVerify.c +++ b/vm/analysis/DexVerify.c @@ -120,7 +120,7 @@ static bool verifyMethod(Method* meth, int verifyFlags) bool result = false; UninitInstanceMap* uninitMap = NULL; InsnFlags* insnFlags = NULL; - int i, newInstanceCount; + int newInstanceCount; /* * If there aren't any instructions, make sure that's expected, then @@ -495,7 +495,6 @@ static bool verifyInstructions(const Method* meth, InsnFlags* insnFlags, int width = dvmInsnGetWidth(insnFlags, i); OpCode opcode = *insns & 0xff; InstructionFlags opFlags = dexGetInstrFlags(gDvm.instrFlags, opcode); - int offset, absOffset; if ((opFlags & gcMask) != 0) { /* diff --git a/vm/analysis/Optimize.c b/vm/analysis/Optimize.c index 354389fe6..82d50cd63 100644 --- a/vm/analysis/Optimize.c +++ b/vm/analysis/Optimize.c @@ -36,8 +36,6 @@ struct InlineSub { /* fwd */ -static void optimizeLoadedClasses(DexFile* pDexFile); -static void optimizeClass(ClassObject* clazz); static bool optimizeMethod(Method* method); static void rewriteInstField(Method* method, u2* insns, OpCode newOpc); static bool rewriteVirtualInvoke(Method* method, u2* insns, OpCode newOpc); @@ -562,7 +560,6 @@ static void rewriteInstField(Method* method, u2* insns, OpCode newOpc) ClassObject* clazz = method->clazz; u2 fieldIdx = insns[1]; InstField* field; - int byteOffset; field = dvmOptResolveInstField(clazz, fieldIdx, NULL); if (field == NULL) { diff --git a/vm/analysis/ReduceConstants.c b/vm/analysis/ReduceConstants.c index ec7ba0f3a..308db8739 100644 --- a/vm/analysis/ReduceConstants.c +++ b/vm/analysis/ReduceConstants.c @@ -644,6 +644,7 @@ static void markUsedConstants(DexFile* pDexFile, const char* classDescriptor, * * Run through the instructions in this method, altering the constants used. */ +#if DVM_RESOLVER_CACHE == DVM_RC_EXPANDING static void updateUsedConstants(DexFile* pDexFile, const char* classDescriptor, DexMethod* pDexMethod, void* arg) { @@ -666,6 +667,7 @@ static void updateUsedConstants(DexFile* pDexFile, const char* classDescriptor, //printf(" (no code)\n"); } } +#endif /* * Count up the bits and show a count. @@ -682,9 +684,9 @@ static void showBitCount(const char* label, int setCount, int maxCount) static void summarizeResults(DvmDex* pDvmDex, ScanResults* pResults) { DexFile* pDexFile = pDvmDex->pDexFile; +#if 0 int i; -#if 0 for (i = 0; i < (int) pDvmDex->pDexFile->pHeader->typeIdsSize; i++) { const DexTypeId* pDexTypeId; const char* classDescr; @@ -890,6 +892,7 @@ static bool constructReducingDataChunk(IndexMapSet* pIndexMapSet) * Construct an "expanding" chunk, with maps that convert instructions * with reduced constants back to their full original values. */ +#if DVM_RESOLVER_CACHE == DVM_RC_EXPANDING static bool constructExpandingDataChunk(IndexMapSet* pIndexMapSet) { int chunkLen = 0; @@ -939,6 +942,7 @@ static bool constructExpandingDataChunk(IndexMapSet* pIndexMapSet) return true; } +#endif /* * Construct the "chunk" of data that will be appended to the optimized DEX @@ -963,7 +967,6 @@ static IndexMapSet* createIndexMapSet(const DexFile* pDexFile, ScanResults* pResults) { IndexMapSet* pIndexMapSet; - int setCount; bool okay = true; pIndexMapSet = calloc(1, sizeof(*pIndexMapSet)); diff --git a/vm/analysis/RegisterMap.c b/vm/analysis/RegisterMap.c index a42d93ab3..8ab37f0f7 100644 --- a/vm/analysis/RegisterMap.c +++ b/vm/analysis/RegisterMap.c @@ -35,19 +35,20 @@ /* verbose logging */ #define REGISTER_MAP_VERBOSE false +//#define REGISTER_MAP_STATS // fwd static void outputTypeVector(const RegType* regs, int insnRegCount, u1* data); static bool verifyMap(VerifierData* vdata, const RegisterMap* pMap); static int compareMaps(const RegisterMap* pMap1, const RegisterMap* pMap2); +#ifdef REGISTER_MAP_STATS static void computeMapStats(RegisterMap* pMap, const Method* method); +#endif static RegisterMap* compressMapDifferential(const RegisterMap* pMap,\ const Method* meth); static RegisterMap* uncompressMapDifferential(const RegisterMap* pMap); - -//#define REGISTER_MAP_STATS #ifdef REGISTER_MAP_STATS /* * Generate some statistics on the register maps we create and use. @@ -471,7 +472,6 @@ static bool verifyMap(VerifierData* vdata, const RegisterMap* pMap) if (false) { const char* cd = "Landroid/net/http/Request;"; const char* mn = "readResponse"; - const char* sg = "(Landroid/net/http/AndroidHttpClientConnection;)V"; if (strcmp(vdata->method->clazz->descriptor, cd) == 0 && strcmp(vdata->method->name, mn) == 0) { @@ -508,7 +508,6 @@ static bool verifyMap(VerifierData* vdata, const RegisterMap* pMap) dvmAbort(); } - const u1* dataStart = rawMap; const RegType* regs = vdata->addrRegs[addr]; if (regs == NULL) { LOGE("GLITCH: addr %d has no data\n", addr); @@ -1243,9 +1242,9 @@ Compact8 encoding method. /* * Compute some stats on an uncompressed register map. */ +#ifdef REGISTER_MAP_STATS static void computeMapStats(RegisterMap* pMap, const Method* method) { -#ifdef REGISTER_MAP_STATS MapStats* pStats = (MapStats*) gDvm.registerMapStats; const u1 format = dvmRegisterMapGetFormat(pMap); const u2 numEntries = dvmRegisterMapGetNumEntries(pMap); @@ -1361,9 +1360,8 @@ static void computeMapStats(RegisterMap* pMap, const Method* method) prevAddr = addr; prevData = dataStart; } -#endif } - +#endif /* * Compute the difference between two bit vectors. diff --git a/vm/analysis/VerifySubs.c b/vm/analysis/VerifySubs.c index 39d6dc848..16f128ec0 100644 --- a/vm/analysis/VerifySubs.c +++ b/vm/analysis/VerifySubs.c @@ -113,7 +113,6 @@ bail: bool dvmSetTryFlags(const Method* meth, InsnFlags* insnFlags) { u4 insnsSize = dvmGetMethodInsnsSize(meth); - DexFile* pDexFile = meth->clazz->pDvmDex->pDexFile; const DexCode* pCode = dvmGetMethodCode(meth); u4 triesSize = pCode->triesSize; const DexTry* pTries; @@ -311,7 +310,6 @@ bool dvmCheckBranchTarget(const Method* meth, InsnFlags* insnFlags, int curOffset, bool selfOkay) { const int insnCount = dvmGetMethodInsnsSize(meth); - const u2* insns = meth->insns + curOffset; int offset, absOffset; bool isConditional; @@ -411,7 +409,6 @@ bool dvmGetBranchTarget(const Method* meth, InsnFlags* insnFlags, int curOffset, int* pOffset, bool* pConditional) { const u2* insns = meth->insns + curOffset; - int tmp; switch (*insns & 0xff) { case OP_GOTO: diff --git a/vm/arch/arm/HintsEABI.c b/vm/arch/arm/HintsEABI.c index d84285998..3e27e5ad2 100644 --- a/vm/arch/arm/HintsEABI.c +++ b/vm/arch/arm/HintsEABI.c @@ -59,7 +59,7 @@ u4 dvmPlatformInvokeHints(const DexProto* proto) const char* sig = dexProtoGetShorty(proto); int padFlags, jniHints; char sigByte; - int stackOffset, padMask, hints; + int stackOffset, padMask; stackOffset = padFlags = 0; padMask = 0x00000001; diff --git a/vm/compiler/Compiler.c b/vm/compiler/Compiler.c index 2f72ef531..63f751245 100644 --- a/vm/compiler/Compiler.c +++ b/vm/compiler/Compiler.c @@ -41,6 +41,7 @@ static CompilerWorkOrder workDequeue(void) gDvmJit.compilerQueueLength--; if (gDvmJit.compilerQueueLength == 0) { int cc = pthread_cond_signal(&gDvmJit.compilerQueueEmpty); + assert(cc == 0); } /* Remember the high water mark of the queue length */ @@ -506,9 +507,6 @@ fail: static void *compilerThreadStart(void *arg) { - int ret; - struct timespec ts; - dvmChangeStatus(NULL, THREAD_VMWAIT); /* diff --git a/vm/compiler/Dataflow.c b/vm/compiler/Dataflow.c index 0f90c9ee9..fe04c6733 100644 --- a/vm/compiler/Dataflow.c +++ b/vm/compiler/Dataflow.c @@ -1168,8 +1168,6 @@ void dvmCompilerDoConstantPropagation(CompilationUnit *cUnit, BasicBlock *bb) int dfAttributes = dvmCompilerDataFlowAttributes[mir->dalvikInsn.opCode]; - int numUses = 0; - DecodedInstruction *dInsn = &mir->dalvikInsn; if (!(dfAttributes & DF_HAS_DEFS)) continue; diff --git a/vm/compiler/Frontend.c b/vm/compiler/Frontend.c index d97001ff5..db03b1b47 100644 --- a/vm/compiler/Frontend.c +++ b/vm/compiler/Frontend.c @@ -185,13 +185,13 @@ static inline bool isUnconditionalBranch(MIR *insn) /* * dvmHashTableLookup() callback */ +#if defined(WITH_JIT_TUNING) static int compareMethod(const CompilerMethodStats *m1, const CompilerMethodStats *m2) { return (int) m1->method - (int) m2->method; } -#if defined(WITH_JIT_TUNING) /* * Analyze each method whose traces are ever compiled. Collect a variety of * statistics like the ratio of exercised vs overall code and code bloat diff --git a/vm/compiler/Loop.c b/vm/compiler/Loop.c index ef76c508f..0ceaa9f55 100644 --- a/vm/compiler/Loop.c +++ b/vm/compiler/Loop.c @@ -263,11 +263,9 @@ static void updateRangeCheckInfo(CompilationUnit *cUnit, int arrayReg, /* Returns true if the loop body cannot throw any exceptions */ static bool doLoopBodyCodeMotion(CompilationUnit *cUnit) { - BasicBlock *entry = cUnit->blockList[0]; BasicBlock *loopBody = cUnit->blockList[1]; MIR *mir; bool loopBodyCanThrow = false; - int numDalvikRegs = cUnit->method->registersSize; for (mir = loopBody->firstMIRInsn; mir; mir = mir->next) { DecodedInstruction *dInsn = &mir->dalvikInsn; @@ -321,7 +319,6 @@ static bool doLoopBodyCodeMotion(CompilationUnit *cUnit) int useIdx = refIdx + 1; int subNRegArray = dvmConvertSSARegToDalvik(cUnit, mir->ssaRep->uses[refIdx]); - int arrayReg = DECODE_REG(subNRegArray); int arraySub = DECODE_SUB(subNRegArray); /* @@ -352,7 +349,6 @@ static bool doLoopBodyCodeMotion(CompilationUnit *cUnit) static void dumpHoistedChecks(CompilationUnit *cUnit) { - ArrayAccessInfo *arrayAccessInfo; LoopAnalysis *loopAnalysis = cUnit->loopAnalysis; unsigned int i; @@ -379,7 +375,6 @@ static void genHoistedChecks(CompilationUnit *cUnit) unsigned int i; BasicBlock *entry = cUnit->blockList[0]; LoopAnalysis *loopAnalysis = cUnit->loopAnalysis; - ArrayAccessInfo *arrayAccessInfo; int globalMaxC = 0; int globalMinC = 0; /* Should be loop invariant */ @@ -461,7 +456,6 @@ static void genHoistedChecks(CompilationUnit *cUnit) /* Main entry point to do loop optimization */ void dvmCompilerLoopOpt(CompilationUnit *cUnit) { - int numDalvikReg = cUnit->method->registersSize; LoopAnalysis *loopAnalysis = dvmCompilerNew(sizeof(LoopAnalysis), true); assert(cUnit->blockList[0]->blockType == kEntryBlock); diff --git a/vm/compiler/Ralloc.c b/vm/compiler/Ralloc.c index 1a3e27e59..608b4b337 100644 --- a/vm/compiler/Ralloc.c +++ b/vm/compiler/Ralloc.c @@ -124,7 +124,6 @@ void dvmCompilerRegAlloc(CompilationUnit *cUnit) int seqNum = 0; LiveRange *ranges; RegLocation *loc; - int *ssaToDalvikMap = (int *) cUnit->ssaToDalvikMap->elemList; /* Allocate the location map */ loc = (RegLocation*)dvmCompilerNew(cUnit->numSSARegs * sizeof(*loc), true); diff --git a/vm/compiler/Utility.c b/vm/compiler/Utility.c index cb5a70299..1aff02bec 100644 --- a/vm/compiler/Utility.c +++ b/vm/compiler/Utility.c @@ -159,7 +159,6 @@ static int dumpMethodStats(void *compilerMethodStats, void *totalMethodStats) (CompilerMethodStats *) compilerMethodStats; CompilerMethodStats *totalStats = (CompilerMethodStats *) totalMethodStats; - const Method *method = methodStats->method; totalStats->dalvikSize += methodStats->dalvikSize; totalStats->compiledDalvikSize += methodStats->compiledDalvikSize; @@ -172,7 +171,8 @@ static int dumpMethodStats(void *compilerMethodStats, void *totalMethodStats) /* If over 3/4 of the Dalvik code is compiled, print something */ if (methodStats->compiledDalvikSize >= limit) { LOGD("Method stats: %s%s, %d/%d (compiled/total Dalvik), %d (native)", - method->clazz->descriptor, method->name, + methodStats->method->clazz->descriptor, + methodStats->method->name, methodStats->compiledDalvikSize, methodStats->dalvikSize, methodStats->nativeSize); diff --git a/vm/compiler/codegen/arm/ArchUtility.c b/vm/compiler/codegen/arm/ArchUtility.c index b0478f49c..31e7c0b23 100644 --- a/vm/compiler/codegen/arm/ArchUtility.c +++ b/vm/compiler/codegen/arm/ArchUtility.c @@ -239,7 +239,6 @@ void dvmDumpLIRInsn(LIR *arg, unsigned char *baseAddr) char opName[256]; int offset = lir->generic.offset; int dest = lir->operands[0]; - u2 *cPtr = (u2*)baseAddr; const bool dumpNop = false; /* Handle pseudo-ops individually, and all regular insns as a group */ diff --git a/vm/compiler/codegen/arm/Assemble.c b/vm/compiler/codegen/arm/Assemble.c index 05d311b33..3c00ecec5 100644 --- a/vm/compiler/codegen/arm/Assemble.c +++ b/vm/compiler/codegen/arm/Assemble.c @@ -1420,6 +1420,7 @@ void* dvmJitChain(void* tgtAddr, u4* branchAddr) * Attempt to enqueue a work order to patch an inline cache for a predicted * chaining cell for virtual/interface calls. */ +#if !defined(WITH_SELF_VERIFICATION) static bool inlineCachePatchEnqueue(PredictedChainingCell *cellAddr, PredictedChainingCell *newContent) { @@ -1474,6 +1475,7 @@ static bool inlineCachePatchEnqueue(PredictedChainingCell *cellAddr, dvmUnlockMutex(&gDvmJit.compilerICPatchLock); return result; } +#endif /* * This method is called from the invoke templates for virtual and interface @@ -1641,8 +1643,6 @@ u4* dvmJitUnchain(void* codeAddr) int cellSize; u4* pChainCells; u4* pStart; - u4 thumb1; - u4 thumb2; u4 newInst; int i,j; PredictedChainingCell *predChainCell; @@ -2246,7 +2246,6 @@ void dvmSelfVerificationMemOpDecode(int lr, int* sp) //LOGD("*** THUMB2 - Addr: 0x%x Insn: 0x%x", lr, insn); int opcode12 = (insn >> 20) & 0xFFF; - int opcode6 = (insn >> 6) & 0x3F; int opcode4 = (insn >> 8) & 0xF; int imm2 = (insn >> 4) & 0x3; int imm8 = insn & 0xFF; diff --git a/vm/compiler/codegen/arm/CodegenDriver.c b/vm/compiler/codegen/arm/CodegenDriver.c index 515e8afa9..711431e7b 100644 --- a/vm/compiler/codegen/arm/CodegenDriver.c +++ b/vm/compiler/codegen/arm/CodegenDriver.c @@ -197,7 +197,6 @@ static void selfVerificationBranchInsert(LIR *currentLIR, ArmOpCode opCode, static void selfVerificationBranchInsertPass(CompilationUnit *cUnit) { ArmLIR *thisLIR; - ArmLIR *branchLIR = dvmCompilerNew(sizeof(ArmLIR), true); TemplateOpCode opCode = TEMPLATE_MEM_OP_DECODE; for (thisLIR = (ArmLIR *) cUnit->firstLIRInsn; @@ -237,7 +236,6 @@ static inline ArmLIR *genTrap(CompilationUnit *cUnit, int dOffset, /* Load a wide field from an object instance */ static void genIGetWide(CompilationUnit *cUnit, MIR *mir, int fieldOffset) { - DecodedInstruction *dInsn = &mir->dalvikInsn; RegLocation rlObj = dvmCompilerGetSrc(cUnit, mir, 0); RegLocation rlDest = dvmCompilerGetDestWide(cUnit, mir, 0, 1); RegLocation rlResult; @@ -262,7 +260,6 @@ static void genIGetWide(CompilationUnit *cUnit, MIR *mir, int fieldOffset) /* Store a wide field to an object instance */ static void genIPutWide(CompilationUnit *cUnit, MIR *mir, int fieldOffset) { - DecodedInstruction *dInsn = &mir->dalvikInsn; RegLocation rlSrc = dvmCompilerGetSrcWide(cUnit, mir, 0, 1); RegLocation rlObj = dvmCompilerGetSrc(cUnit, mir, 2); rlObj = loadValue(cUnit, rlObj, kCoreReg); @@ -287,9 +284,7 @@ static void genIPutWide(CompilationUnit *cUnit, MIR *mir, int fieldOffset) static void genIGet(CompilationUnit *cUnit, MIR *mir, OpSize size, int fieldOffset) { - int regPtr; RegLocation rlResult; - DecodedInstruction *dInsn = &mir->dalvikInsn; RegLocation rlObj = dvmCompilerGetSrc(cUnit, mir, 0); RegLocation rlDest = dvmCompilerGetDest(cUnit, mir, 0); rlObj = loadValue(cUnit, rlObj, kCoreReg); @@ -312,12 +307,10 @@ static void genIGet(CompilationUnit *cUnit, MIR *mir, OpSize size, static void genIPut(CompilationUnit *cUnit, MIR *mir, OpSize size, int fieldOffset) { - DecodedInstruction *dInsn = &mir->dalvikInsn; RegLocation rlSrc = dvmCompilerGetSrc(cUnit, mir, 0); RegLocation rlObj = dvmCompilerGetSrc(cUnit, mir, 1); rlObj = loadValue(cUnit, rlObj, kCoreReg); rlSrc = loadValue(cUnit, rlSrc, kAnyReg); - int regPtr; genNullCheck(cUnit, rlObj.sRegLow, rlObj.lowReg, mir->offset, NULL);/* null object? */ @@ -1185,6 +1178,7 @@ static void genInvokeVirtualCommon(CompilationUnit *cUnit, MIR *mir, * The return LIR is a branch based on the comparison result. The actual branch * target will be setup in the caller. */ +#if 0 static ArmLIR *genCheckPredictedChain(CompilationUnit *cUnit, ArmLIR *predChainingCell, ArmLIR *retChainingCell, @@ -1235,6 +1229,7 @@ static ArmLIR *genCheckPredictedChain(CompilationUnit *cUnit, return opCondBranch(cUnit, kArmCondEq); } +#endif /* Geneate a branch to go back to the interpreter */ static void genPuntToInterp(CompilationUnit *cUnit, unsigned int offset) @@ -2183,8 +2178,7 @@ static bool handleFmt22c(CompilationUnit *cUnit, MIR *mir) * "len < 0": bail to the interpreter to re-execute the * instruction */ - ArmLIR *pcrLabel = - genRegImmCheck(cUnit, kArmCondMi, r1, 0, mir->offset, NULL); + genRegImmCheck(cUnit, kArmCondMi, r1, 0, mir->offset, NULL); loadConstant(cUnit, r2, ALLOC_DONT_TRACK); opReg(cUnit, kOpBlx, r3); dvmCompilerClobberCallRegs(cUnit); @@ -2653,10 +2647,6 @@ static bool handleFmt31t(CompilationUnit *cUnit, MIR *mir) dvmCompilerFlushAllRegs(cUnit); /* Everything to home location */ loadValueDirectFixed(cUnit, rlSrc, r1); dvmCompilerLockAllTemps(cUnit); - const u2 *switchData = - cUnit->method->insns + mir->offset + mir->dalvikInsn.vB; - u2 size = switchData[1]; - if (dalvikOpCode == OP_PACKED_SWITCH) { LOAD_FUNC_ADDR(cUnit, r4PC, (int)findPackedSwitchIndex); } else { @@ -2848,7 +2838,6 @@ static bool handleFmt35c_3rc(CompilationUnit *cUnit, MIR *mir, BasicBlock *bb, case OP_INVOKE_INTERFACE: case OP_INVOKE_INTERFACE_RANGE: { ArmLIR *predChainingCell = &labelList[bb->taken->id]; - int methodIndex = dInsn->vB; /* Ensure that nothing is both live and dirty */ dvmCompilerFlushAllRegs(cUnit); @@ -3219,8 +3208,6 @@ static bool handleExecuteInline(CompilationUnit *cUnit, MIR *mir) const InlineOperation* inLineTable = dvmGetInlineOpsTable(); int offset = offsetof(InterpState, retval); int operation = dInsn->vB; - int tReg1; - int tReg2; switch (operation) { case INLINE_EMPTYINLINEMETHOD: return false; /* Nop */ @@ -3473,7 +3460,6 @@ static void genHoistedChecksForCountUpLoop(CompilationUnit *cUnit, MIR *mir) DecodedInstruction *dInsn = &mir->dalvikInsn; const int lenOffset = offsetof(ArrayObject, length); const int maxC = dInsn->arg[0]; - const int minC = dInsn->arg[1]; int regLength; RegLocation rlArray = cUnit->regLocation[mir->dalvikInsn.vA]; RegLocation rlIdxEnd = cUnit->regLocation[mir->dalvikInsn.vC]; @@ -3522,7 +3508,6 @@ static void genHoistedChecksForCountDownLoop(CompilationUnit *cUnit, MIR *mir) const int lenOffset = offsetof(ArrayObject, length); const int regLength = dvmCompilerAllocTemp(cUnit); const int maxC = dInsn->arg[0]; - const int minC = dInsn->arg[1]; RegLocation rlArray = cUnit->regLocation[mir->dalvikInsn.vA]; RegLocation rlIdxInit = cUnit->regLocation[mir->dalvikInsn.vB]; diff --git a/vm/compiler/codegen/arm/CodegenFactory.c b/vm/compiler/codegen/arm/CodegenFactory.c index 824e1a05d..157bd1f4b 100644 --- a/vm/compiler/codegen/arm/CodegenFactory.c +++ b/vm/compiler/codegen/arm/CodegenFactory.c @@ -112,7 +112,6 @@ static void loadValueDirectWideFixed(CompilationUnit *cUnit, RegLocation rlSrc, static RegLocation loadValue(CompilationUnit *cUnit, RegLocation rlSrc, RegisterClass opKind) { - RegisterInfo *pReg; rlSrc = dvmCompilerEvalLoc(cUnit, rlSrc, opKind, false); if (rlSrc.location == kLocDalvikFrame) { loadValueDirect(cUnit, rlSrc, rlSrc.lowReg); @@ -129,7 +128,6 @@ static RegLocation loadValue(CompilationUnit *cUnit, RegLocation rlSrc, static void storeValue(CompilationUnit *cUnit, RegLocation rlDest, RegLocation rlSrc) { - RegisterInfo *pRegLo; LIR *defStart; LIR *defEnd; assert(!rlDest.wide); @@ -179,8 +177,6 @@ static void storeValue(CompilationUnit *cUnit, RegLocation rlDest, static RegLocation loadValueWide(CompilationUnit *cUnit, RegLocation rlSrc, RegisterClass opKind) { - RegisterInfo *pRegLo; - RegisterInfo *pRegHi; assert(rlSrc.wide); rlSrc = dvmCompilerEvalLoc(cUnit, rlSrc, opKind, false); if (rlSrc.location == kLocDalvikFrame) { @@ -202,11 +198,8 @@ static RegLocation loadValueWide(CompilationUnit *cUnit, RegLocation rlSrc, static void storeValueWide(CompilationUnit *cUnit, RegLocation rlDest, RegLocation rlSrc) { - RegisterInfo *pRegLo; - RegisterInfo *pRegHi; LIR *defStart; LIR *defEnd; - bool srcFP = FPREG(rlSrc.lowReg) && FPREG(rlSrc.highReg); assert(FPREG(rlSrc.lowReg)==FPREG(rlSrc.highReg)); assert(rlDest.wide); assert(rlSrc.wide); diff --git a/vm/compiler/codegen/arm/FP/Thumb2VFP.c b/vm/compiler/codegen/arm/FP/Thumb2VFP.c index 9149646b8..b5bcf994e 100644 --- a/vm/compiler/codegen/arm/FP/Thumb2VFP.c +++ b/vm/compiler/codegen/arm/FP/Thumb2VFP.c @@ -183,7 +183,6 @@ static bool genConversion(CompilationUnit *cUnit, MIR *mir) static bool genInlineSqrt(CompilationUnit *cUnit, MIR *mir) { ArmLIR *branch; - DecodedInstruction *dInsn = &mir->dalvikInsn; RegLocation rlSrc = dvmCompilerGetSrcWide(cUnit, mir, 0, 1); RegLocation rlDest = inlinedTargetWide(cUnit, mir, true); rlSrc = loadValueWide(cUnit, rlSrc, kFPReg); @@ -212,7 +211,6 @@ static bool genCmpFP(CompilationUnit *cUnit, MIR *mir, RegLocation rlDest, { bool isDouble; int defaultResult; - bool ltNaNBias; RegLocation rlResult; switch(mir->dalvikInsn.opCode) { diff --git a/vm/compiler/codegen/arm/LocalOptimizations.c b/vm/compiler/codegen/arm/LocalOptimizations.c index 85dfa8ef1..729486cdc 100644 --- a/vm/compiler/codegen/arm/LocalOptimizations.c +++ b/vm/compiler/codegen/arm/LocalOptimizations.c @@ -78,8 +78,6 @@ static void applyLoadStoreElimination(CompilationUnit *cUnit, continue; } if (isDalvikStore(thisLIR)) { - int dRegId = DECODE_ALIAS_INFO_REG(thisLIR->aliasInfo); - int dRegIdHi = dRegId + DECODE_ALIAS_INFO_WIDE(thisLIR->aliasInfo); int nativeRegId = thisLIR->operands[0]; ArmLIR *checkLIR; int sinkDistance = 0; @@ -208,7 +206,6 @@ static void applyLoadHoisting(CompilationUnit *cUnit, if (isDalvikLoad(thisLIR)) { int dRegId = DECODE_ALIAS_INFO_REG(thisLIR->aliasInfo); - int dRegIdHi = dRegId + DECODE_ALIAS_INFO_WIDE(thisLIR->aliasInfo); int nativeRegId = thisLIR->operands[0]; ArmLIR *checkLIR; int hoistDistance = 0; diff --git a/vm/compiler/codegen/arm/RallocUtil.c b/vm/compiler/codegen/arm/RallocUtil.c index e357ba672..80ce96820 100644 --- a/vm/compiler/codegen/arm/RallocUtil.c +++ b/vm/compiler/codegen/arm/RallocUtil.c @@ -463,14 +463,6 @@ extern void dvmCompilerLockTemp(CompilationUnit *cUnit, int reg) dvmCompilerAbort(cUnit); } -static void lockArgRegs(CompilationUnit *cUnit) -{ - dvmCompilerLockTemp(cUnit, r0); - dvmCompilerLockTemp(cUnit, r1); - dvmCompilerLockTemp(cUnit, r2); - dvmCompilerLockTemp(cUnit, r3); -} - /* Clobber all regs that might be used by an external C call */ extern void dvmCompilerClobberCallRegs(CompilationUnit *cUnit) { @@ -698,12 +690,6 @@ extern void dvmCompilerMarkPair(CompilationUnit *cUnit, int lowReg, int highReg) infoHi->partner = lowReg; } -static void markRegSingle(CompilationUnit *cUnit, int reg) -{ - RegisterInfo *info = getRegInfo(cUnit, reg); - info->pair = false; -} - extern void dvmCompilerMarkClean(CompilationUnit *cUnit, int reg) { RegisterInfo *info = getRegInfo(cUnit, reg); @@ -722,13 +708,6 @@ extern void dvmCompilerMarkInUse(CompilationUnit *cUnit, int reg) info->inUse = true; } -/* Return true if live & dirty */ -static bool isDirty(CompilationUnit *cUnit, int reg) -{ - RegisterInfo *info = getRegInfo(cUnit, reg); - return (info && info->live && info->dirty); -} - void copyRegInfo(CompilationUnit *cUnit, int newReg, int oldReg) { RegisterInfo *newInfo = getRegInfo(cUnit, newReg); @@ -870,7 +849,6 @@ static RegLocation evalLocWide(CompilationUnit *cUnit, RegLocation loc, extern RegLocation dvmCompilerEvalLoc(CompilationUnit *cUnit, RegLocation loc, int regClass, bool update) { - RegisterInfo *infoLo = NULL; int newReg; if (loc.wide) return evalLocWide(cUnit, loc, regClass, update); diff --git a/vm/compiler/codegen/arm/Thumb2/Factory.c b/vm/compiler/codegen/arm/Thumb2/Factory.c index 0141a0fec..c7b52fd0d 100644 --- a/vm/compiler/codegen/arm/Thumb2/Factory.c +++ b/vm/compiler/codegen/arm/Thumb2/Factory.c @@ -23,10 +23,8 @@ */ static int coreTemps[] = {r0, r1, r2, r3, r4PC, r7, r8, r9, r10, r11, r12}; -static int corePreserved[] = {}; static int fpTemps[] = {fr16, fr17, fr18, fr19, fr20, fr21, fr22, fr23, fr24, fr25, fr26, fr27, fr28, fr29, fr30, fr31}; -static int fpPreserved[] = {}; static int encodeImmSingle(int value) { @@ -579,7 +577,6 @@ static ArmLIR *opRegRegImm(CompilationUnit *cUnit, OpKind op, int rDest, static ArmLIR *opRegImm(CompilationUnit *cUnit, OpKind op, int rDestSrc1, int value) { - ArmLIR *res; bool neg = (value < 0); int absValue = (neg) ? -value : value; bool shortForm = (((absValue & 0xff) == absValue) && LOWREG(rDestSrc1)); @@ -813,7 +810,6 @@ static ArmLIR *loadBaseDispBody(CompilationUnit *cUnit, MIR *mir, int rBase, ArmOpCode opCode = kThumbBkpt; bool shortForm = false; bool thumb2Form = (displacement < 4092 && displacement >= 0); - int shortMax = 128; bool allLowRegs = (LOWREG(rBase) && LOWREG(rDest)); int encodedDisp = displacement; @@ -948,7 +944,6 @@ static ArmLIR *storeBaseDispBody(CompilationUnit *cUnit, int rBase, ArmOpCode opCode = kThumbBkpt; bool shortForm = false; bool thumb2Form = (displacement < 4092 && displacement >= 0); - int shortMax = 128; bool allLowRegs = (LOWREG(rBase) && LOWREG(rSrc)); int encodedDisp = displacement; diff --git a/vm/compiler/codegen/arm/Thumb2/Gen.c b/vm/compiler/codegen/arm/Thumb2/Gen.c index 1782becaa..de75be719 100644 --- a/vm/compiler/codegen/arm/Thumb2/Gen.c +++ b/vm/compiler/codegen/arm/Thumb2/Gen.c @@ -87,7 +87,6 @@ static void genLong3Addr(CompilationUnit *cUnit, MIR *mir, OpKind firstOp, void dvmCompilerInitializeRegAlloc(CompilationUnit *cUnit) { - int i; int numTemps = sizeof(coreTemps)/sizeof(int); int numFPTemps = sizeof(fpTemps)/sizeof(int); RegisterPool *pool = dvmCompilerNew(sizeof(*pool), true); @@ -193,7 +192,6 @@ static ArmLIR *genExportPC(CompilationUnit *cUnit, MIR *mir) static void genMonitorEnter(CompilationUnit *cUnit, MIR *mir) { RegLocation rlSrc = dvmCompilerGetSrc(cUnit, mir, 0); - bool enter = (mir->dalvikInsn.opCode == OP_MONITOR_ENTER); ArmLIR *target; ArmLIR *hopTarget; ArmLIR *branch; diff --git a/vm/interp/Interp.c b/vm/interp/Interp.c index 535c1176e..cde4a40c4 100644 --- a/vm/interp/Interp.c +++ b/vm/interp/Interp.c @@ -366,10 +366,9 @@ static void dvmBreakpointSetFlush(BreakpointSet* pSet, ClassObject* clazz) LOGV("Flushing breakpoint at %p for %s\n", pBreak->addr, clazz->descriptor); if (instructionIsMagicNop(pBreak->addr)) { - const Method* method = pBreak->method; LOGV("Refusing to flush breakpoint on %04x at %s.%s + 0x%x\n", - *pBreak->addr, method->clazz->descriptor, - method->name, pBreak->addr - method->insns); + *pBreak->addr, pBreak->method->clazz->descriptor, + pBreak->method->name, pBreak->addr - pBreak->method->insns); } else { dvmDexChangeDex1(clazz->pDvmDex, (u1*)pBreak->addr, OP_BREAKPOINT); @@ -815,7 +814,7 @@ s4 dvmInterpHandlePackedSwitch(const u2* switchData, s4 testVal) s4 dvmInterpHandleSparseSwitch(const u2* switchData, s4 testVal) { const int kInstrLen = 3; - u2 ident, size; + u2 size; const s4* keys; const s4* entries; diff --git a/vm/interp/Jit.c b/vm/interp/Jit.c index 3d0d96cd1..58d28cd1b 100644 --- a/vm/interp/Jit.c +++ b/vm/interp/Jit.c @@ -621,7 +621,7 @@ static JitEntry *lookupAndAdd(const u2* dPC, bool callerLocked) */ int dvmCheckJit(const u2* pc, Thread* self, InterpState* interpState) { - int flags,i,len; + int flags, len; int switchInterp = false; bool debugOrProfile = dvmDebuggerOrProfilerActive(); @@ -630,8 +630,6 @@ int dvmCheckJit(const u2* pc, Thread* self, InterpState* interpState) interpState->lastPC = pc; switch (interpState->jitState) { - char* nopStr; - int target; int offset; DecodedInstruction decInsn; case kJitTSelect: diff --git a/vm/interp/Stack.c b/vm/interp/Stack.c index 1ebbcf051..11a9a3213 100644 --- a/vm/interp/Stack.c +++ b/vm/interp/Stack.c @@ -429,8 +429,6 @@ static ClassObject* callPrep(Thread* self, const Method* method, Object* obj, void dvmCallMethod(Thread* self, const Method* method, Object* obj, JValue* pResult, ...) { - JValue result; - va_list args; va_start(args, pResult); dvmCallMethodV(self, method, obj, false, pResult, args); @@ -535,7 +533,9 @@ void dvmCallMethodV(Thread* self, const Method* method, Object* obj, dvmInterpret(self, method, pResult); } +#ifndef NDEBUG bail: +#endif dvmPopFrame(self); } @@ -867,9 +867,9 @@ int dvmComputeExactFrameDepth(const void* fp) int dvmComputeVagueFrameDepth(Thread* thread, const void* fp) { const u1* interpStackStart = thread->interpStackStart; - const u1* interpStackBottom = interpStackStart - thread->interpStackSize; - assert((u1*) fp >= interpStackBottom && (u1*) fp < interpStackStart); + assert((u1*) fp >= interpStackStart - thread->interpStackSize); + assert((u1*) fp < interpStackStart); return interpStackStart - (u1*) fp; } diff --git a/vm/jdwp/JdwpEvent.c b/vm/jdwp/JdwpEvent.c index 996d7ad5a..903759907 100644 --- a/vm/jdwp/JdwpEvent.c +++ b/vm/jdwp/JdwpEvent.c @@ -206,7 +206,6 @@ JdwpError dvmJdwpRegisterEvent(JdwpState* state, JdwpEvent* pEvent) state->eventList = pEvent; state->numEvents++; -bail: unlockEventMutex(state); return err; @@ -425,8 +424,6 @@ static bool patternMatch(const char* pattern, const char* target) return false; return strcmp(pattern+1, target + (targetLen-patLen)) == 0; } else if (pattern[patLen-1] == '*') { - int i; - return strncmp(pattern, target, patLen-1) == 0; } else { return strcmp(pattern, target) == 0; diff --git a/vm/jdwp/JdwpHandler.c b/vm/jdwp/JdwpHandler.c index 53b5d260a..06d76edcf 100644 --- a/vm/jdwp/JdwpHandler.c +++ b/vm/jdwp/JdwpHandler.c @@ -240,7 +240,6 @@ static JdwpError handleVM_ClassesBySignature(JdwpState* state, u4 numClasses; size_t strLen; RefTypeId refTypeId; - int i; classDescriptor = readNewUtf8String(&buf, &strLen); LOGV(" Req for class by signature '%s'\n", classDescriptor); @@ -430,8 +429,6 @@ static JdwpError handleVM_CreateString(JdwpState* state, static JdwpError handleVM_Capabilities(JdwpState* state, const u1* buf, int dataLen, ExpandBuf* pReply) { - int i; - expandBufAdd1(pReply, false); /* canWatchFieldModification */ expandBufAdd1(pReply, false); /* canWatchFieldAccess */ expandBufAdd1(pReply, false); /* canGetBytecodes */ @@ -745,7 +742,6 @@ static JdwpError handleRT_ClassLoader(JdwpState* state, const u1* buf, int dataLen, ExpandBuf* pReply) { RefTypeId refTypeId; - ObjectId classLoaderId; refTypeId = dvmReadRefTypeId(&buf); @@ -762,7 +758,6 @@ static JdwpError handleRT_FieldsWithGeneric(JdwpState* state, const u1* buf, int dataLen, ExpandBuf* pReply) { RefTypeId refTypeId; - int i, numFields; refTypeId = dvmReadRefTypeId(&buf); LOGV(" Req for fields in refTypeId=0x%llx\n", refTypeId); @@ -785,7 +780,6 @@ static JdwpError handleRT_MethodsWithGeneric(JdwpState* state, const u1* buf, int dataLen, ExpandBuf* pReply) { RefTypeId refTypeId; - int i; refTypeId = dvmReadRefTypeId(&buf); @@ -887,7 +881,6 @@ static JdwpError handleCT_NewInstance(JdwpState* state, ObjectId threadId; MethodId methodId; ObjectId objectId; - u4 numArgs; classId = dvmReadRefTypeId(&buf); threadId = dvmReadObjectId(&buf); @@ -997,7 +990,6 @@ static JdwpError handleOR_GetValues(JdwpState* state, u1 fieldTag; int width; u1* ptr; - const char* fieldName; fieldId = dvmReadFieldId(&buf); @@ -1420,7 +1412,6 @@ static JdwpError handleTGR_Children(JdwpState* state, { ObjectId threadGroupId; u4 threadCount; - ObjectId threadId; ObjectId* pThreadIds; ObjectId* walker; int i; @@ -1510,8 +1501,6 @@ static JdwpError handleAR_SetValues(JdwpState* state, ObjectId arrayId; u4 firstIndex; u4 values; - u1 tag; - int i; arrayId = dvmReadObjectId(&buf); firstIndex = read4BE(&buf); diff --git a/vm/jdwp/JdwpMain.c b/vm/jdwp/JdwpMain.c index ef2461835..015f1c678 100644 --- a/vm/jdwp/JdwpMain.c +++ b/vm/jdwp/JdwpMain.c @@ -40,8 +40,6 @@ static void* jdwpThreadStart(void* arg); JdwpState* dvmJdwpStartup(const JdwpStartupParams* pParams) { JdwpState* state = NULL; - int i, sleepIter; - u8 startWhen; /* comment this out when debugging JDWP itself */ android_setMinPriority(LOG_TAG, ANDROID_LOG_DEBUG); @@ -253,7 +251,6 @@ static void* jdwpThreadStart(void* arg) */ while (state->run) { bool first; - int cc; if (state->params.server) { /* diff --git a/vm/jdwp/JdwpSocket.c b/vm/jdwp/JdwpSocket.c index 42cd1897e..f5eebca74 100644 --- a/vm/jdwp/JdwpSocket.c +++ b/vm/jdwp/JdwpSocket.c @@ -270,6 +270,7 @@ static bool isConnected(JdwpState* state) /* * Returns "true" if the fd is ready, "false" if not. */ +#if 0 static bool isFdReadable(int sock) { fd_set readfds; @@ -291,6 +292,7 @@ static bool isFdReadable(int sock) LOGE("WEIRD: odd behavior in select (count=%d)\n", count); return false; } +#endif #if 0 /* @@ -390,8 +392,7 @@ static bool establishConnection(JdwpState* state) struct sockaddr addrPlain; } addr; struct hostent* pEntry; - char auxBuf[128]; - int cc, h_errno; + int h_errno; assert(state != NULL && state->netState != NULL); assert(!state->params.server); @@ -405,7 +406,8 @@ static bool establishConnection(JdwpState* state) //#warning "forcing non-R" #ifdef HAVE_GETHOSTBYNAME_R struct hostent he; - cc = gethostbyname_r(state->params.host, &he, auxBuf, sizeof(auxBuf), + char auxBuf[128]; + int cc = gethostbyname_r(state->params.host, &he, auxBuf, sizeof(auxBuf), &pEntry, &h_errno); if (cc != 0) { LOGW("gethostbyname_r('%s') failed: %s\n", @@ -536,6 +538,7 @@ static void consumeBytes(JdwpNetState* netState, int count) /* * Dump the contents of a packet to stdout. */ +#if 0 static void dumpPacket(const unsigned char* packetBuf) { const unsigned char* buf = packetBuf; @@ -567,6 +570,7 @@ static void dumpPacket(const unsigned char* packetBuf) if (dataLen > 0) dvmPrintHexDumpDbg(buf, dataLen, LOG_TAG); } +#endif /* * Handle a packet. Returns "false" if we encounter a connection-fatal error. diff --git a/vm/mterp/out/InterpC-portdbg.c b/vm/mterp/out/InterpC-portdbg.c index 46e3e19b3..bcc6b9951 100644 --- a/vm/mterp/out/InterpC-portdbg.c +++ b/vm/mterp/out/InterpC-portdbg.c @@ -1251,7 +1251,7 @@ static void updateDebugger(const Method* method, const u2* pc, const u4* fp, */ const StepControl* pCtrl = &gDvm.stepControl; if (pCtrl->active && pCtrl->thread == self) { - int line, frameDepth; + int frameDepth; bool doStop = false; const char* msg = NULL; diff --git a/vm/mterp/portable/debug.c b/vm/mterp/portable/debug.c index 6716aba45..7ac4a025f 100644 --- a/vm/mterp/portable/debug.c +++ b/vm/mterp/portable/debug.c @@ -60,7 +60,7 @@ static void updateDebugger(const Method* method, const u2* pc, const u4* fp, */ const StepControl* pCtrl = &gDvm.stepControl; if (pCtrl->active && pCtrl->thread == self) { - int line, frameDepth; + int frameDepth; bool doStop = false; const char* msg = NULL; diff --git a/vm/native/dalvik_system_DexFile.c b/vm/native/dalvik_system_DexFile.c index 95e01aa3b..fc95d302c 100644 --- a/vm/native/dalvik_system_DexFile.c +++ b/vm/native/dalvik_system_DexFile.c @@ -111,7 +111,6 @@ static void Dalvik_dalvik_system_DexFile_openDexFile(const u4* args, { StringObject* sourceNameObj = (StringObject*) args[0]; StringObject* outputNameObj = (StringObject*) args[1]; - int flags = args[2]; DexOrJar* pDexOrJar = NULL; JarFile* pJarFile; RawDexFile* pRawDexFile; diff --git a/vm/native/dalvik_system_Zygote.c b/vm/native/dalvik_system_Zygote.c index f8e825096..0aa811de7 100644 --- a/vm/native/dalvik_system_Zygote.c +++ b/vm/native/dalvik_system_Zygote.c @@ -225,7 +225,6 @@ static int setrlimitsFromArray(ArrayObject* rlimits) static void Dalvik_dalvik_system_Zygote_fork(const u4* args, JValue* pResult) { pid_t pid; - int err; if (!gDvm.zygote) { dvmThrowException("Ljava/lang/IllegalStateException;", diff --git a/vm/native/java_lang_VMClassLoader.c b/vm/native/java_lang_VMClassLoader.c index 2d4e4b3a4..adec8d163 100644 --- a/vm/native/java_lang_VMClassLoader.c +++ b/vm/native/java_lang_VMClassLoader.c @@ -85,7 +85,6 @@ static void Dalvik_java_lang_VMClassLoader_findLoadedClass(const u4* args, ClassObject* clazz = NULL; char* name = NULL; char* descriptor = NULL; - char* cp; if (nameObj == NULL) { dvmThrowException("Ljava/lang/NullPointerException;", NULL); diff --git a/vm/native/java_lang_VMThread.c b/vm/native/java_lang_VMThread.c index 459fd35e4..b23b53c98 100644 --- a/vm/native/java_lang_VMThread.c +++ b/vm/native/java_lang_VMThread.c @@ -213,7 +213,6 @@ static void Dalvik_java_lang_VMThread_setPriority(const u4* args, */ static void Dalvik_java_lang_VMThread_sleep(const u4* args, JValue* pResult) { - Thread* self = dvmThreadSelf(); dvmThreadSleep(GET_ARG_LONG(args,0), args[2]); RETURN_VOID(); } diff --git a/vm/oo/Class.c b/vm/oo/Class.c index 05eccdc62..a34b9834e 100644 --- a/vm/oo/Class.c +++ b/vm/oo/Class.c @@ -2187,9 +2187,7 @@ void dvmMakeCodeReadOnly(Method* meth) static int computeJniArgInfo(const DexProto* proto) { const char* sig = dexProtoGetShorty(proto); - int returnType, padFlags, jniArgInfo; - char sigByte; - int stackOffset, padMask; + int returnType, jniArgInfo; u4 hints; /* The first shorty character is the return type. */ diff --git a/vm/reflect/Annotation.c b/vm/reflect/Annotation.c index fb4b83f35..c2f5131b6 100644 --- a/vm/reflect/Annotation.c +++ b/vm/reflect/Annotation.c @@ -295,7 +295,6 @@ static Method* resolveAmbiguousMethod(const ClassObject* referrer, u4 methodIdx) Method* resMethod; const DexMethodId* pMethodId; const char* name; - const char* signature; /* if we've already resolved this method, return it */ resMethod = dvmDexGetResolvedMethod(referrer->pDvmDex, methodIdx); @@ -804,7 +803,6 @@ static Object* processEncodedAnnotation(const ClassObject* clazz, const u1** pPtr) { Thread* self = dvmThreadSelf(); - const DexFile* pDexFile = clazz->pDvmDex->pDexFile; Object* newAnno = NULL; ArrayObject* elementArray = NULL; const ClassObject* annoClass; @@ -1023,7 +1021,6 @@ static bool skipAnnotationValue(const ClassObject* clazz, const u1** pPtr) */ static bool skipEncodedAnnotation(const ClassObject* clazz, const u1** pPtr) { - const DexFile* pDexFile = clazz->pDvmDex->pDexFile; const u1* ptr; u4 size; @@ -1148,7 +1145,6 @@ static Object* getAnnotationValue(const ClassObject* clazz, int expectedType, const char* debugAnnoName) { const u1* ptr; - Object* obj; AnnotationValue avalue; /* find the annotation */ @@ -1894,7 +1890,6 @@ static const DexAnnotationSetItem* findAnnotationSetForField(const Field* field) DexFile* pDexFile = clazz->pDvmDex->pDexFile; const DexAnnotationsDirectoryItem* pAnnoDir; const DexFieldAnnotationsItem* pFieldList; - const DexAnnotationSetItem* pAnnoSet = NULL; pAnnoDir = getAnnoDirectory(pDexFile, clazz); if (pAnnoDir == NULL) @@ -1941,8 +1936,6 @@ ArrayObject* dvmGetFieldAnnotations(const Field* field) { ClassObject* clazz = field->clazz; ArrayObject* annoArray = NULL; - DexFile* pDexFile = clazz->pDvmDex->pDexFile; - const DexAnnotationsDirectoryItem* pAnnoDir; const DexAnnotationSetItem* pAnnoSet = NULL; pAnnoSet = findAnnotationSetForField(field); diff --git a/vm/reflect/Proxy.c b/vm/reflect/Proxy.c index 4270894fe..4b95e36c9 100644 --- a/vm/reflect/Proxy.c +++ b/vm/reflect/Proxy.c @@ -428,7 +428,6 @@ bail: static int copyWithoutDuplicates(Method** allMethods, int allCount, Method** outMethods, ArrayObject* throwLists) { - Method* best; int outCount = 0; int i, j; @@ -939,7 +938,6 @@ static void proxyInvoker(const u4* args, JValue* pResult, Object* handler; Method* invoke; ClassObject* returnType; - int hOffset; JValue invokeResult; /* diff --git a/vm/reflect/Reflect.c b/vm/reflect/Reflect.c index 38b1ed012..7fc07b55c 100644 --- a/vm/reflect/Reflect.c +++ b/vm/reflect/Reflect.c @@ -1093,10 +1093,8 @@ DataObject* dvmWrapPrimitive(JValue value, ClassObject* returnType) bool dvmUnwrapPrimitive(Object* value, ClassObject* returnType, JValue* pResult) { - JValue result; PrimitiveType typeIndex = returnType->primitiveType; PrimitiveType valueIndex; - //const u4* dataPtr; if (typeIndex == PRIM_NOT) { if (value != NULL && !dvmInstanceof(value->clazz, returnType)) { diff --git a/vm/test/TestHash.c b/vm/test/TestHash.c index 7233b15e1..26de14130 100644 --- a/vm/test/TestHash.c +++ b/vm/test/TestHash.c @@ -61,7 +61,7 @@ static void dumpIterator(HashTable* pTab) for (dvmHashIterBegin(pTab, &iter); !dvmHashIterDone(&iter); dvmHashIterNext(&iter)) { - const char* str = (const char*) dvmHashIterData(&iter); + //const char* str = (const char*) dvmHashIterData(&iter); //printf(" '%s'\n", str); // (should verify strings) count++; |
