Use the generated opcode info tables.
This is, once again, an intermediate step. Soon, I'm going to try to
remove need to keep and pass copies of the opcode info pointers all
over the place.
Change-Id: Ic6af849310b22ca604a7f2d18c78ff8d112459b4
diff --git a/vm/analysis/CodeVerify.c b/vm/analysis/CodeVerify.c
index 2069848..e9ae842 100644
--- a/vm/analysis/CodeVerify.c
+++ b/vm/analysis/CodeVerify.c
@@ -3557,7 +3557,7 @@
#ifndef NDEBUG
memset(&decInsn, 0x81, sizeof(decInsn));
#endif
- dexDecodeInstruction(&gDvm.instrInfo, insns, &decInsn);
+ dexDecodeInstruction(insns, &decInsn);
int nextFlags = dexGetInstrFlags(gDvm.instrInfo.flags, decInsn.opCode);
diff --git a/vm/analysis/DexVerify.c b/vm/analysis/DexVerify.c
index b35c4ae..654bd01 100644
--- a/vm/analysis/DexVerify.c
+++ b/vm/analysis/DexVerify.c
@@ -33,11 +33,7 @@
*/
bool dvmVerificationStartup(void)
{
- if (dexCreateInstructionInfoTables(&gDvm.instrInfo)) {
- LOGE("Unable to create instruction tables\n");
- return false;
- }
-
+ dexGetInstructionInfoTables(&gDvm.instrInfo);
return true;
}
@@ -46,7 +42,7 @@
*/
void dvmVerificationShutdown(void)
{
- dexFreeInstructionInfoTables(&gDvm.instrInfo);
+ /* No need to do anything here. */
}
/*
@@ -112,7 +108,7 @@
for (i = 0; i < (int) insnCount; /**/) {
- size_t width = dexGetInstrOrTableWidth(gDvm.instrInfo.widths, insns);
+ size_t width = dexGetInstrOrTableWidth(insns);
if (width == 0) {
LOG_VFY_METH(meth,
"VFY: invalid post-opt instruction (0x%04x)\n", *insns);
@@ -817,7 +813,6 @@
const Method* meth = vdata->method;
const DvmDex* pDvmDex = meth->clazz->pDvmDex;
InsnFlags* insnFlags = vdata->insnFlags;
- const InstructionInfoTables* infoTables = &gDvm.instrInfo;
const InstructionFlags* flagTable = gDvm.instrInfo.flags;
const u2* insns = meth->insns;
unsigned int codeOffset;
@@ -833,7 +828,7 @@
DecodedInstruction decInsn;
bool okay = true;
- dexDecodeInstruction(infoTables, meth->insns + codeOffset, &decInsn);
+ dexDecodeInstruction(meth->insns + codeOffset, &decInsn);
/*
* Check register, type, class, field, method, and string indices
diff --git a/vm/analysis/Optimize.c b/vm/analysis/Optimize.c
index 6bc221e..5204096 100644
--- a/vm/analysis/Optimize.c
+++ b/vm/analysis/Optimize.c
@@ -299,7 +299,7 @@
}
}
- width = dexGetInstrOrTableWidth(gDvm.instrInfo.widths, insns);
+ width = dexGetInstrOrTableWidth(insns);
assert(width > 0);
insns += width;
diff --git a/vm/compiler/Frontend.c b/vm/compiler/Frontend.c
index 3c1e837..af704af 100644
--- a/vm/compiler/Frontend.c
+++ b/vm/compiler/Frontend.c
@@ -40,7 +40,7 @@
}
}
- dexDecodeInstruction(&gDvm.instrInfo, codePtr, decInsn);
+ dexDecodeInstruction(codePtr, decInsn);
if (printMe) {
char *decodedString = dvmCompilerGetDalvikDisassembly(decInsn, NULL);
LOGD("%p: %#06x %s\n", codePtr, opcode, decodedString);
diff --git a/vm/compiler/InlineTransformation.c b/vm/compiler/InlineTransformation.c
index 951da61..f93558c 100644
--- a/vm/compiler/InlineTransformation.c
+++ b/vm/compiler/InlineTransformation.c
@@ -46,7 +46,7 @@
MIR *newGetterMIR = dvmCompilerNew(sizeof(MIR), true);
DecodedInstruction getterInsn;
- dexDecodeInstruction(&gDvm.instrInfo, calleeMethod->insns, &getterInsn);
+ dexDecodeInstruction(calleeMethod->insns, &getterInsn);
if (!dvmCompilerCanIncludeThisInstruction(calleeMethod, &getterInsn))
return;
@@ -137,7 +137,7 @@
MIR *newSetterMIR = dvmCompilerNew(sizeof(MIR), true);
DecodedInstruction setterInsn;
- dexDecodeInstruction(&gDvm.instrInfo, calleeMethod->insns, &setterInsn);
+ dexDecodeInstruction(calleeMethod->insns, &setterInsn);
if (!dvmCompilerCanIncludeThisInstruction(calleeMethod, &setterInsn))
return;
diff --git a/vm/interp/Jit.c b/vm/interp/Jit.c
index be9d6df..2ae49ca 100644
--- a/vm/interp/Jit.c
+++ b/vm/interp/Jit.c
@@ -288,7 +288,7 @@
SelfVerificationState state = shadowSpace->selfVerificationState;
DecodedInstruction decInsn;
- dexDecodeInstruction(&gDvm.instrInfo, pc, &decInsn);
+ dexDecodeInstruction(pc, &decInsn);
//LOGD("### DbgIntp(%d): PC: 0x%x endPC: 0x%x state: %d len: %d %s",
// self->threadId, (int)pc, (int)shadowSpace->endPC, state,
@@ -669,7 +669,7 @@
DecodedInstruction nextDecInsn;
const u2 *moveResultPC = lastPC + len;
- dexDecodeInstruction(&gDvm.instrInfo, moveResultPC, &nextDecInsn);
+ dexDecodeInstruction(moveResultPC, &nextDecInsn);
if ((nextDecInsn.opCode != OP_MOVE_RESULT) &&
(nextDecInsn.opCode != OP_MOVE_RESULT_WIDE) &&
(nextDecInsn.opCode != OP_MOVE_RESULT_OBJECT))
@@ -685,8 +685,7 @@
interpState->trace[currTraceRun].frag.isCode = true;
interpState->totalTraceLen++;
- interpState->currRunLen = dexGetInstrOrTableWidth(gDvm.instrInfo.widths,
- moveResultPC);
+ interpState->currRunLen = dexGetInstrOrTableWidth(moveResultPC);
}
/*
@@ -733,7 +732,7 @@
/* First instruction - just remember the PC and exit */
if (lastPC == NULL) break;
/* Grow the trace around the last PC if jitState is kJitTSelect */
- dexDecodeInstruction(&gDvm.instrInfo, lastPC, &decInsn);
+ dexDecodeInstruction(lastPC, &decInsn);
/*
* Treat {PACKED,SPARSE}_SWITCH as trace-ending instructions due
@@ -752,7 +751,7 @@
LOGD("TraceGen: adding %s", dexGetOpcodeName(decInsn.opCode));
#endif
flags = dexGetInstrFlags(gDvm.instrInfo.flags, decInsn.opCode);
- len = dexGetInstrOrTableWidth(gDvm.instrInfo.widths, lastPC);
+ len = dexGetInstrOrTableWidth(lastPC);
offset = lastPC - interpState->method->insns;
assert((unsigned) offset <
dvmGetMethodInsnsSize(interpState->method));