开发者

Jvm JIT and Hotspot - What are the differences

开发者 https://www.devze.com 2023-03-23 21:56 出处:网络
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?

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 ne开发者_开发问答w type of VM?


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.


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消