Differences between JVM implementations

2019-01-21 20:26发布

问题:

Where do JVM Implementations differ (except licensing)? Does every JVM implement Type Erasure for the Generic handling?

Where are the differences between:

  • JRockit
  • IBM JVM
  • SUN JVM
  • Open JDK
  • Blackdown
  • Kaffe

..... Deals one of them with Tail-Call-Optimization?

回答1:

JVM implementations can differ in the way they implement JIT compiling, optimizations, garbage collection, platforms supported, version of Java supported, etc. They all must meet set of features and behaviors so that it will execute your Java bytecodes correctly.

As you've pointed out, the major difference tends to be in licensing. Other non-technical differences tend to be in free/paid support options, integration with other technologies (usually J2EE servers), and access to source code.

Note: While a J2EE server runs on the JVM, some servers have integrated tools for monitoring, analyzing, and tweaking JVM performance.

As far as technical differences, those have grown less significant over the years. Once upon a time, the IBM and JRockit JVM's had far superior performance to the reference Sun implementation. This was due to significant differences in the types of runtime optimizations, differences in garbage collection, and differences in native-code (and how much native code various classes uses). These performance differences aren't as significant anymore.

Some JVM's also include or integrate with diagnostics and monitoring tools. JRockit includes a set of tools for monitoring your JVM performance. Sun provides various JMX-based tools with overlapping features to do the same. IBM Websphere once upon a time included a similar set of tools for their whole J2EE application server (not sure if they still do, but I would assume that's still true)...

Some of the open source JVM's tend to have a little slower performance because they have been redeveloped from the ground up. As such, they've got a bit more catching up to do. Last I checked about 2 years ago, Blackdown was significantly slower (1.5x-2x?) than the Sun JVM. It was also a bit behind of supported versions of Java.



回答2:

Type erasure is a compiler function and as such JVM independent.



回答3:

Things like type erasure are done by the compiler to be backward compatible with older JVMs. Most JVMs should support all the features you need, but some may be more optimized than others. I'm guessing the Sun JVM is probably the fastest.



回答4:

JIT compiling is one thing that some JVM:s don't have.



回答5:

If the JVM claims to be Java it must pass the TCK, providing a lot of stock funcitonaltiy.

The differences are in non-core places, like garbage collection, the jconsole/visualvm in the Sun JVM, precompilation etc.


clarification: TCK is the test suite that a virtual machine has to pass in order to be officially Java compliant.



回答6:

Another difference between JVMs is behaviour on undocumented API. (e.g. com.sun.xxx) For example, Sun's JVM and IBM's JVM both have slightly different behaviour on signal handling. (IBM's JVM doesn't allow the application to trap the "INT" signal in certain cases.)



回答7:

JVM is like a virtual Machine that works to Load the class and Bytcode varifier, execute the code. while Applocaion Programming Interface is Collection of Packages. and Packages are collection of class. Java program execute where JVM Installed and Works.



回答8:

Tail-call optimization is not yet supported by Java. John Rose is leading efforts to include this in a future release, and has described the approach, and some of the issues involved.