From f67b6afce08a6b9b5daf7d4d69e132fda07bc78f Mon Sep 17 00:00:00 2001 From: Dan Bornstein Date: Wed, 2 Feb 2011 14:01:52 -0800 Subject: CodeReader visitor dispatch now uses OpcodeInfo. This gets rid of the per-opcode Instruction array and just does a simple switch. If it turns out that the switch has poor performance, we can push the visitor abstraction down into IndexType. The big change to OpcodeInfo is to make every Info instance always have a non-null IndexType, exactly so it could be reliably switch()ed on without having to do an explicit null check. Change-Id: Iee8289f8766ce41c5043eec7212b2133ec71e682 --- opcode-gen/opcode-gen.awk | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'opcode-gen') diff --git a/opcode-gen/opcode-gen.awk b/opcode-gen/opcode-gen.awk index 2f1a830eb..0e0ff6cab 100644 --- a/opcode-gen/opcode-gen.awk +++ b/opcode-gen/opcode-gen.awk @@ -108,18 +108,12 @@ emission == "opcode-info-defs" { for (i = 0; i <= MAX_OPCODE; i++) { if (isUnused(i) || isOptimized(i)) continue; - itype = indexType[i]; - if ((itype == "none") || (itype == "unknown")) { - itype = "null"; - } else { - itype = toupper(itype); - gsub(/-/, "_", itype); - itype = "IndexType." itype; - } + itype = toupper(indexType[i]); + gsub(/-/, "_", itype); printf(" public static final Info %s =\n" \ " new Info(Opcodes.%s, \"%s\",\n" \ - " InstructionCodec.FORMAT_%s, %s);\n\n", \ + " InstructionCodec.FORMAT_%s, IndexType.%s);\n\n", \ constName[i], constName[i], name[i], toupper(format[i]), itype); } } -- cgit v1.2.3