DZone 's Guide to


If you're ever seen the messages, 'made not entrant,' or 'made zombie,' while working in the JVM, read on to learn how to handle this situation.

· Performance Zone ·
Free Resource

When looking at the output of the -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 the following scenarios:

  • When using a polymorphism.
  • During Tiered Compilation.


Let’s look at an example:

Parser parser;

if (document.isLong()) {
  parser = new RemoteParser();
} else {
  parser = new LocalParser();

String parsedDocument = parser.parse(document);
// ...

As you can see, the implementation of the parser depends on the length of the document. If we want to parse a long document, we will use the RemoteParser, otherwise, it will be the LocalParser. Let’s imagine the following situation: there is a huge amount of long documents to be parsed; the JIT compiler will notice that the actual type of parser is the RemoteParser. It will use the inline parse method (if applicable) and perform further optimizations assuming that the type of parser is always the RemoteParser.

Now, let’s call the code above with a huge amount of short documents. The assumption about the type of parser is no longer valid, so the optimizations applied before are also invalid. That means that the compiled methods have been made not entrant. JVM will discard all those optimizations and start compiling that code with LocalParser.

Tiered Compilation

Due to the nature of Tiered Compilation, when the method is compiled using different levels of compilation, the code compiled using the previous level is made not entrant. What it basically means is that the compilation on a new level is made from scratch (however, it can use profile data that's already been collected).

Zombie Code

“Zombie code” in a compilation log means that the code which was previously made not entrant has been reclaimed. In other words – all the objects which used previous optimizations don’t exist anymore so that the optimized code can be removed from a code cache (where compiled code is held and which is limited, of course).

compilation ,compiler ,jit optimization ,jvm ,performance

Published at DZone with permission of Grzegorz Mirek , DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}