The following is no longer correct - static CDS dump (-Xshare:dump) also does not modify the class metadata in place.
https://github.com/openjdk/jdk/blob/a8871f5d26e5cb42c031c7b736ec30b1b147a2bc/src/hotspot/share/runtime/arguments.cpp#L3093-L3102
>>>>>
if (DumpSharedSpaces) {
// Compiler threads may concurrently update the class metadata (such as method entries), so it's
// unsafe with -Xshare:dump (which modifies the class metadata in place). Let's disable
// compiler just to be safe.
//
// Note: this is not a concern for dynamically dumping shared spaces, which makes a copy of the
// class metadata instead of modifying them in place. The copy is inaccessible to the compiler.
// TODO: revisit the following for the static archive case.
set_mode_flags(_int);
}
<<<<<<
This RFE makes it possible for the user to enable the JIT compiler during the CDS dump by specifying "-Xshare:dump -Xmixed"
By default, -Xshare:dump runs with -Xint. This maintains the previous behavior.
Which mode to use?
- Dumping in -Xint mode is faster when the classlist is small. -Xint is also required for deterministic dumping (compiler threads can cause symbols to have unstable addresses).
- However, dumping in -Xmixed mode is faster when the class list is larger. We also need to run the compiler in Leyden so that we can generate the CDS archive and AOT code at the same time.
https://github.com/openjdk/jdk/blob/a8871f5d26e5cb42c031c7b736ec30b1b147a2bc/src/hotspot/share/runtime/arguments.cpp#L3093-L3102
>>>>>
if (DumpSharedSpaces) {
// Compiler threads may concurrently update the class metadata (such as method entries), so it's
// unsafe with -Xshare:dump (which modifies the class metadata in place). Let's disable
// compiler just to be safe.
//
// Note: this is not a concern for dynamically dumping shared spaces, which makes a copy of the
// class metadata instead of modifying them in place. The copy is inaccessible to the compiler.
// TODO: revisit the following for the static archive case.
set_mode_flags(_int);
}
<<<<<<
This RFE makes it possible for the user to enable the JIT compiler during the CDS dump by specifying "-Xshare:dump -Xmixed"
By default, -Xshare:dump runs with -Xint. This maintains the previous behavior.
Which mode to use?
- Dumping in -Xint mode is faster when the classlist is small. -Xint is also required for deterministic dumping (compiler threads can cause symbols to have unstable addresses).
- However, dumping in -Xmixed mode is faster when the class list is larger. We also need to run the compiler in Leyden so that we can generate the CDS archive and AOT code at the same time.