4 ms·
Libgccjit AOT Codegen for Rustc
- qalmakka 5y agoThis is very cool, I'd like to see more projects using libgccjit because it's much, MUCH nicer than the usual approach of building your frontend alongside GCC. I think it's the first step towards a modular GCC, which is an absolute necessity for it to stay relevant in an LLVM-dominated world.
- rightbyte 5y agoI find libgccjit also way more clear and easy to use than LLVM for code compilation and execution. There is not to many functions to keep track off. The 'goto' centric code generation is nice to wrap your head around.
- specialist 5y agoThe qrintf preprocessor accelerates sprintf expressions. https://github.com/h2o/qrintf https://github.com/h2o/qrintf Noob question: Can libgccjit be used to do the same at runtime?
- rightbyte 5y agoYes. You can compile arbitrary code at runtime. You can "extract" a function generated with libgccjit as a function pointer and use it in your static code.
- chrisseaton 5y agoAnd the great think about this, compared to static code, is you can compile runtime data into this code if you want. So instead of storing something like a configuration value in a global variable which you then have to read, you can store it in the code!
- dipdapdup 5y agolibgccjit looks good. Is it still bound to the GPL license?
- adamdusty 5y agoAs far as I can tell, yes. There is a "GPL licensed" footer at the bottom of the libgccjit page[0]. [0]: https://gcc.gnu.org/wiki/JIT https://gcc.gnu.org/wiki/JIT
- est31 5y agoAnd as the FSF has stopped requiring copyright assignments, their hands are bound for the future. If it turns out that something like LGPL is better in the long term, there is no chance for a relicensing in the future.
- CUViper 5y agoThat change came from the GCC steering committee, not the FSF.
- tadfisher 5y agoThis mostly matters for code contributions, correct? Does dynamically linking to libgccjit.so trigger the GPL requirements for the linking code?
- cygx 5y agoDoes dynamically linking to libgccjit.so trigger the GPL requirements for the linking code? Yes, the GPL triggers if you distribute programs that merely link against a thusly licensed library - at least that's the intention. Full disclosure, there are people who disagree with the FSF's interpretation, arguing that merely linking to a library doesn't necessarily create a derivative work. I don't know if that has ever been tested in a court of law...
- tadfisher 5y ago
- kibwen 5y agoThis backend is now sufficiently mature that the Rust Compiler Team is discussing upstreaming it (just the Rust part, not libgccjit itself): https://github.com/rust-lang/compiler-team/issues/442 https://github.com/rust-lang/compiler-team/issues/442