3 ms·
Aside, it's surprising to me that there isn't a (maintained) Java/JVM implementation on top of LLVM...
by hayd 9y ago
Aside, it's surprising to me that there isn't a (maintained) Java/JVM implementation on top of LLVM...
- legulere 9y agoReflection is hard to support with ahead of time compilation, yet java code often makes heavily use of it for (de-)serialization.
- dullgiulio 9y agoBut the exact same is valid for Go...
- Reason077 9y ago"Reflection is hard to support with ahead of time compilation" Not true at all. There's nothing in reflection and serialization[1] that is hard to implement with an AOT compiler. The real problem with AOT-compilation in Java is that there are many optimisations, like devirtualization, that can only be done (or done much more easily/effectively) at runtime. You can get some of this back with whole-program/closed-world optimisation, but in reality that's highly impractical for Java. Many Java programs are very large and people want the ability to update them quickly and easily, often without even restarting let alone recompiling. An LLVM-based Java runtime could use a hybrid AOT/JIT model, however. Recompiling parts of the program as needed at runtime based on profiler data, you'd get the fast startup of AOT combined with the high performance of JIT. Don't get any crazy ideas about beating Hotspot's performance, though. [1] one exception is classes/methods that are defined at runtime using dynamically generated bytecode. But that's pretty rare.
- pjmlp 9y agoStill there are plenty of commercial options to AOT compile Java, and OpenJDK is getting its free variant with Java 9 for Linux x64, with Windows and OS X already supported on the Java 10 development branch. Oracle Labs is also pushing forward their research of meta-circular JVM, which makes use of AOT compilation. Although it restricts it to a "native Java" subset. http://cr.openjdk.java.net/~jrose/metropolis/Metropolis-Proposal.html http://cr.openjdk.java.net/~jrose/metropolis/Metropolis-Prop...
- amaranth 9y agoOpenJDK's AOT compiler, when you also allow it to include the JIT and still recompile hotspots, is about 5% slower than just using the JIT. The only reasons to use it are startup times, ease of distribution (no JVM to ship, sort of), and for use in places that don't allow JITs (iOS).
- pjmlp 9y agoOpenJDK's AOT is also on its early days. Have you ever profiled Excelsior JET, Aonix, Jamaica, IBM Websphere Real Time for example? Their products are almost as old as Java, so I imagine they are worth their price.
- amaranth 9y agoI believe those products prohibit doing public benchmarking so even if I had I couldn't tell you the results. :)
- pjmlp 9y agoHowever if they were really bad, they would have already disbanded the teams, because companies would just use the gratis JDK with pure JIT. Regarding OpenJDK, according to the Java Languages Summit talk, the Java 10 dev branch already has better optimizations than version 9.
- pjmlp 9y agoNo, but there is a LLVM implementation on top of Java/JVM. :) https://github.com/graalvm/sulong https://github.com/graalvm/sulong Which is much better, because we need more language research with type safe languages, not with C and C++.
- ksherlock 9y agoLLVM used to have a .net backend. (https://github.com/llvm-mirror/llvm/tree/release_27/lib/Target/MSIL https://github.com/llvm-mirror/llvm/tree/release_27/lib/Targ...)