3

I see that this JEP (http://openjdk.java.net/jeps/197) introduced 3 types of code caches.

The most obvious one to me is -XX:NonNMethodCodeHeapSize. This is the one that deals with JVM internal data.

What I do not understand is what is the difference between NonProfiledCodeHeapSize and ProfiledCodeHeapSize. That document says that:

Tiered compilation also introduces a new compiled code type: instrumented compiled code (profiled code).

My understanding is that "instrumented" here means "with counters", so kind of logic to assume that this is really C1 compiled code? And the other one is C2?

Eugene
  • 117,005
  • 15
  • 201
  • 306
  • Instrumented means that code was inserted from performance monitoring (profiling). Unless you are actively profiling your code I don't think you'd want that option in production. – AminM Sep 21 '21 at 05:36
  • @AminM read the answer provided. – Eugene Sep 21 '21 at 19:51

1 Answers1

4

In Tiered Compilation, profiled code means JIT-compiled methods that collect execution statistics (counters and type information), which can be used later for recompilation on a different tier.

Non-profiled code is not only C2 code. It also includes compiled wrappers for native methods, as well as methods compiled by C1 without execution statistics (Tier 1), e.g. simple methods like getters/setters that will not benefit from recompilation.

See codeBlob.hpp:

// CodeBlob Types
// Used in the CodeCache to assign CodeBlobs to different CodeHeaps
struct CodeBlobType {
  enum {
    MethodNonProfiled   = 0,    // Execution level 1 and 4 (non-profiled) nmethods (including native nmethods)
    MethodProfiled      = 1,    // Execution level 2 and 3 (profiled) nmethods
    NonNMethod          = 2,    // Non-nmethods like Buffers, Adapters and Runtime Stubs
    All                 = 3,    // All types (No code cache segmentation)
    NumTypes            = 4     // Number of CodeBlobTypes
  };
};
apangin
  • 92,924
  • 10
  • 193
  • 247
  • thank you, I was really looking into the source code (usually comments there are _very_ helpful), but could not find where it was. – Eugene Sep 21 '21 at 19:55