Jvm JIT和Hotspot - 有什么区别

时间:2022-04-21 17:22:46

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?

我听说过这些术语的使用,但我似乎无法在Java框架中找到它们在一起的最佳位置。我知道JIT是一个编译机制,但它是JVM的一部分吗?什么是热点?它是一种新型VM吗?

3 个解决方案

#1


7  

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.

JVM是一个规范。不同的供应商实施规范。例如:Sun(现在的Oracle),IBM,BEA(现在的Oracle),SAP都实现了规范并提供了自己的JVM。 Sun的具体实现称为Hotspot。 BEA被称为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.

JIT是JVM的一部分,它接受Java字节码并将其编译为运行程序的机器上的本机处理器汇编代码。每个供应商都使用独特的复杂算法实现JIT。例如:JRockit上的JIT与Hotspot的JIT不同。

#2


10  

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

JIT是“Just In Time”编译,基本上是在动态编译。

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.

Hotspot是JVM中的概念,它只编译实际使用的代码。也就是说,反复使用的“热门”代码片段。

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

JVM跟踪使用情况,当某些内容变得足够流行时,它会将该代码排队以进行编译,同时继续解释代码。

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

当JIT完成时,它用编译的位交换解释的位。

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

这就是为什么JVM需要“热身”以进行基准测试等。

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

Sun / Oracle JVM的-server和-client选项会影响这种行为,即它们在执行JIT工作时的积极程度。

#3


6  

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.

HotSpot是特定JVM的名称。它具有JIT编译器,就像今天的大多数JVM一样,但是JVM是否具有JVM编译器是一个(相当广泛,公开宣传且重要,但仍然是)实现细节。有没有JIT编译器的Java实现,它们就像标准编译一样。

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

“热点”也是一段经常被调用的代码或者需要不成比例地执行的代码(这可能是JVM得名的地方,就像许多JIT一样 - 旨在加速那些“热点”尤其是)。

#1


7  

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.

JVM是一个规范。不同的供应商实施规范。例如:Sun(现在的Oracle),IBM,BEA(现在的Oracle),SAP都实现了规范并提供了自己的JVM。 Sun的具体实现称为Hotspot。 BEA被称为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.

JIT是JVM的一部分,它接受Java字节码并将其编译为运行程序的机器上的本机处理器汇编代码。每个供应商都使用独特的复杂算法实现JIT。例如:JRockit上的JIT与Hotspot的JIT不同。

#2


10  

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

JIT是“Just In Time”编译,基本上是在动态编译。

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.

Hotspot是JVM中的概念,它只编译实际使用的代码。也就是说,反复使用的“热门”代码片段。

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

JVM跟踪使用情况,当某些内容变得足够流行时,它会将该代码排队以进行编译,同时继续解释代码。

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

当JIT完成时,它用编译的位交换解释的位。

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

这就是为什么JVM需要“热身”以进行基准测试等。

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

Sun / Oracle JVM的-server和-client选项会影响这种行为,即它们在执行JIT工作时的积极程度。

#3


6  

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.

HotSpot是特定JVM的名称。它具有JIT编译器,就像今天的大多数JVM一样,但是JVM是否具有JVM编译器是一个(相当广泛,公开宣传且重要,但仍然是)实现细节。有没有JIT编译器的Java实现,它们就像标准编译一样。

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

“热点”也是一段经常被调用的代码或者需要不成比例地执行的代码(这可能是JVM得名的地方,就像许多JIT一样 - 旨在加速那些“热点”尤其是)。