Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

My dream is to create an efficient multithreaded runtime that JITs. I came across this article for creating an AST in C and simple machine code generation.

https://keleshev.com/abstract-syntax-tree-an-example-in-c/

I am working on codegen for my imaginary assembler and I'm trying to work out how to set compound expressions such as

  struct[key][key2]["balance"] += 100
In assembly.


split the compound expression into multiple simpler ones until the pieces are small enough to translate directly to asm and you're done


Erlang is multithreaded and JITs for some platforms, if you're not going to true scottsman Erlang JIT because it's not using runtime information. The main goal of Erlang JIT is to eliminate interpretation overhead, rather than any of the deeper analysis goals of some other popular JITs.


Read a compiler book* that explains SSA form and the rest of the usual architecture; it’s pretty straightforward.

* do not read the Dragon Book, there’s better ones out there




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: