Transmit mapping table to runtime
Pass the <native offset,dalvik offset> mapping table to the
runtime. Also update the MonitorEnter/Exit stubs to optionally
take the thread pointer.
Change-Id: Ie1345fbafc6c0477deed44297bba1c566e6301f6
diff --git a/src/compiler/codegen/arm/ArchUtility.cc b/src/compiler/codegen/arm/ArchUtility.cc
index dc8bdec..e51774e 100644
--- a/src/compiler/codegen/arm/ArchUtility.cc
+++ b/src/compiler/codegen/arm/ArchUtility.cc
@@ -473,21 +473,17 @@
LOG(INFO) << " };\n\n";
// Dump mapping table
- if (cUnit->mappingTableSize > 0) {
- MappingTable *table = cUnit->mappingTable;
- if (!table) {
- LOG(FATAL) << "Null table";
- }
+ if (cUnit->mappingTable.size() > 0) {
sprintf(buf,"\n MappingTable %s%s_%s_mappingTable[%d] = {",
descriptor.c_str(), name.c_str(), signature.c_str(),
- cUnit->mappingTableSize);
+ cUnit->mappingTable.size());
for (unsigned int i = 0; i < strlen(buf); i++)
if (buf[i] == ';') buf[i] = '_';
LOG(INFO) << buf;
strcpy(buf," ");
- for (int i = 0; i < cUnit->mappingTableSize; i++) {
+ for (uint32_t i = 0; i < cUnit->mappingTable.size(); i+=2) {
sprintf(buf+strlen(buf)," {0x%08x, 0x%04x},",
- table[i].targetOffset, table[i].dalvikOffset);
+ cUnit->mappingTable[i], cUnit->mappingTable[i+1]);
LOG(INFO) << buf;
strcpy(buf," ");
}
diff --git a/src/compiler/codegen/arm/Assemble.cc b/src/compiler/codegen/arm/Assemble.cc
index 54e0aaf..2004d46 100644
--- a/src/compiler/codegen/arm/Assemble.cc
+++ b/src/compiler/codegen/arm/Assemble.cc
@@ -1429,11 +1429,10 @@
return offset;
}
-static int createMappingTable(CompilationUnit* cUnit, MappingTable** pTable)
+static void createMappingTable(CompilationUnit* cUnit)
{
ArmLIR* armLIR;
int currentDalvikOffset = -1;
- int count = 0;
for (armLIR = (ArmLIR *) cUnit->firstLIRInsn;
armLIR;
@@ -1441,17 +1440,11 @@
if ((armLIR->opcode >= 0) && !armLIR->flags.isNop &&
(currentDalvikOffset != armLIR->generic.dalvikOffset)) {
// Changed - need to emit a record
- if (pTable) {
- MappingTable *table = *pTable;
- assert(table);
- table[count].targetOffset = armLIR->generic.offset;
- table[count].dalvikOffset = armLIR->generic.dalvikOffset;
- }
- count++;
+ cUnit->mappingTable.push_back(armLIR->generic.offset);
+ cUnit->mappingTable.push_back(armLIR->generic.dalvikOffset);
currentDalvikOffset = armLIR->generic.dalvikOffset;
}
}
- return count;
}
/* Determine the offset of each literal field */
@@ -1577,8 +1570,5 @@
/*
* Create the mapping table
*/
- cUnit->mappingTableSize = createMappingTable(cUnit, NULL /* just count */);
- cUnit->mappingTable = (MappingTable*)oatNew(
- cUnit->mappingTableSize * sizeof(*cUnit->mappingTable), true);
- createMappingTable(cUnit, &cUnit->mappingTable);
+ createMappingTable(cUnit);
}