20

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?

haylem
  • 22,460
  • 3
  • 67
  • 96
Martin K.
  • 4,669
  • 7
  • 35
  • 49

8 Answers8

19

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.

om-nom-nom
  • 62,329
  • 13
  • 183
  • 228
James Schek
  • 17,844
  • 7
  • 51
  • 64
  • 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 Apr 14 '09 at 15:38
  • @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 Apr 14 '09 at 16:34
12

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

Brian Agnew
  • 268,207
  • 37
  • 334
  • 440
1

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
  • 16,562
  • 18
  • 60
  • 86
1

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.

1

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

John Smith
  • 4,402
  • 4
  • 32
  • 34
  • 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. Apr 14 '09 at 12:57
  • I'm not sure what you want to say there, but yes, Hotspot is a part of Sun JVM. – John Smith Apr 14 '09 at 13:01
  • 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. Apr 14 '09 at 13:39
  • 1
    @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 Apr 14 '09 at 13:44
  • @mmyuers: I think thats exactly what he meant. There are a few like that for special purposes. – jsight Apr 14 '09 at 16:35
  • @mmyers: I meant "not every JVM has" of course. I'm not a native speaker. – John Smith Apr 14 '09 at 16:45
1

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
  • 26,504
  • 11
  • 85
  • 105
1

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
  • 73,784
  • 33
  • 194
  • 347
1

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.

Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880
erickson
  • 265,237
  • 58
  • 395
  • 493
  • 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. Apr 14 '09 at 17:01
  • Yes, the da Vinci project is geared toward support for other languages, and that is where support is being prototyped. – erickson Apr 14 '09 at 17:26
  • Some sort of this optimization (tail-recursion only) is supported by IBM JVM (something like a goto to the beggining of the method) – bartosz.r Oct 16 '12 at 13:07