summaryrefslogtreecommitdiffstats
path: root/opcode-gen
diff options
context:
space:
mode:
authorDan Bornstein <danfuzz@android.com>2011-01-25 16:39:12 -0800
committerDan Bornstein <danfuzz@android.com>2011-01-30 12:40:37 -0800
commit3c5df37a2df7368eb274eb097e9cfa2ccc7fffb6 (patch)
tree316b0e92f65b6fe83036eefce65db14bf9c238b3 /opcode-gen
parent2cbe105e2b4362d54f10a03b44a344b46f931f5a (diff)
downloadandroid_dalvik-3c5df37a2df7368eb274eb097e9cfa2ccc7fffb6.tar.gz
android_dalvik-3c5df37a2df7368eb274eb097e9cfa2ccc7fffb6.tar.bz2
android_dalvik-3c5df37a2df7368eb274eb097e9cfa2ccc7fffb6.zip
Basic facility to read/write bytecode.
These classes are meant for reading and writing bytecode at the lowest possible level, in particular without layering any interpretation of the instructions beyond understanding the instruction formats. (For example, constant indices remain numbers and aren't tied to objects representing constants.) This patch represents a work-in-progress that compiles but is as yet not hooked up to anything else. Hooking it all up will happen in one or more follow-on patches. Change-Id: Ifd3b3ff0925dc9dc3d82e507dc1be83cb560031d
Diffstat (limited to 'opcode-gen')
-rw-r--r--opcode-gen/opcode-gen.awk24
-rwxr-xr-xopcode-gen/regen-all1
2 files changed, 24 insertions, 1 deletions
diff --git a/opcode-gen/opcode-gen.awk b/opcode-gen/opcode-gen.awk
index 3232bc63e..86e7cae59 100644
--- a/opcode-gen/opcode-gen.awk
+++ b/opcode-gen/opcode-gen.awk
@@ -103,7 +103,29 @@ emission == "dops" {
}
}
-emission == "dops-init" {
+emission == "opcode-info-defs" {
+ emissionHandled = 1;
+
+ 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;
+ }
+
+ printf(" public static final Info %s =\n" \
+ " new Info(DalvOps.%s,\n" \
+ " InstructionCodec.FORMAT_%s, %s);\n\n", \
+ constName[i], constName[i], toupper(format[i]), itype);
+ }
+}
+
+emission == "dops-init" || emission == "opcode-info-init" {
emissionHandled = 1;
for (i = 0; i <= MAX_OPCODE; i++) {
diff --git a/opcode-gen/regen-all b/opcode-gen/regen-all
index 68a76c37d..68bbd64d2 100755
--- a/opcode-gen/regen-all
+++ b/opcode-gen/regen-all
@@ -37,6 +37,7 @@ cd ".."
${progdir}/opcode-gen dx/src/com/android/dx/dex/code/DalvOps.java
${progdir}/opcode-gen dx/src/com/android/dx/dex/code/Dops.java
${progdir}/opcode-gen dx/src/com/android/dx/dex/code/RopToDop.java
+${progdir}/opcode-gen dx/src/com/android/dx/io/OpcodeInfo.java
${progdir}/opcode-gen libdex/DexOpcodes.c
${progdir}/opcode-gen libdex/DexOpcodes.h
${progdir}/opcode-gen libdex/InstrUtils.c