Jvm JIT and Hotspot - What are the differences
Asked Answered
C

3

8

I've heard these terms being used, but i cant seem to find a top level view of where they fit in all together in a Java framework. I know JIT is a compiling mechanism, but is it part of JVM? Whats a Hotspot? Is it some new type of VM?

Crossbeam answered 27/7, 2011 at 21:35 Comment(0)
H
15

JVM is a specification. Different vendors implement the spec. Eg: Sun (now Oracle), IBM, BEA (now Oracle), SAP all implement the specification and provide their own JVMs. Sun's specific implementation is called Hotspot. BEA's is called JRockit.

JIT is part of the JVM which takes Java bytecodes and compiles it to the native processor assembly code on the machine where the program is running. Each vendor implements the JIT leveraging unique sophisticated algorithms. For eg: JIT on JRockit is different from Hotspot's JIT.

Hobbs answered 27/7, 2011 at 21:44 Comment(0)
P
15

JIT is "Just In Time" compiling, basically compiling on the fly.

Hotspot is the concept within the JVM where it only compiles the code that's actually being used. That is, the "hot" pieces of code being used over and over.

The JVM tracks usage, and when something becomes popular enough, it queues that code for compilation, while continuing to interpret the code.

When the JIT finishes, it swaps out the interpreted bits with the compiled bits.

This is why a JVM needs to "warm up" for benchmarking and such.

The -server and -client options of the Sun/Oracle JVM affect this behavior as to how aggressive they are when doing the JIT work.

Precast answered 27/7, 2011 at 21:40 Comment(0)
H
15

JVM is a specification. Different vendors implement the spec. Eg: Sun (now Oracle), IBM, BEA (now Oracle), SAP all implement the specification and provide their own JVMs. Sun's specific implementation is called Hotspot. BEA's is called JRockit.

JIT is part of the JVM which takes Java bytecodes and compiles it to the native processor assembly code on the machine where the program is running. Each vendor implements the JIT leveraging unique sophisticated algorithms. For eg: JIT on JRockit is different from Hotspot's JIT.

Hobbs answered 27/7, 2011 at 21:44 Comment(0)
A
9

HotSpot is the name of a particular JVM. It features a JIT compiler, just like most JVMs today, but whether or not a JVM has one is a (pretty wide-spead, openly advertised and important, but still an) implementation detail. There have been Java implementations without JIT compiler and they were just as standard-compilant.

A "hot spot" is also a piece of code that's called frequently or takes disproportionally much time to execute (which is probably where that JVM got its name from, as it is - like many JITs - intended to speed up those "hot spots" in particular).

Ator answered 27/7, 2011 at 21:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.