HotSpot (virtual machine)
lastmod 2024-11-28created 2024-11-281 edits
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.
About
The Hotspot JVM is a JVM first released in 1999 by Longview Technologies LLC, a US company. It was later acquired by SUN and became SUN's default JVM starting with version 1.2. Today the Hotspot JVM is one of the most common JVMs.
Hotspot, as the name says, is an approach that finds the Hot Spots and uses the JIT compiler on those parts. Internally it finds hotspots through profiling and generates native code for those parts. There are two ways of generating the native code: Client and Server.
HotSpot JVM - Client
The compiler running in client mode mainly focuses on minimizing program startup time. It consists of three main stages.
- Interprets the bytecode and builds a static bytecode representation called HIR to make optimization easier
- Builds a platform-dependent intermediate representation (LIR) from the HIR
- Generates machine code using the LIR.
The characteristic of client-mode JIT is that it extracts as much information as possible from the bytecode and focuses on optimizing the code blocks that actually run. It does not care about overall optimization.
HotSpot JVM - Server
The server JIT focuses on overall performance optimization rather than partial code execution.
- First optimizes the code using general compiler optimization techniques
- Dead Code Elimination, Loop invariants hoisting, Common Subexpression Elimination, Constant propagation, Global Code motion, etc.
- Performs Java-specific optimizations.
- Null Check elimination, array Range Check elimination, exception handling path optimization. Register allocation through Graph operations to make the most of large numbers of RICS registers