Tag: compiler

Why Server If It’s Not a Server?

Have you ever wondered why when you type java -version, you usually get something like that: java version “1.8.0_131” Java(TM) SE Runtime Environment (build 1.8.0_131-b11) Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode) Why Server VM? For JVM, some machines are considered to be “client-class” and some are “server-class”. If the given machine…

Deoptimization

When looking at the output of -XX:+PrintCompilation JVM flag, it’s easy to spot some entries with “made not entrant” and “made zombie”. This indicates so called deoptimization. What it basically means is that the code which was previously compiled, has to be backed out. Not entrant code Code can be made not entrant in…

Tiered Compilation

Even though there are only two basic compilers (+ interpreter) in Java, there are five levels of executions, because the client (C1) compiler has three different levels of compilation. The server compiler (C2) has only one. Level 0 – interpreted code Level 1 – simple C1 compiled code (with no profiling) Level 2 –…

What’s So Hot in HotSpot?

HotSpot JVM is the primary reference Java Virtual Machine implementation. The name comes from the approach it takes toward compiling the code. Hot spot is the code which is executed frequently. The more frequently code is executed, the hotter it becomes. If HotSpot JVM finds that kind of code, it will compile it to make…

Client, Server and Tiered Compilation

Client and Server Compilers There are two basic types of Just-In-Time Java compilers: Client and Server. Traditionally, the Client and the Server compilers are called C1 and C2 respectively. The main difference between the Client and the Server compilers is the aggressiveness in a way they compile code. The Client compiler is optimised to…

Escape Analysis

Escape Analysis (EA) is another very important technique which Just-In-Time Java compiler can use to analyze the scope of a new object and decide whether it might not be allocated on Java heap space. Many resources available on the internet say that EA allows objects to be allocated on the method stack. While technically…

When Short Methods Pay Off: JIT Inlining

Among all Just-In-Time Java compiler optimizations, inlining methods is one of the most powerful one. When we usually write code following good object-oriented practices, we end up having lots of small objects with well-encapsulated attributes – most of the them accessible via getters. There is an overhead of making additional calls and increasing a callstack….