3 ms·
Is there a C->JVM compiler out there that's any good and actively maintained? What are the major problems that come up with this approach?
by Cojen 6y ago
Is there a C->JVM compiler out there that's any good and actively maintained? What are the major problems that come up with this approach?
- sanxiyn 6y agoNestedVM works pretty well. http://nestedvm.ibex.org/ http://nestedvm.ibex.org/
- qsort 6y agoI don't think there's anything that's fundamentally impossible (or even conceptually very hard) to solve, it's just that most of the times you're solving the interop problem with JNI/JNA. The opposite route is massively more complicated to implement and nobody wants to dump their time into that. IIRC, as a matter of fact, there are many amateurish level C->JVM compilers but nothing that you'd be comfortable working with on a daily basis. I guess it boils down to "yeah but why".
- brabel 6y agoOne possible approach today is to compile C to WASM, then run WASM on the JVM as GraalVM supports WASM. https://www.graalvm.org/reference-manual/wasm/ https://www.graalvm.org/reference-manual/wasm/
- remexre 6y agoIf you're using GraalVM already, I think Sulong might be better -- my experience with WASM (for C) is that there's a bevy of POSIX-correct-but-ANSI-incorrect tricks that don't work properly on WASM. Debugging is also much nicer with LLVM IR (worst-case, just compile it to a binary and gdb that) than WASM (Firefox doesn't show the stack, Chrome has sourcemap bugs).