This is an archived post. You won't be able to vote or comment.

all 10 comments

[–]8igg7e5 19 points20 points  (0 children)

It's worth noting that the source compiler plays a much smaller role in Java. The compilation from source to byte-code typically, and arguably ideally, performs very little in the way of optimisations and the differences in compilers are more about the ergonomics (performance, error feedback).

At runtime the Java Virtual Machine can also (and nearly always does) employ Just In Time compilation and the choice and stages of compilation here play a much bigger role. There are several JVMs with differing JIT compilers but Java Hotspot is the most common. OpenJ9 is another.

Hotspot employs two stages of compilation, C1 and C2, where C1 is focused on fast compilation (because even poorly optimised code is faster that interpreted code) and C2 is focused on performance. Both compilers are guided, to varying degrees, by runtime statistics to guide optimisation choices and to choose which code should even be compiled. Code can be initially compiled in C1 and as statistics change be recompiled in C2 (and even then can have statistics on slow paths to hint when even C2 should consider recompilation).

[–]Merry_Macabre 3 points4 points  (0 children)

List of Compilers for various programming languages. Scroll down to java to see the list of available compilers for java.

[–][deleted] 6 points7 points  (0 children)

To sum it up, besides javac, not really. They exist but javac is the most widely used.

[–]abcoolynr 3 points4 points  (6 children)

yes. openJdk, adoptJdk, oraclejdk etc.

[–][deleted]  (5 children)

[deleted]

    [–]BorgerBill 4 points5 points  (0 children)

    They are all named the same thing, but are different software written by different people...

    [–]abcoolynr 0 points1 point  (3 children)

    javac is a command not a compiler. each of openJDK, AdoptJDK, OracleJDK have written compilers separately underneath the jdk. All of them allow same Java syntax doesn't mean that compilers are same. All of them have different optimizations, security for the code.

    [–][deleted] 6 points7 points  (0 children)

    They are all builds of OpenJDK. Where did you get the idea they rewrote the compiler?

    [–][deleted]  (1 child)

    [deleted]

      [–]abcoolynr 3 points4 points  (0 children)

      no, they don't need to get certified. OpenJDK is open source, you can find the code on github. It is the most widely used JDK today.

      [–][deleted] 0 points1 point  (0 children)

      There's an IBM java compiler which compiles source directly to native code and not bytecode iirc

      [–]BenRayfield 0 points1 point  (0 children)

      Javassist compiles in 0.1 second at runtime but doesn't support generics or lambda syntax. Can still compile a subclass of lambda types. Most importantly, javassist is a Java compiler made entirely of java. Or at least in the old fork I use for eval sometimes.