blob: c6457b118aba46a42f1fab0dd728d12d2cc44703 [file] [log] [blame]
<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="description" content="Eclipse OpenJ9 documentation">
<link rel="canonical" href="https://www.eclipse.org/openj9/docs/shrc/">
<link rel="icon" href="../cr/openj9-logo.svg">
<meta name="generator" content="mkdocs-1.1.2, mkdocs-material-7.1.4">
<title>Introduction - </title>
<link rel="stylesheet" href="../assets/stylesheets/main.bde7dde4.min.css">
<link rel="stylesheet" href="../assets/stylesheets/palette.ef6f36e2.min.css">
<meta name="theme-color" content="#009485">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700%7CRoboto+Mono&display=fallback">
<style>:root{--md-text-font-family:"Roboto";--md-code-font-family:"Roboto Mono"}</style>
<link rel="stylesheet" href="../stylesheets/oj9.css">
</head>
<body dir="ltr" data-md-color-scheme="" data-md-color-primary="teal" data-md-color-accent="cyan">
<script>function __prefix(e){return new URL("..",location).pathname+"."+e}function __get(e,t=localStorage){return JSON.parse(t.getItem(__prefix(e)))}</script>
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<label class="md-overlay" for="__drawer"></label>
<div data-md-component="skip">
<a href="#introduction-to-class-data-sharing" class="md-skip">
Skip to content
</a>
</div>
<div data-md-component="announce">
</div>
<header class="md-header" data-md-component="header">
<nav class="md-header__inner md-grid" aria-label="Header">
<a href=".." title=" " class="md-header__button md-logo" aria-label=" " data-md-component="logo">
<img src="../cr/openj9_6b.png" alt="logo">
</a>
<label class="md-header__button md-icon" for="__drawer">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2z"/></svg>
</label>
<div class="md-header__title" data-md-component="header-title">
<div class="md-header__ellipsis">
<div class="md-header__topic">
<span class="md-ellipsis">
</span>
</div>
<div class="md-header__topic" data-md-component="header-topic">
<span class="md-ellipsis">
Introduction
</span>
</div>
</div>
</div>
<label class="md-header__button md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
</label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" name="search">
<input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" data-md-state="active" required>
<label class="md-search__icon md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
</label>
<button type="reset" class="md-search__icon md-icon" aria-label="Clear" tabindex="-1">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/></svg>
</button>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="search-result">
<div class="md-search-result__meta">
Initializing search
</div>
<ol class="md-search-result__list"></ol>
</div>
</div>
</div>
</div>
</div>
<div class="md-header__source">
<a href="https://github.com/eclipse-openj9/openj9" title="Go to repository" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"/></svg>
</div>
<div class="md-source__repository">
eclipse-openj9/openj9
</div>
</a>
</div>
</nav>
</header>
<div class="md-container" data-md-component="container">
<main class="md-main" data-md-component="main">
<div class="md-main__inner md-grid">
<div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href=".." title=" " class="md-nav__button md-logo" aria-label=" " data-md-component="logo">
<img src="../cr/openj9_6b.png" alt="logo">
</a>
</label>
<div class="md-nav__source">
<a href="https://github.com/eclipse-openj9/openj9" title="Go to repository" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"/></svg>
</div>
<div class="md-source__repository">
eclipse-openj9/openj9
</div>
</a>
</div>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href=".." class="md-nav__link">
About the docs
</a>
</li>
<li class="md-nav__item">
<a href="../builds/" class="md-nav__link">
OpenJ9 builds
</a>
</li>
<li class="md-nav__item">
<a href="../introduction/" class="md-nav__link">
Getting started
</a>
</li>
<li class="md-nav__item">
<a href="../openj9_newuser/" class="md-nav__link">
New to OpenJ9?
</a>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_5" type="checkbox" id="__nav_5" >
<label class="md-nav__link" for="__nav_5">
Release notes
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Release notes" data-md-level="1">
<label class="md-nav__title" for="__nav_5">
<span class="md-nav__icon md-icon"></span>
Release notes
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../openj9_releases/" class="md-nav__link">
Overview
</a>
</li>
<li class="md-nav__item">
<a href="../version0.27/" class="md-nav__link">
Version 0.27.0
</a>
</li>
<li class="md-nav__item">
<a href="../version0.26/" class="md-nav__link">
Version 0.26.0
</a>
</li>
<li class="md-nav__item">
<a href="../version0.25/" class="md-nav__link">
Version 0.25.0
</a>
</li>
<li class="md-nav__item">
<a href="../version0.24/" class="md-nav__link">
Version 0.24.0
</a>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_5_6" type="checkbox" id="__nav_5_6" >
<label class="md-nav__link" for="__nav_5_6">
Earlier releases
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Earlier releases" data-md-level="2">
<label class="md-nav__title" for="__nav_5_6">
<span class="md-nav__icon md-icon"></span>
Earlier releases
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../version0.23/" class="md-nav__link">
Version 0.23.0
</a>
</li>
<li class="md-nav__item">
<a href="../version0.22/" class="md-nav__link">
Version 0.22.0
</a>
</li>
<li class="md-nav__item">
<a href="../version0.21/" class="md-nav__link">
Version 0.21.0
</a>
</li>
<li class="md-nav__item">
<a href="../version0.20/" class="md-nav__link">
Version 0.20.0
</a>
</li>
<li class="md-nav__item">
<a href="../version0.19/" class="md-nav__link">
Version 0.19.0
</a>
</li>
<li class="md-nav__item">
<a href="../version0.18/" class="md-nav__link">
Version 0.18.1
</a>
</li>
<li class="md-nav__item">
<a href="../version0.17/" class="md-nav__link">
Version 0.17.0
</a>
</li>
<li class="md-nav__item">
<a href="../version0.16/" class="md-nav__link">
Version 0.16.0
</a>
</li>
<li class="md-nav__item">
<a href="../version0.15/" class="md-nav__link">
Version 0.15.1
</a>
</li>
<li class="md-nav__item">
<a href="../version0.14/" class="md-nav__link">
Version 0.14.0
</a>
</li>
<li class="md-nav__item">
<a href="../version0.13/" class="md-nav__link">
Version 0.13.0
</a>
</li>
<li class="md-nav__item">
<a href="../version0.12/" class="md-nav__link">
Version 0.12.0
</a>
</li>
<li class="md-nav__item">
<a href="../version0.11/" class="md-nav__link">
Version 0.11.0
</a>
</li>
<li class="md-nav__item">
<a href="../version0.10/" class="md-nav__link">
Version 0.10.0
</a>
</li>
<li class="md-nav__item">
<a href="../version0.9/" class="md-nav__link">
Version 0.9.0
</a>
</li>
<li class="md-nav__item">
<a href="../version0.8/" class="md-nav__link">
Version 0.8.0
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../configuring/" class="md-nav__link">
Configuring your system
</a>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_7" type="checkbox" id="__nav_7" >
<label class="md-nav__link" for="__nav_7">
Memory management
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Memory management" data-md-level="1">
<label class="md-nav__title" for="__nav_7">
<span class="md-nav__icon md-icon"></span>
Memory management
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../allocation/" class="md-nav__link">
Heap allocation
</a>
</li>
<li class="md-nav__item">
<a href="../gc_overview/" class="md-nav__link">
Garbage Collection (GC)
</a>
</li>
<li class="md-nav__item">
<a href="../gc/" class="md-nav__link">
GC policies
</a>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_7_4" type="checkbox" id="__nav_7_4" >
<label class="md-nav__link" for="__nav_7_4">
Troubleshooting GC
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Troubleshooting GC" data-md-level="2">
<label class="md-nav__title" for="__nav_7_4">
<span class="md-nav__icon md-icon"></span>
Troubleshooting GC
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../vgclog/" class="md-nav__link">
Verbose GC logs
</a>
</li>
<li class="md-nav__item">
<a href="../vgclog_examples/" class="md-nav__link">
Log examples
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../jit/" class="md-nav__link">
JIT Compiler
</a>
</li>
<li class="md-nav__item">
<a href="../jitserver/" class="md-nav__link">
JITServer (tech. preview)
</a>
</li>
<li class="md-nav__item">
<a href="../aot/" class="md-nav__link">
AOT Compiler
</a>
</li>
<li class="md-nav__item md-nav__item--active md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_11" type="checkbox" id="__nav_11" checked>
<label class="md-nav__link" for="__nav_11">
Class data sharing
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Class data sharing" data-md-level="1">
<label class="md-nav__title" for="__nav_11">
<span class="md-nav__icon md-icon"></span>
Class data sharing
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item md-nav__item--active">
<input class="md-nav__toggle md-toggle" data-md-toggle="toc" type="checkbox" id="__toc">
<label class="md-nav__link md-nav__link--active" for="__toc">
Introduction
<span class="md-nav__icon md-icon"></span>
</label>
<a href="./" class="md-nav__link md-nav__link--active">
Introduction
</a>
<nav class="md-nav md-nav--secondary" aria-label="On this page...">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
On this page...
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#cache-utilities" class="md-nav__link">
Cache utilities
</a>
</li>
<li class="md-nav__item">
<a href="#enabling-class-data-sharing" class="md-nav__link">
Enabling class data sharing
</a>
</li>
<li class="md-nav__item">
<a href="#class-data-sharing-operations" class="md-nav__link">
Class data sharing operations
</a>
<nav class="md-nav" aria-label="Class data sharing operations">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#aot-code-and-jit-data" class="md-nav__link">
AOT code and JIT data
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#creating-a-shared-classes-cache" class="md-nav__link">
Creating a shared classes cache
</a>
<nav class="md-nav" aria-label="Creating a shared classes cache">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#creating-layer-caches" class="md-nav__link">
Creating layer caches
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#saving-a-non-persistent-shared-classes-cache" class="md-nav__link">
Saving a non-persistent shared classes cache
</a>
</li>
<li class="md-nav__item">
<a href="#housekeeping" class="md-nav__link">
Housekeeping
</a>
</li>
<li class="md-nav__item">
<a href="#support-for-custom-class-loaders" class="md-nav__link">
Support for custom class loaders
</a>
<nav class="md-nav" aria-label="Support for custom class loaders">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#the-java-shared-classes-helper-api" class="md-nav__link">
The Java shared classes Helper API
</a>
</li>
<li class="md-nav__item">
<a href="#the-java-shared-classes-utility-api" class="md-nav__link">
The Java shared classes utility API
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#support-for-bytecode-instrumentation" class="md-nav__link">
Support for bytecode instrumentation
</a>
<nav class="md-nav" aria-label="Support for bytecode instrumentation">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#redefined-and-retransformed-classes" class="md-nav__link">
Redefined and retransformed classes
</a>
</li>
<li class="md-nav__item">
<a href="#sharing-modified-bytecode" class="md-nav__link">
Sharing modified bytecode
</a>
<nav class="md-nav" aria-label="Sharing modified bytecode">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#sharedclasshelper-cache-partitions" class="md-nav__link">
SharedClassHelper cache partitions
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#see-also" class="md-nav__link">
See also
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../shrc_diag_util/" class="md-nav__link">
Diagnosing problems
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../attachapi/" class="md-nav__link">
Java Attach API
</a>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_13" type="checkbox" id="__nav_13" >
<label class="md-nav__link" for="__nav_13">
Diagnostics
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Diagnostics" data-md-level="1">
<label class="md-nav__title" for="__nav_13">
<span class="md-nav__icon md-icon"></span>
Diagnostics
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../diag_overview/" class="md-nav__link">
Overview
</a>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_13_2" type="checkbox" id="__nav_13_2" >
<label class="md-nav__link" for="__nav_13_2">
Dumps
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Dumps" data-md-level="2">
<label class="md-nav__title" for="__nav_13_2">
<span class="md-nav__icon md-icon"></span>
Dumps
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../dump_javadump/" class="md-nav__link">
Java dump
</a>
</li>
<li class="md-nav__item">
<a href="../dump_heapdump/" class="md-nav__link">
Heap dump
</a>
</li>
<li class="md-nav__item">
<a href="../dump_systemdump/" class="md-nav__link">
System dump
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_13_3" type="checkbox" id="__nav_13_3" >
<label class="md-nav__link" for="__nav_13_3">
Tools
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Tools" data-md-level="2">
<label class="md-nav__title" for="__nav_13_3">
<span class="md-nav__icon md-icon"></span>
Tools
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../tool_jextract/" class="md-nav__link">
Dump extractor
</a>
</li>
<li class="md-nav__item">
<a href="../tool_jdmpview/" class="md-nav__link">
Dump viewer
</a>
</li>
<li class="md-nav__item">
<a href="../tool_traceformat/" class="md-nav__link">
Trace formatter
</a>
</li>
<li class="md-nav__item">
<a href="../tool_builder/" class="md-nav__link">
Option builder
</a>
</li>
<li class="md-nav__item">
<a href="../tool_jcmd/" class="md-nav__link">
Java command (jcmd) tool
</a>
</li>
<li class="md-nav__item">
<a href="../tool_jmap/" class="md-nav__link">
Java memory map (jmap) tool
</a>
</li>
<li class="md-nav__item">
<a href="../tool_jps/" class="md-nav__link">
Java process status (jps)
</a>
</li>
<li class="md-nav__item">
<a href="../tool_jstack/" class="md-nav__link">
Java stack (jstack) tool
</a>
</li>
<li class="md-nav__item">
<a href="../tool_jstat/" class="md-nav__link">
Java statistics monitoring (jstat) tool
</a>
</li>
<li class="md-nav__item">
<a href="../tool_migration/" class="md-nav__link">
Switching to OpenJ9
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_13_4" type="checkbox" id="__nav_13_4" >
<label class="md-nav__link" for="__nav_13_4">
Interfaces
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Interfaces" data-md-level="2">
<label class="md-nav__title" for="__nav_13_4">
<span class="md-nav__icon md-icon"></span>
Interfaces
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../interface_jvmti/" class="md-nav__link">
JVMTI
</a>
</li>
<li class="md-nav__item">
<a href="../interface_dtfj/" class="md-nav__link">
DTFJ
</a>
</li>
<li class="md-nav__item">
<a href="../interface_lang_management/" class="md-nav__link">
Language Management
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_14" type="checkbox" id="__nav_14" >
<label class="md-nav__link" for="__nav_14">
Command-line options
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Command-line options" data-md-level="1">
<label class="md-nav__title" for="__nav_14">
<span class="md-nav__icon md-icon"></span>
Command-line options
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../cmdline_specifying/" class="md-nav__link">
Specifying options
</a>
</li>
<li class="md-nav__item">
<a href="../cmdline_general/" class="md-nav__link">
Standard options
</a>
</li>
<li class="md-nav__item">
<a href="../cmdline_migration/" class="md-nav__link">
Switching to OpenJ9
</a>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_14_4" type="checkbox" id="__nav_14_4" >
<label class="md-nav__link" for="__nav_14_4">
System property options
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="System property options" data-md-level="2">
<label class="md-nav__title" for="__nav_14_4">
<span class="md-nav__icon md-icon"></span>
System property options
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../d_jvm_commands/" class="md-nav__link">
Using System properties
</a>
</li>
<li class="md-nav__item">
<a href="../dcomibmenableclasscaching/" class="md-nav__link">
-Dcom.ibm.enableClassCaching
</a>
</li>
<li class="md-nav__item">
<a href="../dcomibmenablelegacydumpsecurity/" class="md-nav__link">
-Dcom.ibm.enableLegacyDumpSecurity
</a>
</li>
<li class="md-nav__item">
<a href="../dcomibmenablelegacylogsecurity/" class="md-nav__link">
-Dcom.ibm.enableLegacyLogSecurity
</a>
</li>
<li class="md-nav__item">
<a href="../dcomibmenablelegacytracesecurity/" class="md-nav__link">
-Dcom.ibm.enableLegacyTraceSecurity
</a>
</li>
<li class="md-nav__item">
<a href="../dcomibmgpudisable/" class="md-nav__link">
-Dcom.ibm.gpu.disable
</a>
</li>
<li class="md-nav__item">
<a href="../dcomibmgpuenable/" class="md-nav__link">
-Dcom.ibm.gpu.enable
</a>
</li>
<li class="md-nav__item">
<a href="../dcomibmgpuverbose/" class="md-nav__link">
-Dcom.ibm.gpu.verbose
</a>
</li>
<li class="md-nav__item">
<a href="../dcomibmlangmanagementosmxbeaniscputime100ns/" class="md-nav__link">
-Dcom.ibm.lang.management.OperatingSystemMXBean.isCpuTime100ns
</a>
</li>
<li class="md-nav__item">
<a href="../dcomibmlangmanagementverbose/" class="md-nav__link">
-Dcom.ibm.lang.management.verbose
</a>
</li>
<li class="md-nav__item">
<a href="../dcomibmotisharedsharedclassglobalfilterclass/" class="md-nav__link">
-Dcom.ibm.oti.shared.SharedClassGlobalFilterClass
</a>
</li>
<li class="md-nav__item">
<a href="../dcomibmtoolsattachcommand_timeout/" class="md-nav__link">
-Dcom.ibm.tools.attach.command_timeout
</a>
</li>
<li class="md-nav__item">
<a href="../dcomibmtoolsattachdirectory/" class="md-nav__link">
-Dcom.ibm.tools.attach.directory
</a>
</li>
<li class="md-nav__item">
<a href="../dcomibmtoolsattachdisplayname/" class="md-nav__link">
-Dcom.ibm.tools.attach.displayName
</a>
</li>
<li class="md-nav__item">
<a href="../dcomibmtoolsattachenable/" class="md-nav__link">
-Dcom.ibm.tools.attach.enable
</a>
</li>
<li class="md-nav__item">
<a href="../dcomibmtoolsattachid/" class="md-nav__link">
-Dcom.ibm.tools.attach.id
</a>
</li>
<li class="md-nav__item">
<a href="../dcomibmtoolsattachlogging/" class="md-nav__link">
-Dcom.ibm.tools.attach.logging
</a>
</li>
<li class="md-nav__item">
<a href="../dcomibmtoolsattachlogname/" class="md-nav__link">
-Dcom.ibm.tools.attach.log.name
</a>
</li>
<li class="md-nav__item">
<a href="../dcomibmtoolsattachshutdown_timeout/" class="md-nav__link">
-Dcom.ibm.tools.attach.shutdown_timeout
</a>
</li>
<li class="md-nav__item">
<a href="../dcomibmtoolsattachtimeout/" class="md-nav__link">
-Dcom.ibm.tools.attach.timeout
</a>
</li>
<li class="md-nav__item">
<a href="../dfileencoding/" class="md-nav__link">
-Dfile.encoding
</a>
</li>
<li class="md-nav__item">
<a href="../djavacompiler/" class="md-nav__link">
-Djava.compiler
</a>
</li>
<li class="md-nav__item">
<a href="../djavalangstringsubstringnocopy/" class="md-nav__link">
-Djava.lang.string.substring.nocopy
</a>
</li>
<li class="md-nav__item">
<a href="../djavalangstringbuffergrowaggressively/" class="md-nav__link">
-Djava.lang.stringBuffer.growAggressively
</a>
</li>
<li class="md-nav__item">
<a href="../djdknativecbc/" class="md-nav__link">
-Djdk.nativeCBC
</a>
</li>
<li class="md-nav__item">
<a href="../djdknativechacha20/" class="md-nav__link">
-Djdk.nativeChaCha20
</a>
</li>
<li class="md-nav__item">
<a href="../djdknativecrypto/" class="md-nav__link">
-Djdk.nativeCrypto
</a>
</li>
<li class="md-nav__item">
<a href="../djdknativedigest/" class="md-nav__link">
-Djdk.nativeDigest
</a>
</li>
<li class="md-nav__item">
<a href="../djdknativegcm/" class="md-nav__link">
-Djdk.nativeGCM
</a>
</li>
<li class="md-nav__item">
<a href="../djdknativersa/" class="md-nav__link">
-Djdk.nativeRSA
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_14_5" type="checkbox" id="__nav_14_5" >
<label class="md-nav__link" for="__nav_14_5">
JVM -X options
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="JVM -X options" data-md-level="2">
<label class="md-nav__title" for="__nav_14_5">
<span class="md-nav__icon md-icon"></span>
JVM -X options
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../x_jvm_commands/" class="md-nav__link">
Using -X options
</a>
</li>
<li class="md-nav__item">
<a href="../x/" class="md-nav__link">
-X
</a>
</li>
<li class="md-nav__item">
<a href="../xaggressive/" class="md-nav__link">
-Xaggressive
</a>
</li>
<li class="md-nav__item">
<a href="../xalwaysclassgc/" class="md-nav__link">
-Xalwaysclassgc
</a>
</li>
<li class="md-nav__item">
<a href="../xaot/" class="md-nav__link">
-Xaot
</a>
</li>
<li class="md-nav__item">
<a href="../xargencoding/" class="md-nav__link">
-Xargencoding
</a>
</li>
<li class="md-nav__item">
<a href="../xbootclasspath/" class="md-nav__link">
-Xbootclasspath
</a>
</li>
<li class="md-nav__item">
<a href="../xceehdlr/" class="md-nav__link">
-XCEEHDLR
</a>
</li>
<li class="md-nav__item">
<a href="../xcheck/" class="md-nav__link">
-Xcheck
</a>
</li>
<li class="md-nav__item">
<a href="../xclassgc/" class="md-nav__link">
-Xclassgc
</a>
</li>
<li class="md-nav__item">
<a href="../xcodecache/" class="md-nav__link">
-Xcodecache
</a>
</li>
<li class="md-nav__item">
<a href="../xcodecachetotal/" class="md-nav__link">
-Xcodecachetotal
</a>
</li>
<li class="md-nav__item">
<a href="../xcomp/" class="md-nav__link">
-Xcomp
</a>
</li>
<li class="md-nav__item">
<a href="../xcompactexplicitgc/" class="md-nav__link">
-Xcompactexplicitgc
</a>
</li>
<li class="md-nav__item">
<a href="../xcompactgc/" class="md-nav__link">
-Xcompactgc
</a>
</li>
<li class="md-nav__item">
<a href="../xcompilationthreads/" class="md-nav__link">
-XcompilationThreads
</a>
</li>
<li class="md-nav__item">
<a href="../xcompressedrefs/" class="md-nav__link">
-Xcompressedrefs
</a>
</li>
<li class="md-nav__item">
<a href="../xconcurrentbackground/" class="md-nav__link">
-Xconcurrentbackground
</a>
</li>
<li class="md-nav__item">
<a href="../xconcurrentlevel/" class="md-nav__link">
-Xconcurrentlevel
</a>
</li>
<li class="md-nav__item">
<a href="../xconcurrentslack/" class="md-nav__link">
-Xconcurrentslack
</a>
</li>
<li class="md-nav__item">
<a href="../xconmeter/" class="md-nav__link">
-Xconmeter
</a>
</li>
<li class="md-nav__item">
<a href="../xenableexcessivegc/" class="md-nav__link">
-Xdisableexcessivegc
</a>
</li>
<li class="md-nav__item">
<a href="../xenableexplicitgc/" class="md-nav__link">
-Xdisableexplicitgc
</a>
</li>
<li class="md-nav__item">
<a href="../xdisablejavadump/" class="md-nav__link">
-Xdisablejavadump
</a>
</li>
<li class="md-nav__item">
<a href="../xenablestringconstantgc/" class="md-nav__link">
-Xdisablestringconstantgc
</a>
</li>
<li class="md-nav__item">
<a href="../xdump/" class="md-nav__link">
-Xdump
</a>
</li>
<li class="md-nav__item">
<a href="../xenableexcessivegc/" class="md-nav__link">
-Xenableexcessivegc
</a>
</li>
<li class="md-nav__item">
<a href="../xenableexplicitgc/" class="md-nav__link">
-Xenableexplicitgc
</a>
</li>
<li class="md-nav__item">
<a href="../xenablestringconstantgc/" class="md-nav__link">
-Xenablestringconstantgc
</a>
</li>
<li class="md-nav__item">
<a href="../xfastresolve/" class="md-nav__link">
-Xfastresolve
</a>
</li>
<li class="md-nav__item">
<a href="../xfuture/" class="md-nav__link">
-Xfuture
</a>
</li>
<li class="md-nav__item">
<a href="../xgc/" class="md-nav__link">
-Xgc
</a>
</li>
<li class="md-nav__item">
<a href="../xgcsplitheap/" class="md-nav__link">
-Xgc:splitheap
</a>
</li>
<li class="md-nav__item">
<a href="../xgcmaxthreads/" class="md-nav__link">
-Xgcmaxthreads
</a>
</li>
<li class="md-nav__item">
<a href="../xgcpolicy/" class="md-nav__link">
-Xgcpolicy
</a>
</li>
<li class="md-nav__item">
<a href="../xgcthreads/" class="md-nav__link">
-Xgcthreads
</a>
</li>
<li class="md-nav__item">
<a href="../xgcworkpackets/" class="md-nav__link">
-Xgcworkpackets
</a>
</li>
<li class="md-nav__item">
<a href="../xint/" class="md-nav__link">
-Xint
</a>
</li>
<li class="md-nav__item">
<a href="../xss/" class="md-nav__link">
-Xiss
</a>
</li>
<li class="md-nav__item">
<a href="../xjit/" class="md-nav__link">
-Xjit
</a>
</li>
<li class="md-nav__item">
<a href="../xjni/" class="md-nav__link">
-Xjni
</a>
</li>
<li class="md-nav__item">
<a href="../xlinenumbers/" class="md-nav__link">
-Xlinenumbers
</a>
</li>
<li class="md-nav__item">
<a href="../xloa/" class="md-nav__link">
-Xloa
</a>
</li>
<li class="md-nav__item">
<a href="../xloaminimum/" class="md-nav__link">
-Xloainitial
</a>
</li>
<li class="md-nav__item">
<a href="../xloaminimum/" class="md-nav__link">
-Xloamaximum
</a>
</li>
<li class="md-nav__item">
<a href="../xloaminimum/" class="md-nav__link">
-Xloaminimum
</a>
</li>
<li class="md-nav__item">
<a href="../xlockreservation/" class="md-nav__link">
-XlockReservation
</a>
</li>
<li class="md-nav__item">
<a href="../xlockword/" class="md-nav__link">
-Xlockword
</a>
</li>
<li class="md-nav__item">
<a href="../xlog/" class="md-nav__link">
-Xlog
</a>
</li>
<li class="md-nav__item">
<a href="../xlp/" class="md-nav__link">
-Xlp
</a>
</li>
<li class="md-nav__item">
<a href="../xlpcodecache/" class="md-nav__link">
-Xlp:codecache
</a>
</li>
<li class="md-nav__item">
<a href="../xlpobjectheap/" class="md-nav__link">
-Xlp:objectheap
</a>
</li>
<li class="md-nav__item">
<a href="../xmine/" class="md-nav__link">
-Xmaxe
</a>
</li>
<li class="md-nav__item">
<a href="../xminf/" class="md-nav__link">
-Xmaxf
</a>
</li>
<li class="md-nav__item">
<a href="../xmint/" class="md-nav__link">
-Xmaxt
</a>
</li>
<li class="md-nav__item">
<a href="../xmca/" class="md-nav__link">
-Xmca
</a>
</li>
<li class="md-nav__item">
<a href="../xmca/" class="md-nav__link">
-Xmco
</a>
</li>
<li class="md-nav__item">
<a href="../xmcrs/" class="md-nav__link">
-Xmcrs
</a>
</li>
<li class="md-nav__item">
<a href="../xmine/" class="md-nav__link">
-Xmine
</a>
</li>
<li class="md-nav__item">
<a href="../xminf/" class="md-nav__link">
-Xminf
</a>
</li>
<li class="md-nav__item">
<a href="../xmint/" class="md-nav__link">
-Xmint
</a>
</li>
<li class="md-nav__item">
<a href="../xmn/" class="md-nav__link">
-Xmn
</a>
</li>
<li class="md-nav__item">
<a href="../xmn/" class="md-nav__link">
-Xmns
</a>
</li>
<li class="md-nav__item">
<a href="../xmn/" class="md-nav__link">
-Xmnx
</a>
</li>
<li class="md-nav__item">
<a href="../xmo/" class="md-nav__link">
-Xmo
</a>
</li>
<li class="md-nav__item">
<a href="../xmoi/" class="md-nav__link">
-Xmoi
</a>
</li>
<li class="md-nav__item">
<a href="../xmo/" class="md-nav__link">
-Xmos
</a>
</li>
<li class="md-nav__item">
<a href="../xmo/" class="md-nav__link">
-Xmox
</a>
</li>
<li class="md-nav__item">
<a href="../xmr/" class="md-nav__link">
-Xmr
</a>
</li>
<li class="md-nav__item">
<a href="../xmr/" class="md-nav__link">
-Xmrx
</a>
</li>
<li class="md-nav__item">
<a href="../xms/" class="md-nav__link">
-Xms
</a>
</li>
<li class="md-nav__item">
<a href="../xmso/" class="md-nav__link">
-Xmso
</a>
</li>
<li class="md-nav__item">
<a href="../xms/" class="md-nav__link">
-Xmx
</a>
</li>
<li class="md-nav__item">
<a href="../xaot/" class="md-nav__link">
-Xnoaot
</a>
</li>
<li class="md-nav__item">
<a href="../xclassgc/" class="md-nav__link">
-Xnoclassgc
</a>
</li>
<li class="md-nav__item">
<a href="../xcompactexplicitgc/" class="md-nav__link">
-Xnocompactexplicitgc
</a>
</li>
<li class="md-nav__item">
<a href="../xcompactgc/" class="md-nav__link">
-Xnocompactgc
</a>
</li>
<li class="md-nav__item">
<a href="../xcompressedrefs/" class="md-nav__link">
-Xnocompressedrefs
</a>
</li>
<li class="md-nav__item">
<a href="../xjit/" class="md-nav__link">
-Xnojit
</a>
</li>
<li class="md-nav__item">
<a href="../xlinenumbers/" class="md-nav__link">
-Xnolinenumbers
</a>
</li>
<li class="md-nav__item">
<a href="../xloa/" class="md-nav__link">
-Xnoloa
</a>
</li>
<li class="md-nav__item">
<a href="../xsigcatch/" class="md-nav__link">
-Xnosigcatch
</a>
</li>
<li class="md-nav__item">
<a href="../xsigchain/" class="md-nav__link">
-Xnosigchain
</a>
</li>
<li class="md-nav__item">
<a href="../xnumanone/" class="md-nav__link">
-Xnuma:none
</a>
</li>
<li class="md-nav__item">
<a href="../xoptionsfile/" class="md-nav__link">
-Xoptionsfile
</a>
</li>
<li class="md-nav__item">
<a href="../xquickstart/" class="md-nav__link">
-Xquickstart
</a>
</li>
<li class="md-nav__item">
<a href="../xrs/" class="md-nav__link">
-Xrs
</a>
</li>
<li class="md-nav__item">
<a href="../xsamplingexpirationtime/" class="md-nav__link">
-XsamplingExpirationTime
</a>
</li>
<li class="md-nav__item">
<a href="../xscdmx/" class="md-nav__link">
-Xscdmx
</a>
</li>
<li class="md-nav__item">
<a href="../xscminaot/" class="md-nav__link">
-Xscmaxaot
</a>
</li>
<li class="md-nav__item">
<a href="../xscminjitdata/" class="md-nav__link">
-Xscmaxjitdata
</a>
</li>
<li class="md-nav__item">
<a href="../xscminaot/" class="md-nav__link">
-Xscminaot
</a>
</li>
<li class="md-nav__item">
<a href="../xscminjitdata/" class="md-nav__link">
-Xscminjitdata
</a>
</li>
<li class="md-nav__item">
<a href="../xscmx/" class="md-nav__link">
-Xscmx
</a>
</li>
<li class="md-nav__item">
<a href="../xshareclasses/" class="md-nav__link">
-Xshareclasses
</a>
</li>
<li class="md-nav__item">
<a href="../xsigcatch/" class="md-nav__link">
-Xsigcatch
</a>
</li>
<li class="md-nav__item">
<a href="../xsigchain/" class="md-nav__link">
-Xsigchain
</a>
</li>
<li class="md-nav__item">
<a href="../xsignal/" class="md-nav__link">
-Xsignal
</a>
</li>
<li class="md-nav__item">
<a href="../xsoftmx/" class="md-nav__link">
-Xsoftmx
</a>
</li>
<li class="md-nav__item">
<a href="../xsoftrefthreshold/" class="md-nav__link">
-Xsoftrefthreshold
</a>
</li>
<li class="md-nav__item">
<a href="../xss/" class="md-nav__link">
-Xss
</a>
</li>
<li class="md-nav__item">
<a href="../xss/" class="md-nav__link">
-Xssi
</a>
</li>
<li class="md-nav__item">
<a href="../xsyslog/" class="md-nav__link">
-Xsyslog
</a>
</li>
<li class="md-nav__item">
<a href="../xtgc/" class="md-nav__link">
-Xtgc
</a>
</li>
<li class="md-nav__item">
<a href="../xthr/" class="md-nav__link">
-Xthr
</a>
</li>
<li class="md-nav__item">
<a href="../xtlhprefetch/" class="md-nav__link">
-XtlhPrefetch
</a>
</li>
<li class="md-nav__item">
<a href="../xtrace/" class="md-nav__link">
-Xtrace
</a>
</li>
<li class="md-nav__item">
<a href="../xtunevirtualized/" class="md-nav__link">
-Xtune:virtualized
</a>
</li>
<li class="md-nav__item">
<a href="../xverbosegclog/" class="md-nav__link">
-Xverbosegclog
</a>
</li>
<li class="md-nav__item">
<a href="../xverify/" class="md-nav__link">
-Xverify
</a>
</li>
<li class="md-nav__item">
<a href="../xzero/" class="md-nav__link">
-Xzero
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_14_6" type="checkbox" id="__nav_14_6" >
<label class="md-nav__link" for="__nav_14_6">
JVM -XX options
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="JVM -XX options" data-md-level="2">
<label class="md-nav__title" for="__nav_14_6">
<span class="md-nav__icon md-icon"></span>
JVM -XX options
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../xx_jvm_commands/" class="md-nav__link">
Using -XX options
</a>
</li>
<li class="md-nav__item">
<a href="../xxactiveprocessorcount/" class="md-nav__link">
-XXActiveProcessorCount
</a>
</li>
<li class="md-nav__item">
<a href="../xxadaptivegcthreading/" class="md-nav__link">
-XX:[+|-]AdaptiveGCThreading
</a>
</li>
<li class="md-nav__item">
<a href="../xxallowvmshutdown/" class="md-nav__link">
-XXallowvmshutdown
</a>
</li>
<li class="md-nav__item">
<a href="../xxalwayspretouch/" class="md-nav__link">
-XX:[+|-]AlwaysPreTouch
</a>
</li>
<li class="md-nav__item">
<a href="../xxclassrelationshipverifier/" class="md-nav__link">
-XX:[+|-]ClassRelationshipVerifier
</a>
</li>
<li class="md-nav__item">
<a href="../xxconcgcthreads/" class="md-nav__link">
-XX:ConcGCThreads
</a>
</li>
<li class="md-nav__item">
<a href="../xxcodecachetotal/" class="md-nav__link">
-XX:codecachetotal
</a>
</li>
<li class="md-nav__item">
<a href="../xxcompactstrings/" class="md-nav__link">
-XX:[+|-]CompactStrings
</a>
</li>
<li class="md-nav__item">
<a href="../xxdiagnosesynconvaluebasedclasses/" class="md-nav__link">
-XX:DiagnoseSyncOnValueBasedClasses
</a>
</li>
<li class="md-nav__item">
<a href="../xxdisableexplicitgc/" class="md-nav__link">
-XX:[+|-]DisableExplicitGC
</a>
</li>
<li class="md-nav__item">
<a href="../xxdisclaimjitscratch/" class="md-nav__link">
-XX:[+|-]DisclaimJitScratch
</a>
</li>
<li class="md-nav__item">
<a href="../xxenable3164interoperability/" class="md-nav__link">
-XX:[+|-]Enable3164Interoperability
</a>
</li>
<li class="md-nav__item">
<a href="../xxenablecpumonitor/" class="md-nav__link">
-XX:[+|-]EnableCPUMonitor
</a>
</li>
<li class="md-nav__item">
<a href="../xxexitonoutofmemoryerror/" class="md-nav__link">
-XX:[+|-]ExitOnOutOfMemoryError
</a>
</li>
<li class="md-nav__item">
<a href="../xxgloballockreservation/" class="md-nav__link">
-XX:[+|-]GlobalLockReservation
</a>
</li>
<li class="md-nav__item">
<a href="../xxhandlesigxfsz/" class="md-nav__link">
-XX:[+|-]HandleSIGXFSZ
</a>
</li>
<li class="md-nav__item">
<a href="../xxhandlesigabrt/" class="md-nav__link">
-XX:[+|-]HandleSIGABRT
</a>
</li>
<li class="md-nav__item">
<a href="../xxheapdumponoutofmemory/" class="md-nav__link">
-XX:[+|-]HeapDumpOnOutOfMemory
</a>
</li>
<li class="md-nav__item">
<a href="../xxheapdumppath/" class="md-nav__link">
-XX:HeapDumpPath
</a>
</li>
<li class="md-nav__item">
<a href="../xxheapmanagementmxbeancompatibility/" class="md-nav__link">
-XX:[+|-]HeapManagementMXBeanCompatibility
</a>
</li>
<li class="md-nav__item">
<a href="../xxidletuningcompactonidle/" class="md-nav__link">
-XX:[+|-]IdleTuningCompactOnIdle
</a>
</li>
<li class="md-nav__item">
<a href="../xxidletuninggconidle/" class="md-nav__link">
-XX:[+|-]IdleTuningGcOnIdle
</a>
</li>
<li class="md-nav__item">
<a href="../xxidletuningminfreeheaponidle/" class="md-nav__link">
-XX:IdleTuningMinFreeHeapOnIdle
</a>
</li>
<li class="md-nav__item">
<a href="../xxidletuningminidlewaittime/" class="md-nav__link">
-XX:IdleTuningMinIdleWaitTime
</a>
</li>
<li class="md-nav__item">
<a href="../xxignoreunrecognizedvmoptions/" class="md-nav__link">
-XX:[+|-]IgnoreUnrecognizedVMOptions
</a>
</li>
<li class="md-nav__item">
<a href="../xxignoreunrecognizedxxcolonoptions/" class="md-nav__link">
-XX:[+|-]IgnoreUnrecognizedXXColonOptions
</a>
</li>
<li class="md-nav__item">
<a href="../xxinitialrampercentage/" class="md-nav__link">
-XX:InitialRAMPercentage
</a>
</li>
<li class="md-nav__item">
<a href="../xxinitialheapsize/" class="md-nav__link">
-XX:InitialHeapSize
</a>
</li>
<li class="md-nav__item">
<a href="../xxinterleavememory/" class="md-nav__link">
-XX:[+|-]InterleaveMemory
</a>
</li>
<li class="md-nav__item">
<a href="../xxjitinlinewatches/" class="md-nav__link">
-XX:[+|-]JITInlineWatches
</a>
</li>
<li class="md-nav__item">
<a href="../xxlazysymbolresolution/" class="md-nav__link">
-XX:[+|-]LazySymbolResolution
</a>
</li>
<li class="md-nav__item">
<a href="../xxlegacyxlogoption/" class="md-nav__link">
-XX:[+|-]LegacyXLogOption
</a>
</li>
<li class="md-nav__item">
<a href="../xxmaxdirectmemorysize/" class="md-nav__link">
-XX:MaxDirectMemorySize
</a>
</li>
<li class="md-nav__item">
<a href="../xxinitialheapsize/" class="md-nav__link">
-XX:MaxHeapSize
</a>
</li>
<li class="md-nav__item">
<a href="../xxinitialrampercentage/" class="md-nav__link">
-XX:MaxRAMPercentage
</a>
</li>
<li class="md-nav__item">
<a href="../xxonoutofmemoryerror/" class="md-nav__link">
-XX:OnOutOfMemoryError
</a>
</li>
<li class="md-nav__item">
<a href="../xxoriginaljdk8heapsizecompatibilitymode/" class="md-nav__link">
-XX:[+|-]OriginalJDK8HeapSizeCompatibilityMode
</a>
</li>
<li class="md-nav__item">
<a href="../xxnosuballoc32bitmem/" class="md-nav__link">
-XXnosuballoc32bitmem
</a>
</li>
<li class="md-nav__item">
<a href="../xxpagealigndirectmemory/" class="md-nav__link">
-XX:[+|-]PageAlignDirectMemory
</a>
</li>
<li class="md-nav__item">
<a href="../xxparallelcmsthreads/" class="md-nav__link">
-XX:ParallelCMSThreads
</a>
</li>
<li class="md-nav__item">
<a href="../xxparallelgcmaxthreads/" class="md-nav__link">
-XX:ParallelGCMaxThreads
</a>
</li>
<li class="md-nav__item">
<a href="../xxparallelgcthreads/" class="md-nav__link">
-XX:ParallelGCThreads
</a>
</li>
<li class="md-nav__item">
<a href="../xxportablesharedcache/" class="md-nav__link">
-XX:[+|-]PortableSharedCache
</a>
</li>
<li class="md-nav__item">
<a href="../xxpositiveidentityhash/" class="md-nav__link">
-XX:[+|-]PositiveIdentityHash
</a>
</li>
<li class="md-nav__item">
<a href="../xxprintcodecache/" class="md-nav__link">
-XX:[+|-]PrintCodeCache
</a>
</li>
<li class="md-nav__item">
<a href="../xxprintflagsfinal/" class="md-nav__link">
-XX:[+|-]PrintFlagsFinal
</a>
</li>
<li class="md-nav__item">
<a href="../xxreadipinfoforras/" class="md-nav__link">
-XX:[+|-]ReadIPInfoForRAS
</a>
</li>
<li class="md-nav__item">
<a href="../xxreducecpumonitoroverhead/" class="md-nav__link">
-XX:[+|-]ReduceCPUMonitorOverhead
</a>
</li>
<li class="md-nav__item">
<a href="../xxruntimeinstrumentation/" class="md-nav__link">
-XX:[+|-]RuntimeInstrumentation
</a>
</li>
<li class="md-nav__item">
<a href="../xxsethwprefetch/" class="md-nav__link">
-XXsetHWPrefetch
</a>
</li>
<li class="md-nav__item">
<a href="../xxshareanonymousclasses/" class="md-nav__link">
-XX:[+|-]ShareAnonymousClasses
</a>
</li>
<li class="md-nav__item">
<a href="../xxshareclassesenablebci/" class="md-nav__link">
-XX:ShareClassesDisableBCI
</a>
</li>
<li class="md-nav__item">
<a href="../xxshareclassesenablebci/" class="md-nav__link">
-XX:ShareClassesEnableBCI
</a>
</li>
<li class="md-nav__item">
<a href="../xxsharedcachehardlimit/" class="md-nav__link">
-XX:SharedCacheHardLimit
</a>
</li>
<li class="md-nav__item">
<a href="../xxshareunsafeclasses/" class="md-nav__link">
-XX:[+|-]ShareUnsafeClasses
</a>
</li>
<li class="md-nav__item">
<a href="../xxstacktraceinthrowable/" class="md-nav__link">
-XX:-StackTraceInThrowable
</a>
</li>
<li class="md-nav__item">
<a href="../xxtransparenthugepage/" class="md-nav__link">
-XX:[+|-]TransparentHugePage
</a>
</li>
<li class="md-nav__item">
<a href="../xxusecompressedoops/" class="md-nav__link">
-XX:[+|-]UseCompressedOops
</a>
</li>
<li class="md-nav__item">
<a href="../xxusecontainersupport/" class="md-nav__link">
-XX:[+|-]UseContainerSupport
</a>
</li>
<li class="md-nav__item">
<a href="../xxusegcstartuphints/" class="md-nav__link">
-XX:[+|-]UseGCStartupHints
</a>
</li>
<li class="md-nav__item">
<a href="../xxusenogc/" class="md-nav__link">
-XX:[+|-]UseNoGC
</a>
</li>
<li class="md-nav__item">
<a href="../xxverboseverification/" class="md-nav__link">
-XX:[+|-]VerboseVerification
</a>
</li>
<li class="md-nav__item">
<a href="../xxvmlockclassloader/" class="md-nav__link">
-XX:[+|-]VMLockClassLoader
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_15" type="checkbox" id="__nav_15" >
<label class="md-nav__link" for="__nav_15">
Reference
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label=" Reference" data-md-level="1">
<label class="md-nav__title" for="__nav_15">
<span class="md-nav__icon md-icon"></span>
Reference
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../openj9_support/" class="md-nav__link">
Supported environments
</a>
</li>
<li class="md-nav__item">
<a href="../openj9_defaults/" class="md-nav__link">
Default settings
</a>
</li>
<li class="md-nav__item">
<a href="../openj9_signals/" class="md-nav__link">
Signal handling
</a>
</li>
<li class="md-nav__item">
<a href="../openj9_directories/" class="md-nav__link">
Directory conventions
</a>
</li>
<li class="md-nav__item">
<a href="../messages_intro/" class="md-nav__link">
OpenJ9 messages
</a>
</li>
<li class="md-nav__item">
<a href="../env_var/" class="md-nav__link">
Environment variables
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_16" type="checkbox" id="__nav_16" >
<label class="md-nav__link" for="__nav_16">
API documentation
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="API documentation" data-md-level="1">
<label class="md-nav__title" for="__nav_16">
<span class="md-nav__icon md-icon"></span>
API documentation
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../api-overview/" class="md-nav__link">
Overview
</a>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle" data-md-toggle="__nav_16_2" type="checkbox" id="__nav_16_2" >
<label class="md-nav__link" for="__nav_16_2">
Java 8 API
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" aria-label="Java 8 API" data-md-level="2">
<label class="md-nav__title" for="__nav_16_2">
<span class="md-nav__icon md-icon"></span>
Java 8 API
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../api-conditionhandling/" class="md-nav__link">
Condition exception handling
</a>
</li>
<li class="md-nav__item">
<a href="../api-cuda/" class="md-nav__link">
CUDA4J
</a>
</li>
<li class="md-nav__item">
<a href="../api-daa/" class="md-nav__link">
Data access acceleration
</a>
</li>
<li class="md-nav__item">
<a href="../api-dtfj/" class="md-nav__link">
DTFJ
</a>
</li>
<li class="md-nav__item">
<a href="../api-gpu/" class="md-nav__link">
GPU
</a>
</li>
<li class="md-nav__item">
<a href="../api-jvm/" class="md-nav__link">
JVM diagnostic utilities
</a>
</li>
<li class="md-nav__item">
<a href="../api-langmgmt/" class="md-nav__link">
Monitoring and management
</a>
</li>
<li class="md-nav__item">
<a href="../api-shrc/" class="md-nav__link">
Shared classes
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../api-jdk11/" class="md-nav__link">
Java 11 API
</a>
</li>
<li class="md-nav__item">
<a href="../api-jdk16/" class="md-nav__link">
Java 16 API
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../legal/" class="md-nav__link">
Legal
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary" aria-label="On this page...">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
On this page...
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#cache-utilities" class="md-nav__link">
Cache utilities
</a>
</li>
<li class="md-nav__item">
<a href="#enabling-class-data-sharing" class="md-nav__link">
Enabling class data sharing
</a>
</li>
<li class="md-nav__item">
<a href="#class-data-sharing-operations" class="md-nav__link">
Class data sharing operations
</a>
<nav class="md-nav" aria-label="Class data sharing operations">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#aot-code-and-jit-data" class="md-nav__link">
AOT code and JIT data
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#creating-a-shared-classes-cache" class="md-nav__link">
Creating a shared classes cache
</a>
<nav class="md-nav" aria-label="Creating a shared classes cache">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#creating-layer-caches" class="md-nav__link">
Creating layer caches
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#saving-a-non-persistent-shared-classes-cache" class="md-nav__link">
Saving a non-persistent shared classes cache
</a>
</li>
<li class="md-nav__item">
<a href="#housekeeping" class="md-nav__link">
Housekeeping
</a>
</li>
<li class="md-nav__item">
<a href="#support-for-custom-class-loaders" class="md-nav__link">
Support for custom class loaders
</a>
<nav class="md-nav" aria-label="Support for custom class loaders">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#the-java-shared-classes-helper-api" class="md-nav__link">
The Java shared classes Helper API
</a>
</li>
<li class="md-nav__item">
<a href="#the-java-shared-classes-utility-api" class="md-nav__link">
The Java shared classes utility API
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#support-for-bytecode-instrumentation" class="md-nav__link">
Support for bytecode instrumentation
</a>
<nav class="md-nav" aria-label="Support for bytecode instrumentation">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#redefined-and-retransformed-classes" class="md-nav__link">
Redefined and retransformed classes
</a>
</li>
<li class="md-nav__item">
<a href="#sharing-modified-bytecode" class="md-nav__link">
Sharing modified bytecode
</a>
<nav class="md-nav" aria-label="Sharing modified bytecode">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#sharedclasshelper-cache-partitions" class="md-nav__link">
SharedClassHelper cache partitions
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#see-also" class="md-nav__link">
See also
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content" data-md-component="content">
<article class="md-content__inner md-typeset">
<!--
* Copyright (c) 2017, 2021 IBM Corp. and others
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution and is available at
* https://www.eclipse.org/legal/epl-2.0/ or the Apache
* License, Version 2.0 which accompanies this distribution and
* is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* This Source Code may also be made available under the
* following Secondary Licenses when the conditions for such
* availability set forth in the Eclipse Public License, v. 2.0
* are satisfied: GNU General Public License, version 2 with
* the GNU Classpath Exception [1] and GNU General Public
* License, version 2 with the OpenJDK Assembly Exception [2].
*
* [1] https://www.gnu.org/software/classpath/license.html
* [2] http://openjdk.java.net/legal/assembly-exception.html
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH
* Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
-->
<h1 id="introduction-to-class-data-sharing">Introduction to class data sharing</h1>
<p>Sharing class data between OpenJ9 VMs improves start up performance and reduces memory footprint. Consider the following outcomes for two VMs that are running similar Java applications but sharing class data:</p>
<ul>
<li>
<p>Start up performance is improved by placing classes that each application needs when initializing into a shared classes cache. The next time the application runs, it takes less time to start because the classes are already available.</p>
</li>
<li>
<p>Memory footprint is reduced by sharing common classes between the applications.</p>
</li>
</ul>
<p>When class data sharing is enabled, OpenJ9 automatically creates shared memory that stores and shares the classes in memory between processes. This shared classes cache is updated dynamically; when an application loads new classes, the VM automatically stores them in the cache without any user intervention. By default, class data sharing is enabled for bootstrap classes, as described in <a href="#enabling-class-data-sharing">Enabling class data sharing</a>.</p>
<p>When class data sharing is enabled, Ahead-of-time (AOT) compilation is also enabled by default, which dynamically compiles certain methods into AOT code at runtime. By using these features in combination, startup performance is further improved because the cached AOT code can be used to quickly enable native code performance for subsequent runs of your application. For more information about AOT, see <a href="../aot/">AOT Compiler</a>. Further performance improvements are gained by storing JIT data and profiles in the shared classes cache.</p>
<p>The contents of a shared classes cache can include the following artifacts:</p>
<ul>
<li>Bootstrap classes</li>
<li>Application classes</li>
<li>Metadata that describes the classes</li>
<li>AOT-compiled code</li>
<li>JIT data</li>
<li>GC hints (for initial Java heap size)</li>
<li><img alt="Start of content that applies only to Java 8 (LTS)" src="../cr/java8.png" /> Bootstrap <code>jar</code> file indexes</li>
</ul>
<h2 id="cache-utilities">Cache utilities</h2>
<p>Active caches can be managed by a set of cache utilities, which are invoked by specifying <code>-Xshareclasses</code> suboptions. These utilities control the following types of operations:</p>
<ul>
<li>Displaying information about the caches on a system.</li>
<li>Adjusting the size of a cache and the amount of space that is reserved for AOT code or JIT data.</li>
<li>Creating a snapshot of a non-persistent cache to save to disk and restoring the cache from disk.</li>
<li>Troubleshooting cache problems.</li>
<li>Removing unwanted caches on a system.</li>
</ul>
<p>These cache utilities are discussed in more detail in the sections that follow.</p>
<h2 id="enabling-class-data-sharing">Enabling class data sharing</h2>
<p>Class data sharing is enabled by default for bootstrap classes, unless your application is running in a container.
Default behavior includes the following characteristics:</p>
<ul>
<li>The cache is created in the <code>javasharedresources</code> directory in the users home directory, unless the <code>groupAccess</code> parameter is specified, in which case it is created in <code>/tmp/javasharedresources</code>. However, on Windows&reg;, it is created in the user's <code>C:\Documents and Settings\&lt;username&gt;\Local Settings\Application Data\javasharedresources</code> directory.</li>
<li>The cache name is <code>sharedcc_%u</code>, where <code>%u</code> is the current user name.</li>
<li>If class data sharing fails, the VM still starts without printing any errors.</li>
</ul>
<p>Shared class behavior is controlled by specifying the <a href="../xshareclasses/">-Xshareclasses</a> option on the command line when you start your application. The default settings are equivalent to specifying the following suboptions:</p>
<pre><code>-Xshareclasses:bootClassesOnly,nonFatal,silent
</code></pre>
<p>You can enable class data sharing for non-bootstrap classes as well as bootstrap classes, by omitting the <code>bootClassesOnly</code> suboption. You can also disable all class data sharing by using the <code>none</code> suboption.</p>
<p>Further suboptions are available to configure a cache at startup, including name, location, and startup size. You can also use cache utilities to manage a shared classes cache after it is initialized and in use.</p>
<p>A shared classes cache can be <em>persistent</em> or <em>non-persistent</em> according to the following definition:</p>
<ul>
<li>persistent caches are written to memory-mapped files and remain in place, even after a system is rebooted.</li>
<li>non-persistent caches exist in shared memory and are automatically removed when the operating system is restarted.</li>
</ul>
<p>By default, a shared classes cache is persistent, except on the z/OS&reg; platform, where persistent caches are not supported.
If you are using a non-persistent cache, you can use a cache utility to create a snapshot of the cache, which can be reinitialized after a reboot. For more information see <a href="#saving-a-non-persistent-shared-classes-cache">Saving a non-persistent shared classes cache</a>.</p>
<p>If you have multiple VMs and you do not change the default shared classes behavior, the VMs share a single default cache, assuming that the VMs are from a single Java installation. If the VMs are from different Java installations, the cache might be deleted and re-created.</p>
<p>For a set of best practices when using class data sharing, see <a href="#creating-a-shared-classes-cache">Creating a shared classes cache</a>.</p>
<h2 id="class-data-sharing-operations">Class data sharing operations</h2>
<p>When a VM loads a class and the class loader is enabled for class sharing, the VM looks in the shared classes cache to see if the class is already present. If the class is present and the classpath or URL to load the class is a match, the VM loads the class from the cache. Otherwise, it loads the class from the file system and writes it into the cache.</p>
<p>The VM detects file system updates by storing timestamp values into the cache and comparing the cached values with actual values. In this way, the VM detects when a class might be invalidated and can mark the class as <em>stale</em>. These operations happen transparently when classes are loaded, so users can modify and update as many classes as they like during the lifetime of a shared class cache, knowing that the correct classes are always loaded. Stale classes are <em>redeemed</em> if the same class is subsequently fetched by the class loader from another VM and checked against the stale class in the cache.</p>
<p>Occasionally, caches that are created from one version of the VM might not be compatible with caches that are created from a different version. This situation typically occurs when an update is made in OpenJ9 that changes the internal cache data structure. If a VM detects an incompatible cache at start up, it creates a new cache that can coexist, even if it has the same name. The VM detects a conflict by checking an internal shared classes cache generation number.</p>
<p>Caches are not compatible between VMs that are using different object storage modes. For example, a 64-bit VM that uses compressed references to store 64-bit objects in a 32-bit representation, cannot share a cache with a 64-bit VM that is not using compressed references. For more information about object storage options, see <a href="../allocation/#compressed-references">Compressed references</a>.</p>
<p>In the OpenJ9 implementation of <code>java.net.URLClassLoader</code>, classes are read from and written to the cache using the public Helper API. Therefore, any class loader that extends <code>java.net.URLClassLoader</code> gets class sharing support for free provided that it continues to use the methods in <code>java.net.URLClassLoader</code> to load classes. Custom class loaders that do not extend <code>java.net.URLClassLoader</code> must be adapted to share class data as described in <a href="#support-for-custom-class-loaders">Support for custom class loaders</a>.</p>
<h3 id="aot-code-and-jit-data">AOT code and JIT data</h3>
<p>OpenJ9 can automatically store small amounts of AOT code and JIT data, which helps improve performance in the following ways:</p>
<ul>
<li>The JIT compiler dynamically compiles certain methods into AOT code at runtime. Subsequent VMs that attach to the cache can take advantage of the compiled code to start faster.</li>
<li>The JIT compiler stores profiling data and various compilation <em>hints</em> into the shared classes cache. This data enables subsequent VMs that attach to the cache to start faster, run faster, or both.</li>
</ul>
<p>The default settings provide significant performance benefits. However, you can specify options on the command line to configure AOT code storage or JIT data storage in the shared classes cache, as shown in the following table:</p>
<table>
<thead>
<tr>
<th>Component</th>
<th>Setting a minimum storage value</th>
<th>Setting a maximum storage value</th>
<th>Turning off storage</th>
</tr>
</thead>
<tbody>
<tr>
<td>AOT code</td>
<td><a href="../xscminaot/"><code>-Xscminaot&lt;size&gt;</code></a></td>
<td><a href="../xscminaot/"><code>-Xscmaxaot&lt;size&gt;</code></a></td>
<td><a href="../xshareclasses/#noaot"><code>-Xshareclasses:noaot</code></a></td>
</tr>
<tr>
<td>JIT data</td>
<td><a href="../xscminjitdata/"><code>-Xscminjitdata&lt;size&gt;</code></a></td>
<td><a href="../xscminjitdata/"><code>-Xscmaxjitdata&lt;size&gt;</code></a></td>
<td><a href="../xshareclasses/#nojitdata"><code>-Xshareclasses:nojitdata</code></a></td>
</tr>
</tbody>
</table>
<p>The following cache utilities are available to adjust the storage values when a cache is active:</p>
<table>
<thead>
<tr>
<th>Component</th>
<th>Adjusting the minimum storage value</th>
<th>Adjusting the maximum storage value</th>
</tr>
</thead>
<tbody>
<tr>
<td>AOT code</td>
<td><a href="../xshareclasses/#adjustminaot"><code>-Xshareclasses:adjustminaot</code></a></td>
<td><a href="../xshareclasses/#adjustmaxaot"><code>-Xshareclasses:adjustmaxaot</code></a></td>
</tr>
<tr>
<td>JIT code</td>
<td><a href="../xshareclasses/#adjustminjit"><code>-Xshareclasses:adjustminjit</code></a></td>
<td><a href="../xshareclasses/#adjustmaxjit"><code>-Xshareclasses:adjustmaxjit</code></a></td>
</tr>
</tbody>
</table>
<p>You can also use the <code>-Xshareclasses:findAotMethods</code> cache utility to list the AOT methods in a cache that match a method specification. This utility helps you identify methods that are causing a failure in an application. You can then invalidate the method without destroying the cache by using the <code>-Xshareclasses:invalidateAotMethods</code> cache utility. You can also revalidate an AOT method with the <code>-Xshareclasses:revalidateAotMethods</code> cache utility. To troubleshoot AOT problems, use the <code>-Xshareclasses:verboseAOT</code> suboption on the command line, which generates output about AOT code that is found or stored in the cache. For more information see <a href="../xshareclasses/"><code>-Xshareclasses</code></a>.</p>
<h2 id="creating-a-shared-classes-cache">Creating a shared classes cache</h2>
<p>The <a href="../xshareclasses/">-Xshareclasses</a> option is highly configurable, allowing you to specify where to create the cache, how much space to allocate, and more. The following best practices apply to using class data sharing:</p>
<ul>
<li>
<p>Before starting your application, use the <a href="../xshareclasses/#listallcaches"><code>-Xshareclasses:listAllCaches</code></a> cache utility to review and maintain the existing caches on your system.</p>
<p>This option lists all the caches that exist in the default directory, including compatible and incompatible caches. You can also specify the <code>cacheDir</code> suboption to look for caches in a specified directory. Remove any obsolete caches, as described in <a href="#housekeeping">Housekeeping</a>.</p>
</li>
<li>
<p>If you are creating a new cache, set an application-specific cache name (<a href="../xshareclasses/#name"><code>-Xshareclasses:name=&lt;name&gt;</code></a>).</p>
<p>If a cache with the specified name doesn't already exist, a new cache is created.</p>
<p>This avoids sharing your application cache with a cache that is enabled by default or with another application that doesn't set a name, and ensures that the size of your application cache can be set appropriately and that cache space is used exclusively for your application.</p>
<p><span aria-hidden="true" class="twemoji note"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="m497.9 142.1-46.1 46.1c-4.7 4.7-12.3 4.7-17 0l-111-111c-4.7-4.7-4.7-12.3 0-17l46.1-46.1c18.7-18.7 49.1-18.7 67.9 0l60.1 60.1c18.8 18.7 18.8 49.1 0 67.9zM284.2 99.8 21.6 362.4.4 483.9c-2.9 16.4 11.4 30.6 27.8 27.8l121.5-21.3 262.6-262.6c4.7-4.7 4.7-12.3 0-17l-111-111c-4.8-4.7-12.4-4.7-17.1 0zM124.1 339.9c-5.5-5.5-5.5-14.3 0-19.8l154-154c5.5-5.5 14.3-5.5 19.8 0s5.5 14.3 0 19.8l-154 154c-5.5 5.5-14.3 5.5-19.8 0zM88 424h48v36.3l-64.5 11.3-31.1-31.1L51.7 376H88v48z"/></svg></span> <strong>Note:</strong> You cannot change the size of a default cache that already exists by using the <a href="../xscmx/"><code>-Xscmx</code></a> option, as that option has no effect on a pre-existing cache.</p>
</li>
<li>
<p>Set a specific cache directory (<a href="../xshareclasses/#cachedir"><code>-Xshareclasses:cacheDir=&lt;directory&gt;</code></a>).</p>
<p>Set a cache directory that is specific to your application, to avoid sharing the default cache directory with the default cache, or other application caches that don't set a cache directory. Your application will be unaffected by a user running <a href="../xshareclasses/#destroyall-cache-utility"><code>java -Xshareclasses:destroyAll</code></a>.</p>
<p>In addition, if you have VMs from different Java installations, of the same Java release and installed by the same user, each VM checks whether the existing default shared cache in the cache directory is from the same Java installation as the VM. If not, the VM deletes that shared cache, then creates a new one. Specifying a different cache directory for each Java installation avoids this situation.</p>
</li>
<li>
<p>Ensure that the cache directory permissions are set appropriately (<a href="../xshareclasses/#cachedirperm"><code>-Xshareclasses:cacheDirPerm</code></a>).</p>
<p>It is good practice to explicitly set permissions for the cache directory when the defaults are not appropriate. Access is controlled by operating system permissions and Java security permissions; read/write access is the default only for the current user. On Unix systems, you can use the <a href="../xshareclasses/#groupaccess"><code>-Xshareclasses:groupAccess</code></a> suboption to allow read/write permissions for groups as well as users.</p>
<p>On z/OS, a cache can be accessed only by a VM that is running in the same storage key as the VM that created the cache. If the keys do not match, permission to access the cache is denied.</p>
</li>
<li>
<p>Set the <a href="../xshareclasses/#nonfatal"><code>-Xshareclasses:nonfatal</code></a> option.</p>
<p>In most cases, setting this option allows your application to start even if there is a problem opening or creating the shared cache. The VM will continue to start <em>without</em> class data sharing.</p>
</li>
<li>
<p>Set a soft maximum size for the cache by specifying the <a href="../xscmx/">-Xscmx</a> option with the <a href="../xxsharedcachehardlimit/"><code>-XXSharedCacheHardLimit</code></a> option. </p>
<p>For example, you might create a 64 MB shared cache and set a smaller value, such as 16 MB, for the <code>-Xscmx</code> option, to limit the data stored in the cache (<code>-XX:SharedCacheHardLimit=64m -Xscmx16m</code>). You can then adjust the soft maximum size by using the <a href="../xshareclasses/#adjustsoftmx"><code>-Xshareclasses:adjustsoftmx</code></a> cache utility or the <code>MemoryMXBean.setSharedClassCacheSoftmxBytes()</code> method in the <code>com.ibm.lang.management</code> API. For more information, see <a href="../xscmx/#setting-a-soft-maximum-size">Setting a soft maximum size</a>.</p>
</li>
</ul>
<h3 id="creating-layer-caches">Creating layer caches</h3>
<p>Creating a layered cache might be useful when you are building a Docker image.</p>
<p>Normally, writing to an existing shared cache in a lower image layer results in Docker duplicating the shared cache to the top layer (following the Docker <a href="https://docs.docker.com/storage/storagedriver/#the-copy-on-write-cow-strategy">copy-on-write strategy</a>). With a layered cache, you can instead write into a new cache in the top layer. The new cache builds on the existing cache, so space is saved in the image.</p>
<dl>
<dt>The following example shows a Docker container with four layers:</dt>
<dd>
<p><img alt="This diagram is explained in the surrounding text" src="../cr/shrc_layers.png" title="Docker container with layered caches" /></p>
</dd>
</dl>
<ol>
<li>The lowest layer is a Ubuntu Docker image.</li>
<li>
<p>The next layer is an OpenJ9 Docker image that is built on the Ubuntu image. As part of this image, the <code>-Xshareclasses:name=MyCache</code> suboption is used to create a cache called <code>MyCache</code>. The layer number assigned to this cache is <code>0</code>. The <code>listAllCaches</code> suboption shows the cache and the layer number:</p>
<pre><code>java -Xshareclasses:listAllCaches
...
Cache name level cache-type feature layer OS shmid OS semid last detach time
Compatible shared caches
MyCache Java8 64-bit persistent cr 0 Mon Sep 23 11:41:04 2019
</code></pre>
</li>
<li>
<p>The next Docker layer up is a middleware image that is built on the OpenJ9 image. As part of this image, the <code>-Xshareclasses:name=MyCache,layer=1</code> suboption is used to create another cache called <code>MyCache</code>. Because the <code>layer=1</code> suboption is specified, this new cache is a layered cache, which builds on <code>MyCache</code> in the previous container layer. (Open Liberty starts two VMs, so if you instead use the <code>createLayer</code> suboption here, two layered caches are created, with layer numbers of 1 and 2.) Note that cache layers are different from, and independent of, container layers.</p>
</li>
<li>
<p>In the same way, another Docker layer is added for an application, and another layered cache is created to add to <code>MyCache</code>. The <code>listAllCaches</code> suboption now shows all the caches and their layers:</p>
<pre><code>java -Xshareclasses:listAllCaches
...
Cache name level cache-type feature layer OS shmid OS semid last detach time
Compatible shared caches
MyCache Java8 64-bit persistent cr 0 Mon Sep 23 11:41:04 2019
MyCache Java8 64-bit persistent cr 1 Mon Sep 23 11:46:25 2019
MyCache Java8 64-bit persistent cr 2 In use
</code></pre>
</li>
</ol>
<p>The caches are created in the same directory.</p>
<p>When you use the <code>-Xshareclasses:name=MyCache</code> suboption in future Java commands, all the caches are started. The top-layer cache is started in read/write mode, and lower-layer caches are started in read-only mode. Modifying a lower-layer cache will invalidate all the caches in the layers above.</p>
<p>The following options and cache utilities are available for creating, managing, and removing layered caches:</p>
<ul>
<li><a href="../xshareclasses/#createlayer"><code>-Xshareclasses:createLayer</code></a></li>
<li><a href="../xshareclasses/#layer"><code>-Xshareclasses:layer</code></a></li>
<li><a href="../xshareclasses/#printtoplayerstats"><code>-Xshareclasses:printTopLayerStats</code></a> (for example output, see <a href="../shrc_diag_util/#printtoplayerstats">printTopLayerStats</a>)</li>
<li><a href="../xshareclasses/#destroyalllayers"><code>-Xshareclasses:destroyAllLayers</code></a></li>
</ul>
<h2 id="saving-a-non-persistent-shared-classes-cache">Saving a non-persistent shared classes cache</h2>
<p>As described in an earlier section, a shared classes cache can be persistent or non-persistent; persistent caches are memory-mapped files. By default, a cache is persistent on all platforms, except z/OS. Non-persistent caches are stored in shared memory and are removed when a system is rebooted. If you want to save a non-persistent cache beyond a reboot, you might want to consider taking a cache snapshot.</p>
<p>To create a snapshot of a non-persistent shared classes cache, use the <a href="../xshareclasses/#snapshotcache"><code>-Xshareclasses:snapshotCache</code></a> cache utility. The snapshot has the same name and location as the shared cache, as specified by the <code>name</code> and <code>cacheDir</code> suboptions. The shared cache can be in use when the snapshot is taken, but VMs are blocked when they try to write to the shared cache while the cache data is copied to the file.</p>
<p>Typically, after a system is reinitialized, the snapshot file is used to restore the copy of the non-persistent cache into shared memory, by using the <a href="../xshareclasses/#restorefromsnapshot"><code>-Xshareclasses:restoreFromSnapshot</code></a> cache utility. Because this process removes all non-persistent caches from shared memory, restoring the cache from the snapshot file can result in better VM startup performance, because the contents of the shared cache, including classes and AOT code, do not have to be re-created.</p>
<p>The <a href="../xshareclasses/#listallcaches"><code>-Xshareclasses:listAllCaches</code></a> cache utility can be used to identify snapshots on a system.</p>
<p>A snapshot can be created only if the user has sufficient permissions to create the destination snapshot file. If a snapshot of the same name exists already, it is overwritten. On platforms that support persistent caches, the <code>nonpersistent</code> suboption must be specified in order to create a snapshot. For information about removing snapshot files, see the <code>destroySnapshot</code> and <code>destroyAllSnapshots</code> cache utilities in <a href="#housekeeping">Housekeeping</a>.</p>
<p><span aria-hidden="true" class="twemoji note"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="m497.9 142.1-46.1 46.1c-4.7 4.7-12.3 4.7-17 0l-111-111c-4.7-4.7-4.7-12.3 0-17l46.1-46.1c18.7-18.7 49.1-18.7 67.9 0l60.1 60.1c18.8 18.7 18.8 49.1 0 67.9zM284.2 99.8 21.6 362.4.4 483.9c-2.9 16.4 11.4 30.6 27.8 27.8l121.5-21.3 262.6-262.6c4.7-4.7 4.7-12.3 0-17l-111-111c-4.8-4.7-12.4-4.7-17.1 0zM124.1 339.9c-5.5-5.5-5.5-14.3 0-19.8l154-154c5.5-5.5 14.3-5.5 19.8 0s5.5 14.3 0 19.8l-154 154c-5.5 5.5-14.3 5.5-19.8 0zM88 424h48v36.3l-64.5 11.3-31.1-31.1L51.7 376H88v48z"/></svg></span> <strong>Notes:</strong></p>
<ul>
<li>Persistent caches are not supported on z/OS.</li>
<li>The <code>snapshotCache</code> and <code>restoreFromCache</code> cache utilities cannot be used on Windows systems.</li>
</ul>
<h2 id="housekeeping">Housekeeping</h2>
<p>Caches can be deleted if they contain many stale classes or if the cache is full and you want to create a bigger cache. Use one of the following utilities to remove unwanted caches:</p>
<ul>
<li><a href="../xshareclasses/#destroy"><code>-Xshareclasses:destroy</code></a>: Removes specific caches when used with the <code>name</code>, <code>cacheDir</code>, and <code>nonpersistent</code> suboptions.</li>
<li><a href="../xshareclasses/#destroyall"><code>-Xshareclasses:destroyAll</code></a>: Removes all the caches that are specified by the <code>cacheDir</code> and <code>nonpersistent</code> suboptions.</li>
<li><a href="../xshareclasses/#destroysnapshot"><code>-Xshareclasses:destroySnapshot</code></a>: Removes a cache snapshot from disk that is specified by <code>name</code> and <code>cacheDir</code> suboptions.</li>
<li><a href="../xshareclasses/#destroyallsnapshots"><code>-Xshareclasses:destroyAllSnapshots</code></a>: Removes all cache snapshots from disk that are found by specifying the <code>cacheDir</code> suboption.</li>
<li><a href="../xshareclasses/#destroyalllayers"><code>-Xshareclasses:destroyAllLayers</code></a>: Removes all shared cache layers that are specified by the <code>name</code> and <code>cacheDir</code> suboptions.</li>
</ul>
<p><span aria-hidden="true" class="twemoji note"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="m497.9 142.1-46.1 46.1c-4.7 4.7-12.3 4.7-17 0l-111-111c-4.7-4.7-4.7-12.3 0-17l46.1-46.1c18.7-18.7 49.1-18.7 67.9 0l60.1 60.1c18.8 18.7 18.8 49.1 0 67.9zM284.2 99.8 21.6 362.4.4 483.9c-2.9 16.4 11.4 30.6 27.8 27.8l121.5-21.3 262.6-262.6c4.7-4.7 4.7-12.3 0-17l-111-111c-4.8-4.7-12.4-4.7-17.1 0zM124.1 339.9c-5.5-5.5-5.5-14.3 0-19.8l154-154c5.5-5.5 14.3-5.5 19.8 0s5.5 14.3 0 19.8l-154 154c-5.5 5.5-14.3 5.5-19.8 0zM88 424h48v36.3l-64.5 11.3-31.1-31.1L51.7 376H88v48z"/></svg></span> <strong>Note:</strong> You must always use the utilities to remove non-persistent caches correctly from shared memory.</p>
<p>Caches can also be removed if they are unused for a specified amount of time. To configure time-based housekeeping, use the <a href="../xshareclasses/#expire">-Xshareclasses:expire</a> option.</p>
<p>If you want to remove a cache but allow it to be re-created when the VM restarts, use the <a href="../xshareclasses/#reset"><code>-Xshareclasses:reset</code></a> option.</p>
<h2 id="support-for-custom-class-loaders">Support for custom class loaders</h2>
<p>Classes are shared by the bootstrap class loader internally in the VM. The OpenJ9 implementation of <code>java.net.URLClassLoader</code> is modified to use <code>SharedClassURLClasspathHelper</code> and any class loaders that extend <code>java.net.URLClassLoader</code> can inherit this behavior. If you are using a custom class loader that does not extend <code>java.net.URLClassLoader</code>, you can use the Java Helper API to find and store classes in a shared classes cache.</p>
<p>If a running application uses its own class loader and you are using a <code>SecurityManager</code>, you must grant the class loader permission to <code>SharedCachePermission</code> before they can share classes. To grant permission, add shared class permissions to the <code>java.policy</code> file by specifying the <code>ClassLoader</code> class name. Permissions can be set for <code>read</code>, <code>write</code>, or <code>read,write</code>. For example:</p>
<pre><code>permission com.ibm.oti.shared.SharedClassPermission
&quot;com.abc.customclassloaders.*&quot;, &quot;read,write&quot;;
</code></pre>
<p>If a running application is calling the <code>com.ibm.oti.shared.SharedClassUtilities</code> APIs <code>getSharedCacheInfo()</code> or <code>destroySharedCache()</code>, you must also grant the code calling these APIs the appropriate <code>SharedClassesNamedPermission</code>. For example:</p>
<pre><code>permission com.ibm.oti.shared.SharedClassesNamedPermission &quot;getSharedCacheInfo&quot;;
permission com.ibm.oti.shared.SharedClassesNamedPermission &quot;destroySharedCache&quot;;
</code></pre>
<h3 id="the-java-shared-classes-helper-api">The Java shared classes Helper API</h3>
<p>The Java Helper API classes can be found in the <a href="../api-overview/#monitoring-and-management"><code>com.ibm.oti.shared</code></a> package.</p>
<p>Each class loader that wants to share classes must get a <code>SharedClassHelper</code> object from a <code>SharedClassHelperFactory</code>. The <code>SharedClassHelper</code>, when created, has a one to one relationship with the class loader. That is, it belongs to the class loader that requested it and can only store classes defined by that class loader. The <code>SharedClassHelper</code> gives the class loader a simple API for finding and storing classes in the class cache to which the VM is connected. If the class loader is garbage collected, its <code>SharedClassHelper</code> is also garbage collected.</p>
<p>The following main functions are available from the <code>SharedClassHelper</code> API:</p>
<ul>
<li><code>findSharedClass</code>: Used to check whether a class is already in the cache before looking for the class on the file system.</li>
<li><code>storeSharedClass</code>: Used to store a class in the cache.</li>
<li><code>setSharingFilter</code>: A filter that can be used to decide which classes are found and stored in the cache. This filter can be applied to a particular package by implementing the <code>SharedClassFilter</code> interface. To apply a filter to all non-bootstrap class loaders that share classes, specify the <a href="../dcomibmotisharedsharedclassglobalfilterclass/"><code>-Dcom.ibm.oti.shared.SharedClassGlobalFilterClass</code></a> system property on the command line.</li>
</ul>
<p>You can also define partitions in a cache to store sets of classes separately from one another. For more information see <a href="#sharedclasshelper-cache-partitions"><code>SharedClassHelper</code> cache partitions</a>.</p>
<p>Each class loader that wants to share data must get a <code>SharedDataHelper</code> object from a <code>SharedDataHelperFactory</code>.
A <code>SharedDataHelperFactory</code> provides an interface that can be used to create <code>SharedDataHelpers</code>, which are used for storing Java byte array data. A <code>SharedDataHelper</code> also has a one to one relationship with a class loader, although a class loader can exist without a <code>SharedDataHelper</code>.</p>
<h3 id="the-java-shared-classes-utility-api">The Java shared classes utility API</h3>
<p>The following APIs are available for obtaining information about a shared classes cache:</p>
<ul>
<li><code>com.ibm.oti.shared.SharedClassStatistics</code>: Obtains information about cache size, including free space, soft maximum limit, and the limits enforced for AOT and JIT data.</li>
<li><code>com.ibm.oti.shared.SharedClassUtilities</code>: Obtains detailed information about a shared classes cache, including its size, name, type, and status.</li>
<li><code>com.ibm.oti.shared.SharedClassCacheInfo</code>: Stores information about a shared classes cache and provides API methods to retrieve the information and remove caches. You can also use the <code>IterateSharedCaches</code> and <code>DestroySharedCache</code> <a href="../interface_jvmti/#iteratesharedcaches">JVMTI extensions</a>.</li>
</ul>
<h2 id="support-for-bytecode-instrumentation">Support for bytecode instrumentation</h2>
<p>Modifying the bytecode of a set of classes at runtime is a useful mechanism for adding functions to a program, such as profiling or debugging. The JVM Tools Interface (JVMTI) includes hooks that allow you to instrument the byte code in this way. Alternatively, you can write your own Java agent that uses the <code>java.lang.instrument</code> API. Sharing classes that are changed before they are loaded adds complexity to the class sharing process.</p>
<p>By default, if OpenJ9 detects that a JVMTI agent or <code>java.lang.instrument</code> agent has registered to modify class bytes, modified classes are not stored in the cache. Instead, the VM stores original class byte data in the cache, which allows classes to be retransformed.</p>
<p>If you turn off bytecode instrumentation support by specifying <a href="../xshareclasses/#disablebci"><code>-Xshareclasses:disableBCI</code></a> and do not use a <em>modification context</em> to share modified classes safely, all bytecode is loaded from the file system for the agent to modify. When passed to the cache for storing, the VM compares the bytes with known classes of the same name. If a match is found, the class is reused. However, if a match is not found, the potentially modified class is stored in the cache in a way that prevents other VMs from loading it. In this situation, performance can be affected because the bytecode is always loaded from the file system and compared with existing classes in the cache. When bytecode instrumentation is turned off, classes loaded from the shared cache cannot be retransformed.
For more information about using a modification context, see <a href="#sharing-modified-bytecode">Sharing modified bytecode</a>.</p>
<h3 id="redefined-and-retransformed-classes">Redefined and retransformed classes</h3>
<p>The following rules exist for classes that are redefined or retransformed by JVMTI or <code>java.lang.instrument</code> agents:</p>
<ul>
<li>
<p>Redefined classes contain replacement bytecode that is provided by an agent at run time by using the JVMTI <code>RedefineClasses</code> or <code>Instrumentation.redefineClasses</code> function. A typical use case is for debugging, where function is added for log output. These classes are never stored in the cache.</p>
</li>
<li>
<p>Retransformed classes contain bytecode that can be changed without any reference to the original bytecode by using the JVMTI <code>RetransformClasses</code> or <code>Instrumentation.retransformClasses</code> functions. A typical use case is a profiling agent that adds or removes profiling calls with each retransformation. These classes can be modified multiple times and are not stored in the cache by default. If you want to store these modified classes for reuse, you can do so by setting the <a href="../xshareclasses/#cacheretransformed"><code>-Xshareclasses:cacheRetransformed</code></a> suboption when you start your application. This option turns off bytecode instrumentation support, forcing cache creation into <a href="../xshareclasses/#disablebci"><code>-Xshareclasses:disableBCI</code></a> mode. </p>
</li>
</ul>
<h3 id="sharing-modified-bytecode">Sharing modified bytecode</h3>
<p>Sharing modified bytecode can be advantageous for applications that use the same modifications because the transformation process needs to happen only once. OpenJ9 allows multiple VMs that are using the same or different types of class modifications to safely share the cache. However, when a class is modified and cached, it cannot be modified (retransformed) further.</p>
<p>Modified bytecode can be shared safely by using a <em>modification context</em>. Use the <a href="../xshareclasses/#disablebci"><code>-Xshareclasses:disableBCI</code></a> and <a href="../xshareclasses/#modified"><code>-Xshareclasses:modified=&lt;modified_context&gt;</code></a> suboptions when you start your application, where <code>&lt;modified_context&gt;</code> is a user-defined description. The cache is structured so that any VM that is started with the same modification context can share the classes in a private area. The following outcomes apply to VMs that do not want to share the modified classes:</p>
<ul>
<li>A VM that is started without specifying a modification context shares classes outside of that area as normal.</li>
<li>A VM that is started with a different modification context, shares classes in its own private area.</li>
</ul>
<h4 id="sharedclasshelper-cache-partitions"><code>SharedClassHelper</code> cache partitions</h4>
<p>Another method of structuring and protecting classes in the shared classes cache can be implemented by using the <code>SharedClassHelper</code> API with a custom class loader. This mechanism creates partitions by using a string key to identify a set of classes, which can be stored and retrieved by the class loader. A use case for this mechanism is Aspect Oriented Programming (AOP) where aspects are woven in to bytecode when a class is loaded into the VM. Being able to partition the cache provides a suitable level of granularity when you want to use different aspect paths.</p>
<p>Although it is possible to combine partitions and modification contexts, this practice is not recommended because the cache will contain partitions within partitions.</p>
<p><span aria-hidden="true" class="twemoji note"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="m497.9 142.1-46.1 46.1c-4.7 4.7-12.3 4.7-17 0l-111-111c-4.7-4.7-4.7-12.3 0-17l46.1-46.1c18.7-18.7 49.1-18.7 67.9 0l60.1 60.1c18.8 18.7 18.8 49.1 0 67.9zM284.2 99.8 21.6 362.4.4 483.9c-2.9 16.4 11.4 30.6 27.8 27.8l121.5-21.3 262.6-262.6c4.7-4.7 4.7-12.3 0-17l-111-111c-4.8-4.7-12.4-4.7-17.1 0zM124.1 339.9c-5.5-5.5-5.5-14.3 0-19.8l154-154c5.5-5.5 14.3-5.5 19.8 0s5.5 14.3 0 19.8l-154 154c-5.5 5.5-14.3 5.5-19.8 0zM88 424h48v36.3l-64.5 11.3-31.1-31.1L51.7 376H88v48z"/></svg></span> <strong>Note:</strong> Partitions are not supported by the bootstrap class loader or the default application class loader.</p>
<h2 id="see-also">See also</h2>
<ul>
<li><a href="../aot/">AOT compiler</a></li>
<li><a href="https://developer.ibm.com/languages/java/tutorials/j-class-sharing-openj9/">Class sharing article</a></li>
<li><a href="../shrc_diag_util/">Diagnosing problems with class data sharing</a></li>
</ul>
<!-- ==== END OF TOPIC ==== shrc.md ==== -->
</article>
</div>
</div>
</main>
<!--
* Copyright (c) 2017, 2021 IBM Corp. and others
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution and is available at
* https://www.eclipse.org/legal/epl-2.0/ or the Apache
* License, Version 2.0 which accompanies this distribution and
* is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* This Source Code may also be made available under the
* following Secondary Licenses when the conditions for such
* availability set forth in the Eclipse Public License, v. 2.0
* are satisfied: GNU General Public License, version 2 with
* the GNU Classpath Exception [1] and GNU General Public
* License, version 2 with the OpenJDK Assembly Exception [2].
*
* [1] https://www.gnu.org/software/classpath/license.html
* [2] http://openjdk.java.net/legal/assembly-exception.html
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH
* Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
-->
<footer class="md-footer">
<div class="md-footer-meta">
<!-- Add following links ...................................... -->
<div class="above-line">
<div class="above-line-links">
<div class="column">
<h3 >Docs</h3>
<span class="footer-link"><a href="/openj9/docs/openj9_newuser/" >New to OpenJ9?</a></span>
<span class="footer-link"><a href="/openj9/docs/introduction/">Getting started</a></span>
<span class="footer-link"><a href="/openj9/docs/cmdline_specifying/">Command-line options</a></span>
</div>
<div class="column">
<h3>Resources</h3>
<span class="footer-link"><a href="https://www.eclipse.org/openj9/about/" rel="noopener noreferrer" target="_blank">About</a></span>
<span class="footer-link"><a href="https://www.eclipse.org/openj9/performance/" rel="noopener noreferrer" target="_blank">Performance</a></span>
</div>
<div class="column">
<h3 >Community</h3>
<span class="footer-link"><a href="https://www.eclipse.org/openj9/news/" rel="noopener noreferrer" target="_blank">News</a></span>
<span class="footer-link"><a href="https://blog.openj9.org/" rel="noopener noreferrer" target="_blank">Blogs</a></span>
</div>
</div>
<div class="column-incubator">
<div class="arrange-column">
<h3 ><b>OpenJ9 is an Eclipse Incubator project</b></h3>
<a class="incubator-image" href="http://wiki.eclipse.org/Development_Resources/Process_Guidelines/What_is_Incubation" target="_blank"><img width="50px" src="../cr/incubator-logo.svg" alt="Eclipse Incubation"></a>
</div>
</div>
</div>
<div class="horizontal-line"></div>
<div class="below-line">
<span class="below-line-links"><a href="https://www.eclipse.org/" rel="noopener noreferrer" target="_blank">Eclipse Foundation Website </a></span>
<span class="below-line-links"><a href="https://www.eclipse.org/legal/privacy.php" rel="noopener noreferrer" target="_blank">Privacy Policy</a></span>
<span class="below-line-links"><a href="https://www.eclipse.org/legal/termsofuse.php" rel="noopener noreferrer" target="_blank">Terms of Use</a></span>
<span class="below-line-links"><a href="https://www.eclipse.org/legal/copyright.php" rel="noopener noreferrer" target="_blank">Copyright Agent</a></span>
<span class="below-line-links"><a href="https://www.eclipse.org/legal/" rel="noopener noreferrer" target="_blank">Legal</a></span>
<div class="below-line-social-media-icons">
<div class="md-footer-social">
<a href="https://github.com/eclipse-openj9/openj9" target="_blank" rel="noopener" title="OpenJ9 in GitHub" class="md-footer-social__link">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"/></svg>
</a>
<a href="https://openj9.slack.com" target="_blank" rel="noopener" title="OpenJ9 on Slack" class="md-footer-social__link">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M94.12 315.1c0 25.9-21.16 47.06-47.06 47.06S0 341 0 315.1c0-25.9 21.16-47.06 47.06-47.06h47.06v47.06zm23.72 0c0-25.9 21.16-47.06 47.06-47.06s47.06 21.16 47.06 47.06v117.84c0 25.9-21.16 47.06-47.06 47.06s-47.06-21.16-47.06-47.06V315.1zm47.06-188.98c-25.9 0-47.06-21.16-47.06-47.06S139 32 164.9 32s47.06 21.16 47.06 47.06v47.06H164.9zm0 23.72c25.9 0 47.06 21.16 47.06 47.06s-21.16 47.06-47.06 47.06H47.06C21.16 243.96 0 222.8 0 196.9s21.16-47.06 47.06-47.06H164.9zm188.98 47.06c0-25.9 21.16-47.06 47.06-47.06 25.9 0 47.06 21.16 47.06 47.06s-21.16 47.06-47.06 47.06h-47.06V196.9zm-23.72 0c0 25.9-21.16 47.06-47.06 47.06-25.9 0-47.06-21.16-47.06-47.06V79.06c0-25.9 21.16-47.06 47.06-47.06 25.9 0 47.06 21.16 47.06 47.06V196.9zM283.1 385.88c25.9 0 47.06 21.16 47.06 47.06 0 25.9-21.16 47.06-47.06 47.06-25.9 0-47.06-21.16-47.06-47.06v-47.06h47.06zm0-23.72c-25.9 0-47.06-21.16-47.06-47.06 0-25.9 21.16-47.06 47.06-47.06h117.84c25.9 0 47.06 21.16 47.06 47.06 0 25.9-21.16 47.06-47.06 47.06H283.1z"/></svg>
</a>
<a href="https://twitter.com/openj9" target="_blank" rel="noopener" title="OpenJ9 on Twitter" class="md-footer-social__link">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828 46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 60.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z"/></svg>
</a>
<a href="https://stackoverflow.com/search?q=OpenJ9" target="_blank" rel="noopener" title="OpenJ9 on StackOverflow" class="md-footer-social__link">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M290.7 311 95 269.7 86.8 309l195.7 41zm51-87L188.2 95.7l-25.5 30.8 153.5 128.3zm-31.2 39.7L129.2 179l-16.7 36.5L293.7 300zM262 32l-32 24 119.3 160.3 32-24zm20.5 328h-200v39.7h200zm39.7 80H42.7V320h-40v160h359.5V320h-40z"/></svg>
</a>
</div>
</div>
</div>
<!-- End of added links........................................ -->
<!--
<div class="md-footer-social">
<a href="https://github.com/eclipse-openj9/openj9" target="_blank" rel="noopener" title="OpenJ9 in GitHub" class="md-footer-social__link">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"/></svg>
</a>
<a href="https://openj9.slack.com" target="_blank" rel="noopener" title="OpenJ9 on Slack" class="md-footer-social__link">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M94.12 315.1c0 25.9-21.16 47.06-47.06 47.06S0 341 0 315.1c0-25.9 21.16-47.06 47.06-47.06h47.06v47.06zm23.72 0c0-25.9 21.16-47.06 47.06-47.06s47.06 21.16 47.06 47.06v117.84c0 25.9-21.16 47.06-47.06 47.06s-47.06-21.16-47.06-47.06V315.1zm47.06-188.98c-25.9 0-47.06-21.16-47.06-47.06S139 32 164.9 32s47.06 21.16 47.06 47.06v47.06H164.9zm0 23.72c25.9 0 47.06 21.16 47.06 47.06s-21.16 47.06-47.06 47.06H47.06C21.16 243.96 0 222.8 0 196.9s21.16-47.06 47.06-47.06H164.9zm188.98 47.06c0-25.9 21.16-47.06 47.06-47.06 25.9 0 47.06 21.16 47.06 47.06s-21.16 47.06-47.06 47.06h-47.06V196.9zm-23.72 0c0 25.9-21.16 47.06-47.06 47.06-25.9 0-47.06-21.16-47.06-47.06V79.06c0-25.9 21.16-47.06 47.06-47.06 25.9 0 47.06 21.16 47.06 47.06V196.9zM283.1 385.88c25.9 0 47.06 21.16 47.06 47.06 0 25.9-21.16 47.06-47.06 47.06-25.9 0-47.06-21.16-47.06-47.06v-47.06h47.06zm0-23.72c-25.9 0-47.06-21.16-47.06-47.06 0-25.9 21.16-47.06 47.06-47.06h117.84c25.9 0 47.06 21.16 47.06 47.06 0 25.9-21.16 47.06-47.06 47.06H283.1z"/></svg>
</a>
<a href="https://twitter.com/openj9" target="_blank" rel="noopener" title="OpenJ9 on Twitter" class="md-footer-social__link">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828 46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 60.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z"/></svg>
</a>
<a href="https://stackoverflow.com/search?q=OpenJ9" target="_blank" rel="noopener" title="OpenJ9 on StackOverflow" class="md-footer-social__link">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path d="M290.7 311 95 269.7 86.8 309l195.7 41zm51-87L188.2 95.7l-25.5 30.8 153.5 128.3zm-31.2 39.7L129.2 179l-16.7 36.5L293.7 300zM262 32l-32 24 119.3 160.3 32-24zm20.5 328h-200v39.7h200zm39.7 80H42.7V320h-40v160h359.5V320h-40z"/></svg>
</a>
</div>
-->
</div>
</footer>
</div>
<div class="md-dialog" data-md-component="dialog">
<div class="md-dialog__inner md-typeset"></div>
</div>
<script id="__config" type="application/json">{"base": "..", "features": [], "translations": {"clipboard.copy": "Copy to clipboard", "clipboard.copied": "Copied to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.placeholder": "Search", "search.result.placeholder": "Type to start searching", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.term.missing": "Missing"}, "search": "../assets/javascripts/workers/search.4fa0e4ee.min.js", "version": 2.0}</script>
<script src="../assets/javascripts/bundle.1d3bfcf1.min.js"></script>
<script src="../javascripts/oj9.js"></script>
</body>
</html>