• Home
    • View
    • Login
    This page
    • Normal
    • Export PDF
    • Export Word
    • Attachments
    • Page Information

    Loading...
  1. Dashboard
  2. HotSpot
  3. Main
  4. Runtime
  5. Application Class Data Sharing - AppCDS
  6. Caching Java Heap Objects

Page History

Versions Compared

Old Version 9

changes.mady.by.user Jiangli Zhou

Saved on Aug 19, 2019

compared with

New Version 10

changes.mady.by.user Jiangli Zhou

Saved on Aug 19, 2019

  • Previous Change: Difference between versions 8 and 9
  • Next Change: Difference between versions 10 and 11
  • View Page History

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Caching Java objects with open archive region may help JVM startup and runtime performance.

Open Archive Heap Region Verification

All live objects and dormant objects are verified to make sure they only point to live objects or archived objects.

Adjustable Outgoing Pointers

...

NOTE: synchronization on the objects within the archive heap region can still cause writes to the memory page.

Closed Archive Regions Verification

Objects can only point to objects within the closed Archive region.

Dormant Java Objects

Dormant Java objects are unreachable Java objects residing in the open archive heap region(s). 

A Java object in the open archive heap region is a live object if it can be reached during scanning. Some of the Java objects in the open region may not be reachable during scanning. Those objects are considered as dormant, but not dead. For example, a constant pool 'resolved_references' array is reachable via the klass root only if its container klass (shared) is already loaded at the time during the current GC scanning. If a shared klass is not yet loaded, the klass root is not scanned and it's constant pool 'resolved_reference' array (A) in the open archive region is not reachable. Then A is a dormant object.

...

Currently, a live object in the open archive heap region cannot become dormant again. This restriction simplifies GC requirement and guarantees all outgoing pointers are updated by GC correctly. 

Currently, only Only objects for shared classes from the builtin class loaders (the boot loader, PlatformClassLoaders, and AppClassLoaders) are supported for caching currently.

New/Updated GC APIs

G1ArchiveAllocator

...

In Closed Archive Heap Region

  • Interned Java.lang.String objects and the underlying 'value' objects
  • Primitive box caches and the cached objects (JDK-8209120, JDK-8213033)

In Open Archive Heap Region

  • Class mirror objects (Java.lang.Class objects)
  • Class constant pool resolved_references arrays
  • Module Graph (Sub-graph of Java Heap Objects)
  • System Module Boot layer Configuration (JDK-8207263)

Integer.IntegerCache (JDK-8209120)

Caching Java Objects at Archive Dump Time

...

At runtime as part of ConstantPool::restore_unshareable_info() work, call G1SATBCardTableModRefBS::enqueue() to let GC know the 'resolved_references' is becoming live. A handle is created for the cached object and added to the loader_data's handles.

Class Redefinition Interaction

No issue.

When a shared class is redefined at runtime, the 'resolved_references' array is reallocated for the 'scratch_class'. The cached array will not be in use.

VM_RedefineClasses::load_new_class_versions()
  ->Rewriter::rewrite()
    ->Rewriter::Rewriter()
      ->Rewriter::make_constant_pool_cache()
        -> initialize_resolved_references()

The cached array object is reachable from the handle in ClassLoaderData (_ handles). For shared classes from the three builtin loaders (boot, PlatformClassLoader and AppClassLoader), the cached 'resolved_references' array is still kept alive after redefinition.

Runtime Java Heap With Cached Java Objects

The closed archive regions (the string regions) and open archive regions are mapped to the runtime Java heap at the same offsets as the dump time offsets from the runtime Java heap base. 

Archive Heap Region Verification

Open Archive Regions

All live objects and dormant objects are verified to make sure they only point to live objects or archived objects.

Closed Archive Regions

Objects can only point to objects within the closed Archive region.


Overview
Content Tools
ThemeBuilder

Terms of Use • License: GPLv2 • Privacy • Trademarks • Contact Us

Powered by a free Atlassian Confluence Open Source Project License granted to https://www.atlassian.com/software/views/opensource-community-additional-license-offer. Evaluate Confluence today.

  • Adaptavist ThemeBuilder Powered by Atlassian Confluence 7.4.1
  • Adaptavist ThemeBuilder printed.by.atlassian.confluence
  • Report a bug
  • Atlassian News
Atlassian
Adaptavist ThemeBuilder EngineAtlassian Confluence
{"serverDuration": 265, "requestCorrelationId": "74538302fd3c9795"}