move-language / move

Apache License 2.0
2.26k stars 689 forks source link

Tips for writing bytecode -> <something> or <something> -> bytecode tools for Move #817

Open sblackshear opened 1 year ago

sblackshear commented 1 year ago

This is a list of helpful reference materials and code pointers for someone interested in writing a compiler from Move bytecode[1] to a different format, a tool that consumes Move bytecode and outputs something else (warnings, optimized bytecode, generated frontend code, ...). This list is also marginally helpful for <something> -> bytecode tools, but probably needs some additional pointers from @tnowacki.

[1] Someone writing such a tool will often reach for Move IR, with the assumption that it is like (e.g.) LLVM IR (i.e., a well specified, carefully designed intermediate language designed for transformations and analysis, a good compilation target). This is not the case--Move IR is used primarily for testing the bytecode verifier, is unstable, and under-documented. Bytecode or stackless bytecode is the best choice for such tools at the moment.