HotSpot (virtual machine)#Features

{{Short description|Java virtual machine}}

{{About|Oracle's Java virtual machine||Hotspot (disambiguation){{!}}Hotspot}}

{{lead too short|date=October 2018}}

{{Infobox software

| name = Java HotSpot Virtual Machine

| logo =

| caption =

| author = Sun Microsystems

| developer = Oracle Corporation

| released = {{Start date and age|1999|04|27}}{{cite web|title=Sun Announces Availability of the Java HotSpot Performance Engine

|archive-url=https://web.archive.org/web/20131101095145/http://www.thefreelibrary.com/Sun+Announces+Availability+of+the+Java+HotSpot+Performance+Engine%3B...-a054477747|archive-date=1 November 2013|url=http://www.thefreelibrary.com/Sun+Announces+Availability+of+the+Java+HotSpot+Performance+Engine%3B...-a054477747|work=Press Release|publisher=Sun Microsystems|access-date=26 March 2013}}

| latest release version = {{wikidata|property|preferred|references|edit|Q251|P348|P548=Q2804309}}

| latest release date = {{Start date and age|{{wikidata|qualifier|preferred|single|Q251|P348|P548=Q2804309|P577}}}}

| operating system = Cross-platform

| programming language = C++, Assembly

| genre = Java virtual machine

| license = Proprietary (early versions), GNU General Public License (current)

| website = {{URL|https://openjdk.org/groups/hotspot/}}

| repo = {{URL|https://github.com/openjdk/jdk/tree/master/src/hotspot}}

}}

HotSpot, released as Java HotSpot Performance Engine, is a Java virtual machine for desktop and server computers, developed by Sun Microsystems which was purchased by and became a division of Oracle Corporation in 2010. Its features improved performance via methods such as just-in-time compilation and adaptive optimization. It is the de facto Java Virtual Machine, serving as the reference implementation of the Java programming language.

History

The Java HotSpot Performance Engine was released on April 27, 1999, built on technologies from an implementation of the programming language Smalltalk named Strongtalk, originally developed by Longview Technologies, which traded as Animorphic. The Longview virtual machine was based on the Self virtual machine, with an interpreter replacing the fast-and-dumb first compiler. When Sun cancelled the Self project, two key people, Urs Hölzle and Lars Bak left Sun to start Longview. In 1997, Sun Microsystems purchased Animorphic.{{Cite web|last=Services|first=Chronicle Staff and News|date=1997-02-19|title=SUN MICRO BUYS LONGVIEW|url=https://www.sfgate.com/business/article/SUN-MICRO-BUYS-LONGVIEW-2854052.php|access-date=2020-11-05|website=SFGATE|language=en-US}}

Shortly after acquiring Animorphic, Sun decided to write a new stronger just-in-time (JIT) compiler for the Java virtual machine,{{cite web

| url=http://www.infoq.com/interviews/click-gc-azul

| title=Cliff Click on Azul's Pauseless GC, Zing, JVM Languages

| publisher=InfoQ

| date=2011-01-20

| access-date = 2016-05-10

| quote = [...] Anamorphic was acquired by Sun so the original team was at a company called Anamorphic, they came in with a technology that was targeted at Smalltalk and they re-targeted it for Java and they hired me shortly afterwards to do a new JIT for their virtual machine.

}} named HotSpot server compiler (internal name C2), which was initially developed by Clifford Click{{cite journal |last1=Click |first1=Clifford |title=The java hotspotTM server compiler |journal=JVM'01: Proceedings of the 2001 Symposium on JavaTM Virtual Machine Research and Technology Symposium |date=April 2001 |volume=1 |page=1 |url=https://dl.acm.org/doi/10.5555/1267847.1267848}} and was an extension of his PhD thesis on optimizing compilers.{{Cite web|url=https://www.youtube.com/watch?v=9epgZ-e6DUU|title=Cliff Click — The Sea of Nodes and the HotSpot JIT|date=February 14, 2020|via=YouTube}} The compiler name HotSpot is derived from the software's behavior: as it runs Java bytecode, as with the Self VM, HotSpot continually analyzes the program's performance for hot spots which are executed often or repeatedly. These are then targeted for optimizing, leading to high-performance execution with a minimum of overhead for less performance-critical code. In one report, the JVM beat some C++ or C code in some benchmarks.{{cite web

| url=http://scribblethink.org/Computer/javaCbenchmark.html

| archive-url=https://web.archive.org/web/20200424183315/http://scribblethink.org/Computer/javaCbenchmark.html

| url-status=dead

| archive-date=2020-04-24

| title= Performance of Java versus C++

| last=Lewis|first=J. P.

| year=2004

| access-date=2007-10-03}}

Initially available as an add-on for Java 1.2,{{cite news |last= Shankland |first= Stephen |title= HotSpot finally makes its mark |url= http://news.cnet.com/HotSpot-finally-makes-its-mark/2100-1001_3-221855.html |newspaper= Cnet |date=18 February 1999}} HotSpot became the default Sun JVM in Java 1.3.

{{cite web

| url=http://www.sun.com/smi/Press/sunflash/2000-05/sunflash.20000508.3.xml

| title=Sun Microsystems releases fastest client-side Java platform to date

| publisher=Sun Microsystems

| date=2000-05-08

| access-date=2007-10-03

}}

Features

JRE (originally from Sun, now from Oracle) features two virtual machines, one called Client and the other Server. The Client version is tuned for quick loading. It makes use of interpretation. The Server version loads more slowly, putting more effort into producing highly optimized JIT compilations to yield higher performance. Both VMs compile only often-run methods, using a configurable invocation-count threshold to decide which methods to compile.

Tiered compiling, an option introduced in Java 7, uses both the client and server compilers in tandem to provide faster startup time than the server compiler, but similar or better peak performance.{{cite web|url=http://docs.oracle.com/javase/7/docs/technotes/guides/vm/performance-enhancements-7.html|title=Java ™ HotSpot Virtual Machine Performance Enhancements|website=docs.oracle.com}} Starting in Java 8, tiered compilation is the default for the server VM.{{cite web|url=https://docs.oracle.com/javase/8/docs/technotes/guides/vm/performance-enhancements-7.html|title=Java ™ HotSpot Virtual Machine Performance Enhancements|website=docs.oracle.com}}

HotSpot is written in C++ and Assembly. In 2007, Sun estimated it comprised approximately 250,000 lines of source code.{{cite web

| url=http://openjdk.java.net/groups/hotspot/

| title= The HotSpot Group

| publisher=Sun Microsystems

| quote=There are nearly 1500 C/C++ header and source files, comprising almost 250,000 lines of code

| year=2007

| access-date=2007-10-03}} Hotspot provides:

  • A Java class loader
  • A templating Java bytecode interpreter
  • Client (C1) and Server (C2) Just-in Time Compilers, optimized for their respective uses
  • Several garbage collectors (including the low-latency ZGC and low-pause-time Shenandoah){{cite web |title=Main - ZGC |url=https://wiki.openjdk.java.net/display/zgc/Main |website=OpenJDK Wiki}}{{cite web |title=HotSpot Virtual Machine Garbage Collection Tuning Guide |url=https://docs.oracle.com/en/java/javase/24/gctuning/available-collectors.html |website=Oracle Help Center |language=en-us}}{{cite web |title=Main - Shenandoah |url=https://wiki.openjdk.org/display/shenandoah |website=OpenJDK Wiki}}
  • A set of supporting runtime libraries
  • Serviceability features

=JVM flags=

HotSpot supports many command-line arguments for options of the virtual machine execution. Some are standard and must be found in any conforming Java virtual machine; others are specific to HotSpot and may not be found in other JVMs (options that begin with -X or -XX are non-standard).{{cite web

|url=https://docs.oracle.com/en/java/javase/24/docs/specs/man/java.html

|title=The java Command

|publisher=Oracle Corporation

|access-date=2025-03-21}}{{cite web

|url=http://blogs.sun.com/watt/resource/jvm-options-list.html

|archiveurl=https://web.archive.org/web/20110430195227/http://blogs.sun.com/watt/resource/jvm-options-list.html

|archivedate=2011-04-30

|title=A Collection of JVM Options

|last=Mocker|first=Joseph D.

|date=2007-08-28

|access-date=2009-02-08}}{{cite web

|url=http://www.md.pp.ru/%7Eeu/jdk6options.html

|archiveurl=https://web.archive.org/web/20100130070337/http://www.md.pp.ru/~eu/jdk6options.html

|archivedate=2010-01-30

|title=The most complete list of -XX options for Java 6 JVM

|last=Maximovich

|first=Dmitri

|access-date=2009-02-08

|url-status=dead

}}{{cite web

| url=http://blog.headius.com/2009/01/my-favorite-hotspot-jvm-flags.html

| title=My Favorite Hotspot JVM Flags

| last=Nutter|first=Charles

| date=2009-01-29

| access-date=2009-02-08}}

License

On 13 November 2006, the HotSpot JVM and the Java Development Kit (JDK) were licensed under the GNU General Public License (GPL) version 2.{{cite web

|url=http://www.sun.com/aboutsun/media/presskits/2006-1113/

|title=Sun Open Sources Java Technology and Releases Source Code Under GPL Version Two License Via NetBeans and Java.net Communities

|publisher=Sun Microsystems

|date=2006-11-13

|archive-url=https://web.archive.org/web/20090209031154/http://www.sun.com/aboutsun/media/presskits/2006-1113/

|archive-date=2009-02-09

|access-date=2017-05-06

|url-status=dead

}} This is the code that became part of Java 7.[http://jdk7.java.net/ JDK7] {{Webarchive|url=https://web.archive.org/web/20161215071733/http://jdk7.java.net/ |date=2016-12-15 }}, Sun.

Supported platforms

=Maintained by Oracle=

As with the entire Java Development Kit (JDK), HotSpot is supported by Oracle Corporation on Windows, Linux, and macOS. Supported instruction set architectures (ISAs) are x86-64 and AArch64.{{cite web| url=https://www.oracle.com/java/technologies/javase/products-doc-jdk17certconfig.html| title=Oracle JDK 17 Certified System Configurations| publisher=Oracle Corporation| access-date=2021-02-01}} Since JDK 15, Solaris and SPARC are no longer supported.{{cite web|url=https://openjdk.java.net/jeps/381|title=JEP 381: Remove the Solaris and SPARC Ports|website=openjdk.java.net}}

=Ports by third parties=

Ports are also available by third parties for various other Unix operating systems. Several different hardware architectures are supported, including x86, PowerPC, and SPARC (Solaris only).

Porting HotSpot is difficult, as much of it is almost extensively written in assembly language,{{cite web

|url=http://gbenson.livejournal.com/2007/11/16/

|archive-url=https://archive.today/20120712034818/http://gbenson.livejournal.com/2007/11/16/

|url-status=dead

|archive-date=2012-07-12

|title=Gary's guide to porting IcedTea

|last=Benson

|first=Gary

|date=2007-11-06

|access-date=2008-01-26

}} though several sections of it are also written in purely standards conformant ISO C++. To remedy this, the IcedTea project has developed a generic port of the HotSpot interpreter called zero-assembler Hotspot (or zero), with almost no assembly code. This port is intended for easy adaptation of the interpreter component of HotSpot to any Linux processor architecture. The code of zero-assembler Hotspot is used for all the non-x86 architecture ports of HotSpot (PowerPC, Itanium (IA-64), S390 and ARM) since version 1.6.{{cite web

|url=http://gbenson.livejournal.com/2008/02/01/

|archive-url=https://archive.today/20120710145652/http://gbenson.livejournal.com/2008/02/01/

|url-status=dead

|archive-date=2012-07-10

|title=1st February 2008

|last=Benson

|first=Gary

|date=2008-02-01

|access-date=2008-02-03

}}{{cite web

| url=https://mail.openjdk.java.net/pipermail/distro-pkg-dev/2008-January/001085.html

| title=Making zero-assembler the default on ppc

| last=Haley|first=Andrew

| date=2008-01-31

| access-date=2022-02-01}}{{cite web

| url=http://mail.openjdk.java.net/pipermail/distro-pkg-dev/2008-February/001172.html

| title=IcedTea 1.6 Released with Zero-assembler and JNLP support!

| last=Angel|first=Lilian

| publisher=Red Hat

| date=2008-02-13

| access-date=2008-02-13

}}

See also

{{Portal|Free and open-source software|Computer programming}}

References

{{Reflist|30em}}