4 ms·
I'm still a bit of an assembly/JIT newbie, but a few thoughts: When you write assembly code, it's generally specific to several details, which in turn affects
by DoofusOfDeath 6y ago
I'm still a bit of an assembly/JIT newbie, but a few thoughts:
When you write assembly code, it's generally specific to several details, which in turn affects your choice of tutorials from which to work:
1) The target architecture (x86-64, AArch64, MIPS, etc.) This defines what instructions you have available, the memory model, etc.
2) The architecture ABI. E.g., what's the protocol for passing parameters to functions you call, and for receiving the return code. [0]
3) The particular assembler you plan to use. Gnu As (and I assume others) provide some directives that don't map directly to machine instructions, but do some book-keeping to make your life easier.
4) (Potentially) the file format for the resulting code [1]. I think this is one area where the assembler and linker utilities can shelter you from the ugly details.
FWIW regarding JIT: Lately I've started playing around with Xbyak [2]. It's probably a bit light on the documentation, but for the most part I've found it to be an easy way to get started with JIT.
[0] https://en.wikipedia.org/wiki/X86_calling_conventions#System_V_AMD64_ABI https://en.wikipedia.org/wiki/X86_calling_conventions#System...
[1] https://en.wikipedia.org/wiki/Comparison_of_executable_file_formats https://en.wikipedia.org/wiki/Comparison_of_executable_file_...
[2] https://github.com/herumi/xbyak https://github.com/herumi/xbyak