DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Trending

  • ScyllaDB in Enterprise Java: High-Performance NoSQL With Eclipse JNoSQL
  • Evals in CI: How to Catch Agent Regressions Before Production Does
  • Why Spark Executors Leave Cores Idle on YARN: A Packing Model for Executor Sizing
  • PWA on iOS, Part 2: HTTPS, Manifest and Service Worker

Draft This article hasn't been published, so readers can't see it.

In moderation This article is waiting for review, so readers can't see it yet.

Deleted This article has been deleted, so readers can't see it.

Deoptimization

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.

By 
Grzegorz Mirek
·
Aug. 03, 17 · Analysis
Post on X (opens in a new tab) Share on LinkedIn (opens in a new tab)
5.4K Views

Join the DZone community Save articles, join the discussion, and download Refcards and Trend Reports with a free account.

Join for free Already a member? Log in

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.

Polymorphism

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

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

Opinions expressed by DZone contributors are their own.

Partner Resources

×

Comments

Loading comments

The comments didn't load

Please try again in a moment.

Likes

Loading

The next likes didn't load. Please try again.

The likes didn't load

Please try again in a moment.

See who liked this

Log in or join DZone for free to see who liked this article.

Log in Join for free
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook