summaryrefslogtreecommitdiffstats
path: root/opcode-gen
diff options
context:
space:
mode:
authorDan Bornstein <danfuzz@android.com>2010-12-01 12:30:21 -0800
committerDan Bornstein <danfuzz@android.com>2010-12-01 12:47:45 -0800
commit111221644c5b7b1d4f426d02786aeebf1addc8f6 (patch)
tree31115dc6d484bd9b4877ed41e5ad3c5eb380605b /opcode-gen
parentfe9382b46660cb240a99efb7ac772db7b2f4ab21 (diff)
downloadandroid_dalvik-111221644c5b7b1d4f426d02786aeebf1addc8f6.tar.gz
android_dalvik-111221644c5b7b1d4f426d02786aeebf1addc8f6.tar.bz2
android_dalvik-111221644c5b7b1d4f426d02786aeebf1addc8f6.zip
Add more "extended opcode" structure to libdex.
Although we don't yet generate any of the extended opcodes, this change makes it a bit easier to add them. In particular, we now differentiate between the raw opcode in a code unit and an associated "packed opcode number." The packed opcode space is densely populated in the range 0x000-0x1ff (though there will still be a few unused slots), whereas the raw opcode values are sparse throughout the range 0x0000-0xffff. The OpCode enum is redefined/clarified to have packed, not sparse, opcode values. Change-Id: Ie3208a258648fbf044d344646f66c49ad24c31b2
Diffstat (limited to 'opcode-gen')
-rwxr-xr-xopcode-gen/opcode-gen11
1 files changed, 11 insertions, 0 deletions
diff --git a/opcode-gen/opcode-gen b/opcode-gen/opcode-gen
index 8a99134ad..64011ce83 100755
--- a/opcode-gen/opcode-gen
+++ b/opcode-gen/opcode-gen
@@ -480,6 +480,17 @@ function flagsToC(f, parts, result, i) {
return result;
}
+# Given a packed opcode, returns the raw (unpacked) opcode value.
+function unpackOpcode(idx) {
+ # Note: This must be the inverse of the corresponding code in
+ # libdex/OpCode.h.
+ if (idx <= 0xff) {
+ return idx;
+ } else {
+ return (idx << 8) | 0xff;
+ }
+}
+
# Returns true if the given opcode (by index) is an "optimized" opcode.
function isOptimized(idx, parts, f) {
# locals: parts, f