Name | Updated at | |
---|---|---|
README.txt | ||
bytecode.txt | ||
opcode-gen | ||
opcode-gen.awk | ||
regen-all |
##########
If you want to add, delete, or change opcodes:
Update the file bytecode.txt, in this directory.
Run the regen-all script, in this directory. This will regenerate a number of tables, definitions, and declarations in the code, in dalvik/dx, dalvik/libdex, and libcore/dalvik.
Implement/update the opcode in C in vm/mterp/c/...
Implement/update the instruction in assembly in vm/mterp/{arm*,x86*}/...
Implement/update the instruction in vm/compiler/codegen/{arm,x86}/CodegenDriver.c.
Rebuild the interpreter code. See the notes in vm/mterp/ReadMe.txt for details.
Look in the directory vm/analysis at the files CodeVerify.c, DexVerify.c, and Optimize.c. You may need to update them to account for your changes.
##########
If you want to add, delete, or change instruction formats:
This is a more manual affair than changing opcodes.
Update the file bytecode.txt, and run regen-all, as per above.
Update the instruction format list in libdex/InstrUtils.h.
Update dexDecodeInstruction() in libdex/InstrUtils.c.
Update dumpInstruction() and its helper code in dexdump/DexDump.c.
Update the switch inside dvmCompilerMIR2LIR() in vm/compiler/codegen/{arm,x86}/CodegenDriver.c. (There may be other architectures to deal with too.)
##########
Testing your work:
The Dalvik VM tests (in the vm/tests directory) provide a convenient way to test most of the above without doing any rebuilds. In particular, test 003-omnibus-opcodes will exercise most of the opcodes.