yhirose / pl0-jit-compiler

A tiny PL/0 JIT compiler in less than 900 LOC with LLVM and PEG parser.
MIT License
27 stars 8 forks source link

Not really an issue: LLVM #2

Closed whitesec-au closed 2 years ago

whitesec-au commented 3 years ago

@yhirose Not really an issue, but I would like to ask where did you learn how to create a JIT with LLVM, and has this API changed in subsequent LLVM versions? I can't find any documentation that's clear enough to write a simple JIT like this.

Still, I'm installing LLVM 9.0 and having a go at the divide by zero issue.

Thanks, it's a really neat little JIT!

yhirose commented 2 years ago

@whitesec-au, sorry for the late reply... I just took a look at the official LLVM documentation and some blog articles on Internet. Mine is till using the old MCJIT. The current recommended API is ORCv2. When I have time, I'll try to change my code to use the latest API. https://llvm.org/docs/ORCv2.html

I have recently bought a book "Learn LLVM 12". I recommend anyone who are seriously interested in implementing something with the latest LLVM API. I have just read the chapter regarding how to do 'exception handling', and I was able to support 'zero divide' problem properly in my pl0-jit-compiler. Hope it helps!