Get rid of the copies of the opcode table pointers.
This inclduded fixing all the accessor functions to refer to the
global ones defined in InstrUtils.[ch] instead of taking separate
"table pointer" arguments.
This did end up adding a few more truly global references to some of
the code paths, particularly when performing dex optimization, so I
went ahead and measured the time to do a cold first-boot both before
and after the change (on real hardware). The times were identical (to
one-second granularity), so I'm reasonably comfortable making this
change.
Change-Id: I604d9f7882bad4245bb11371218d13b06c3a5375
diff --git a/vm/compiler/Frontend.c b/vm/compiler/Frontend.c
index af704af..4e5a882 100644
--- a/vm/compiler/Frontend.c
+++ b/vm/compiler/Frontend.c
@@ -34,7 +34,7 @@
if (opcode == OP_NOP && instr != 0) {
return 0;
} else {
- insnWidth = gDvm.instrInfo.widths[opcode];
+ insnWidth = dexGetInstrWidth(opcode);
if (insnWidth < 0) {
insnWidth = -insnWidth;
}
@@ -205,7 +205,7 @@
static int analyzeInlineTarget(DecodedInstruction *dalvikInsn, int attributes,
int offset)
{
- int flags = dexGetInstrFlags(gDvm.instrInfo.flags, dalvikInsn->opCode);
+ int flags = dexGetInstrFlags(dalvikInsn->opCode);
int dalvikOpCode = dalvikInsn->opCode;
if ((flags & kInstrInvoke) &&
@@ -570,8 +570,7 @@
dvmCompilerAppendMIR(curBB, insn);
cUnit.numInsts++;
- int flags =
- dexGetInstrFlags(gDvm.instrInfo.flags, insn->dalvikInsn.opCode);
+ int flags = dexGetInstrFlags(insn->dalvikInsn.opCode);
if ((flags & kInstrInvoke) &&
(insn->dalvikInsn.opCode != OP_INVOKE_DIRECT_EMPTY)) {
@@ -644,8 +643,7 @@
/* Link the taken and fallthrough blocks */
BasicBlock *searchBB;
- int flags = dexGetInstrFlags(gDvm.instrInfo.flags,
- lastInsn->dalvikInsn.opCode);
+ int flags = dexGetInstrFlags(lastInsn->dalvikInsn.opCode);
if (flags & kInstrInvoke) {
cUnit.hasInvoke = true;
@@ -1208,9 +1206,8 @@
* aligned to 4-byte boundary (alignment instruction to be
* inserted later.
*/
- if (dexGetInstrFlags(gDvm.instrInfo.flags,
- curBB->lastMIRInsn->dalvikInsn.opCode) &
- kInstrInvoke) {
+ if (dexGetInstrFlags(curBB->lastMIRInsn->dalvikInsn.opCode)
+ & kInstrInvoke) {
newBB->isFallThroughFromInvoke = true;
}