Skip to content

CAUTION: This site hosts draft documentation for the next release. For published content of the latest release, visit


Use this command line option to choose whether AOT-compiled code should be portable.

This option, when enabled, increases the portability of AOT-compiled code, in the following ways:

  • The code is generated based on a particular set of processor features that ensures the AOT-compiled code to be portable across processors of different microarchitectures. AOT-compiled code generated with this option is guaranteed to be portable across Intel® Sandy Bridge or newer microarchitectures on x86 platforms, IBM® z10 or newer microarchitectures on s390 platforms and IBM POWER8® or newer microarchitectures on POWER platforms.

  • The code is generated to be portable across Eclipse OpenJ9™ VMs that use compressed references and have a heap size of 1 MB to 28 GB (previously, AOT-compiled code could not be shared between VMs that use compressed references and that have different heap sizes). This feature might introduce a small (1-2%) steady-state throughput penalty when compressed references are used and the heap size is between 1 MB and 3 GB.

This feature is particularly relevant for packaging a shared classes cache into a container image (for example, applications deployed on the cloud in the form of Docker containers) due to the following reasons: - The processor on which the container image is built is likely to be different from the processor on which the container is deployed. - In a multi-layered container image where the shared classes cache is multi-layered as well, the AOT-compiled code in shared classes cache will likely come from multiple OpenJ9 VMs with different heap size requirements.


Setting Effect Default
-XX:+PortableSharedCache Enable See notes that follow
-XX:-PortableSharedCache Disable

Default settings

This option is enabled by default in containers. To disable the option in a container, specify -XX:-PortableSharedCache.

The option is disabled by default outside containers. To enable the option outside a container, specify -XX:+PortableSharedCache for the initial JVM instance (when the creation of the shared classes cache happens) as well as for every subsequent instance that makes use of the same shared classes cache.