diff options
author | Dan Bornstein <danfuzz@android.com> | 2010-09-08 15:50:00 -0700 |
---|---|---|
committer | Dan Bornstein <danfuzz@android.com> | 2010-09-09 11:34:19 -0700 |
commit | d394371bd84bacc51e96e2d2eacb8549d9110b1e (patch) | |
tree | 92a09709a4d016139c0d275ece046f865a5bc036 /vm/DvmDex.h | |
parent | 2c81bdc3bb892d7d60855e14f61854f20a9f6cb8 (diff) | |
download | android_dalvik-d394371bd84bacc51e96e2d2eacb8549d9110b1e.tar.gz android_dalvik-d394371bd84bacc51e96e2d2eacb8549d9110b1e.tar.bz2 android_dalvik-d394371bd84bacc51e96e2d2eacb8549d9110b1e.zip |
Remove the functionality in ReduceConstants.[ch].
It was a good experiment to try, but it was never made production-ready,
and it doesn't look like it would be a net win at this point. We
metaphorically pour out a beer in its honor.
Change-Id: I7f6ac95f5b7c963df0a3015ed33595fa1a928636
Diffstat (limited to 'vm/DvmDex.h')
-rw-r--r-- | vm/DvmDex.h | 178 |
1 files changed, 0 insertions, 178 deletions
diff --git a/vm/DvmDex.h b/vm/DvmDex.h index 803be1f00..f36940b9a 100644 --- a/vm/DvmDex.h +++ b/vm/DvmDex.h @@ -100,9 +100,6 @@ bool dvmDexChangeDex1(DvmDex* pDvmDex, u1* addr, u1 newVal); bool dvmDexChangeDex2(DvmDex* pDvmDex, u2* addr, u2 newVal); -#if DVM_RESOLVER_CACHE == DVM_RC_DISABLED -/* 1:1 mapping */ - /* * Return the requested item if it has been resolved, or NULL if it hasn't. */ @@ -160,179 +157,4 @@ INLINE void dvmDexSetResolvedField(DvmDex* pDvmDex, u4 fieldIdx, pDvmDex->pResFields[fieldIdx] = field; } -#elif DVM_RESOLVER_CACHE == DVM_RC_REDUCING -/* reduce request to fit in a less-than-full-size cache table */ - -/* - * Return the requested item if it has been resolved, or NULL if it hasn't. - * - * If we have a mapping table defined for this category, but there's no - * entry for this index, we always return NULL. Otherwise, we return the - * entry. (To regain some performance we may want to assume that the - * table exists when compiled in this mode -- avoids a null check but - * prevents us from switching back and forth without rebuilding the VM.) - * - * We could save an integer compare here by ensuring that map[kNoIndexMapping] - * always evalutes to NULL (e.g. set kNoIndexMapping = 0). - */ -INLINE struct StringObject* dvmDexGetResolvedString(const DvmDex* pDvmDex, - u4 stringIdx) -{ - const DexIndexMap* pIndexMap = &pDvmDex->pDexFile->indexMap; - - assert(stringIdx < pDvmDex->pHeader->stringIdsSize); - if (pIndexMap->stringReducedCount > 0) { - stringIdx = pIndexMap->stringMap[stringIdx]; - if (stringIdx == kNoIndexMapping) - return NULL; - } - return pDvmDex->pResStrings[stringIdx]; -} -INLINE struct ClassObject* dvmDexGetResolvedClass(const DvmDex* pDvmDex, - u4 classIdx) -{ - const DexIndexMap* pIndexMap = &pDvmDex->pDexFile->indexMap; - - assert(classIdx < pDvmDex->pHeader->typeIdsSize); - if (pIndexMap->classReducedCount > 0) { - classIdx = pIndexMap->classMap[classIdx]; - if (classIdx == kNoIndexMapping) - return NULL; - } - return pDvmDex->pResClasses[classIdx]; -} -INLINE struct Method* dvmDexGetResolvedMethod(const DvmDex* pDvmDex, - u4 methodIdx) -{ - const DexIndexMap* pIndexMap = &pDvmDex->pDexFile->indexMap; - - assert(methodIdx < pDvmDex->pHeader->methodIdsSize); - if (pIndexMap->methodReducedCount > 0) { - methodIdx = pIndexMap->methodMap[methodIdx]; - if (methodIdx == kNoIndexMapping) - return NULL; - } - return pDvmDex->pResMethods[methodIdx]; -} -INLINE struct Field* dvmDexGetResolvedField(const DvmDex* pDvmDex, - u4 fieldIdx) -{ - const DexIndexMap* pIndexMap = &pDvmDex->pDexFile->indexMap; - - assert(fieldIdx < pDvmDex->pHeader->fieldIdsSize); - if (pIndexMap->fieldReducedCount > 0) { - fieldIdx = pIndexMap->fieldMap[fieldIdx]; - if (fieldIdx == kNoIndexMapping) - return NULL; - } - return pDvmDex->pResFields[fieldIdx]; -} - -/* - * Update the resolved item table. Resolution always produces the same - * result, so we're not worried about atomicity here. - */ -INLINE void dvmDexSetResolvedString(DvmDex* pDvmDex, u4 stringIdx, - struct StringObject* str) -{ - const DexIndexMap* pIndexMap = &pDvmDex->pDexFile->indexMap; - u4 newIdx; - - assert(stringIdx < pDvmDex->pHeader->stringIdsSize); - if (pIndexMap->stringReducedCount > 0) { - newIdx = pIndexMap->stringMap[stringIdx]; - if (newIdx != kNoIndexMapping) - pDvmDex->pResStrings[newIdx] = str; - } -} -INLINE void dvmDexSetResolvedClass(DvmDex* pDvmDex, u4 classIdx, - struct ClassObject* clazz) -{ - const DexIndexMap* pIndexMap = &pDvmDex->pDexFile->indexMap; - u4 newIdx; - - assert(classIdx < pDvmDex->pHeader->typeIdsSize); - if (pIndexMap->classReducedCount > 0) { - newIdx = pIndexMap->classMap[classIdx]; - if (newIdx != kNoIndexMapping) - pDvmDex->pResClasses[newIdx] = clazz; - } -} -INLINE void dvmDexSetResolvedMethod(DvmDex* pDvmDex, u4 methodIdx, - struct Method* method) -{ - const DexIndexMap* pIndexMap = &pDvmDex->pDexFile->indexMap; - u4 newIdx; - - assert(methodIdx < pDvmDex->pHeader->methodIdsSize); - if (pIndexMap->methodReducedCount > 0) { - newIdx = pIndexMap->methodMap[methodIdx]; - if (newIdx != kNoIndexMapping) - pDvmDex->pResMethods[newIdx] = method; - } -} -INLINE void dvmDexSetResolvedField(DvmDex* pDvmDex, u4 fieldIdx, - struct Field* field) -{ - const DexIndexMap* pIndexMap = &pDvmDex->pDexFile->indexMap; - u4 newIdx; - - assert(fieldIdx < pDvmDex->pHeader->fieldIdsSize); - if (pIndexMap->fieldReducedCount > 0) { - newIdx = pIndexMap->fieldMap[fieldIdx]; - if (newIdx != kNoIndexMapping) - pDvmDex->pResFields[newIdx] = field; - } -} - -#elif DVM_RESOLVER_CACHE == DVM_RC_EXPANDING - -#error "not implemented" /* TODO */ - -#elif DVM_RESOLVER_CACHE == DVM_RC_NO_CACHE - -/* - * There's no cache, so we always return NULL. - */ -INLINE struct StringObject* dvmDexGetResolvedString(const DvmDex* pDvmDex, - u4 stringIdx) -{ - return NULL; -} -INLINE struct ClassObject* dvmDexGetResolvedClass(const DvmDex* pDvmDex, - u4 classIdx) -{ - return NULL; -} -INLINE struct Method* dvmDexGetResolvedMethod(const DvmDex* pDvmDex, - u4 methodIdx) -{ - return NULL; -} -INLINE struct Field* dvmDexGetResolvedField(const DvmDex* pDvmDex, - u4 fieldIdx) -{ - return NULL; -} - -/* - * Update the resolved item table. There is no table, so do nothing. - */ -INLINE void dvmDexSetResolvedString(DvmDex* pDvmDex, u4 stringIdx, - struct StringObject* str) -{} -INLINE void dvmDexSetResolvedClass(DvmDex* pDvmDex, u4 classIdx, - struct ClassObject* clazz) -{} -INLINE void dvmDexSetResolvedMethod(DvmDex* pDvmDex, u4 methodIdx, - struct Method* method) -{} -INLINE void dvmDexSetResolvedField(DvmDex* pDvmDex, u4 fieldIdx, - struct Field* field) -{} - -#else -#error "huh?" -#endif /*DVM_RESOLVER_CACHE==N*/ - #endif /*_DALVIK_DVMDEX*/ |