auto import //branches/master/...@140412
diff --git a/libdex/DexFile.c b/libdex/DexFile.c
index 2639d7b..a8b5345 100644
--- a/libdex/DexFile.c
+++ b/libdex/DexFile.c
@@ -643,6 +643,10 @@
}
indexMapType = *pAux;
break;
+ case kDexChunkRegisterMaps:
+ LOGV("+++ found register maps, size=%u\n", size);
+ pDexFile->pRegisterMapPool = data;
+ break;
default:
LOGI("Unknown chunk 0x%08x (%c%c%c%c), size=%d in aux data area\n",
*pAux,
diff --git a/libdex/DexFile.h b/libdex/DexFile.h
index d1ea5eb..4d8d151 100644
--- a/libdex/DexFile.h
+++ b/libdex/DexFile.h
@@ -163,6 +163,7 @@
/* auxillary data section chunk codes */
enum {
kDexChunkClassLookup = 0x434c4b50, /* CLKP */
+ kDexChunkRegisterMaps = 0x524d4150, /* RMAP */
kDexChunkReducingIndexMap = 0x5249584d, /* RIXM */
kDexChunkExpandingIndexMap = 0x4549584d, /* EIXM */
@@ -514,11 +515,13 @@
const DexClassDef* pClassDefs;
const DexLink* pLinkData;
- /* mapped in "auxillary" section */
+ /*
+ * These are mapped out of the "auxillary" section, and may not be
+ * included in the file.
+ */
const DexClassLookup* pClassLookup;
-
- /* mapped in "auxillary" section */
DexIndexMap indexMap;
+ const void* pRegisterMapPool; // RegisterMapClassPool
/* points to start of DEX file data */
const u1* baseAddr;
@@ -672,6 +675,15 @@
return &pDexFile->pClassDefs[idx];
}
+/* given a ClassDef pointer, recover its index */
+DEX_INLINE u4 dexGetIndexForClassDef(const DexFile* pDexFile,
+ const DexClassDef* pClassDef)
+{
+ assert(pClassDef >= pDexFile->pClassDefs &&
+ pClassDef < pDexFile->pClassDefs + pDexFile->pHeader->classDefsSize);
+ return pClassDef - pDexFile->pClassDefs;
+}
+
/* get the interface list for a DexClass */
DEX_INLINE const DexTypeList* dexGetInterfacesList(const DexFile* pDexFile,
const DexClassDef* pClassDef)
diff --git a/libdex/SysUtil.c b/libdex/SysUtil.c
index 530ac2e..bf1be88 100644
--- a/libdex/SysUtil.c
+++ b/libdex/SysUtil.c
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
/*
* System utilities.
*/
@@ -64,6 +65,25 @@
#endif
}
+/*
+ * Create a private anonymous storage area.
+ */
+int sysCreatePrivateMap(size_t length, MemMapping* pMap)
+{
+ void* memPtr;
+
+ memPtr = sysCreateAnonShmem(length);
+ if (memPtr == NULL)
+ return -1;
+
+ pMap->addr = pMap->baseAddr = memPtr;
+ pMap->length = pMap->baseLength = length;
+ return 0;
+}
+
+/*
+ * Determine the current offset and remaining length of the open file.
+ */
static int getFileStartAndLength(int fd, off_t *start_, size_t *length_)
{
off_t start, end;
diff --git a/libdex/SysUtil.h b/libdex/SysUtil.h
index 8d85efa..8b80503 100644
--- a/libdex/SysUtil.h
+++ b/libdex/SysUtil.h
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
/*
* System utilities.
*/
@@ -63,6 +64,13 @@
MemMapping* pMap);
/*
+ * Create a private anonymous mapping, useful for large allocations.
+ *
+ * On success, "pMap" is filled in, and zero is returned.
+ */
+int sysCreatePrivateMap(size_t length, MemMapping* pMap);
+
+/*
* Release the pages associated with a shared memory segment.
*
* This does not free "pMap"; it just releases the memory.