Replies: 4 comments 3 replies
-
Argument that MIR has no types bigger 64-bit means it can not be used for static languages is wrong. There is already C JIT based on MIR ( Static arrays and structures can be represented by data/bss and pointers to them. Dynamic arrays/structures can be stored in heap or on stack and access by pointers (64-bit value) to them. What I see people who use LLVM for their language implementation are tired of LLVM API instability, difficulties to support different versions of LLVM, LLVM size and compilation speed, difficulties to get review of their patches for LLVM, etc. The current actual problem with MIR is that it is oriented to JITs and does not permit to generate object files and as consequence to be easily used for AOT. |
Beta Was this translation helpful? Give feedback.
-
Thank you for detailed answer! And what is the debugging story with MIR currently? I'm trying to gather more info for Crystal forum post on Crystal interpreter and MIR. This question in particular:
Upcoming Crystal interpreter is a hand written byte code generator / VM and it supports debugging (REPL). I've searched through the issue tracker and if I get it correctly debugging is hard currently with MIR and it wasn't clear clear to me if you plan to work on making it easier in the near future. You've mentioned, that supporting DWARF generation is a big project and is unlikely to happen. Since one of you long term goals is trying MIR JIT for CRuby I would imagine you have to think about debugger support too at some point? I mean if MIR to be picked as the next JIT for Ruby doesn't it mean that high level debugging in IRB should be possible with MIR JIT and work exactly the same as now? |
Beta Was this translation helpful? Give feedback.
-
MIR IR does not have support for aggregate types in the IR - unlike LLVM. This does make it harder to use MIR as you have to code the logic for accessing aggregate data structures yourself. That's why I use the C as the intermediate language in Ravi - since MIR comes with a C compiler that does all this for you. |
Beta Was this translation helpful? Give feedback.
-
Compiler frontend can implement a custom debugger, by adding debug instruments in their code like YARV's Maybe simple debugging support should be enough for many use cases? In GNU assembler, the basic debug info is Mapping registers back to variables or adding type info looks more difficult. But we can write debugger extensions to interpret the stack frame so these tasks can somehow be done without MIR. |
Beta Was this translation helpful? Give feedback.
-
I've started a discussion on Crystal forum https://forum.crystal-lang.org/t/can-crystal-use-mir-for-faster-compiler-interpreter/3851
The answer from one of the core team members seem to be that MIR does not have enough types.
So I wonder if using MIR for Crystal possible/a good idea?
Beta Was this translation helpful? Give feedback.
All reactions