2 ms·
This is awesome. I am impressed. I recently wrote a toy compiler for x86_64. I use an external assembler. My dream is to write a JIT compiler runtime. https:
by samsquire 4y ago
This is awesome. I am impressed.
I recently wrote a toy compiler for x86_64. I use an external assembler.
My dream is to write a JIT compiler runtime.
https://GitHub.com/samsquire/compiler https://GitHub.com/samsquire/compiler
My understanding is that you generate machine code and then mprotect the code to be executable then jump to the void * as a function pointer to execute generated instructions.
What I would like to understand more is tracing compilers and how they optimise hot loops. And how they deoptimise and optimise at runtime based on runtime information.
- saagarjha 4y agoHere's a good start: https://webkit.org/blog/10308/speculation-in-javascriptcore/ https://webkit.org/blog/10308/speculation-in-javascriptcore/
- SirGiggles 4y agoThat looks so cool. Do you have any resources you would recommend to someone who want's to explore (or develop as you have) in this subject?
- samsquire 4y agoWrite a C program that does something interesting or useful then compile it with -S and inspect the assembly. I am a beginner at assembly and learned everything from GCC. There's so many details. I learned about rbp+rsp registers recently. And from Reddit post on the compiler someone told me I need to keep the stack aligned.