views:

1423

answers:

8

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?

+8  A: 

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

Brian Agnew
+1  A: 

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

abababa22
What's about the sun JVM? http://java.sun.com/javase/technologies/hotspot/ It seems, the hotspot JIT compiler is sipped with every JVM release!
Martin K.
I'm not sure what you want to say there, but yes, Hotspot is a part of Sun JVM.
abababa22
Why do you say there that evey JVM doesn't have JIT compiling when it's part of the most JVMs? Why do you vote me down?
Martin K.
@abababa22: "every JVM doesn't have" is pretty much equivalent to "no JVM has", at least in U.S. English. Did you mean "not every JVM has"?
Michael Myers
@mmyuers: I think thats exactly what he meant. There are a few like that for special purposes.
jsight
@mmyers: I meant "not every JVM has" of course. I'm not a native speaker.
abababa22
I fixed the grammar a bit.
abababa22
+1  A: 

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.

Zifre
+1  A: 

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.

Thorbjørn Ravn Andersen
Technology Compatibility Kit. http://jcp.org/en/resources/tdk
James Schek
+9  A: 

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 siginificant over the years. Once upon a time, the IBM and JRockit JVM's had far supierior performance to the reference Sun implementation. This was due to significant differences in the types of runtime optiizations, 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.

James Schek
As someone forced to used JRockit for over 5 years now, I would say that overall it is no faster than Hotspot, but it's definitely not as robust. They sacrifice reliability for speed, and end up with nothing.
erickson
@erickson, As someone who has voluntarily used JRockit for over 5 years now, I can say that your experiences aren't universal. JRockit has saved at least once with its memory leak detection tool as well. :) I haven't had any more crashes with it than with Sun VMs (though there have been 1 or two).
jsight
+1  A: 

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.

erickson
I remember on options for Java6 (experimental features), maybe the Sun JDK supports it as experimental? What's about the "Da vinchi VM" I heard it should support TCO!
Martin K.
Yes, the da Vinci project is geared toward support for other languages, and that is where support is being prototyped.
erickson
+1  A: 

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.)

Jin Kim
+1  A: 

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.

Mohammad Imran