We can remove the following function if we avoid modifying global VM states during CDS static dump.
// We have finished dumping the static archive. At this point, there may be pending VM
// operations. We have changed some global states (such as vmClasses::_klasses) that
// may cause these VM operations to fail. For safety, forget these operations and
// exit the VM directly.
void MetaspaceShared::exit_after_static_dump() {
os::_exit(0);
}
=============================
For example, beforeJDK-8307567, the following function may be called to update vmClasses::_klasses[i] to point to the "buffered copy" of the InstanceKlass.
void vmClasses::metaspace_pointers_do(MetaspaceClosure* it) {
for (auto id : EnumRange<vmClassID>{}) {
it->push(klass_addr_at(id));
}
}
AfterJDK-8307567, vmClasses::_klasses id no longer modified by -Xshare:dump. However, there still seems to be some important VM states that are modified, making it impossible to exit the VM normally.
=================
Benefits of this RFE:
[1] After this RFE is implemented, we can remove some of the MetaspaceShared::unrecoverable_writing_error() calls mentioned inJDK-8306580. This makes the error handling more in-line with other JVM code.
[2] We can perform further ahead-of-time optimization after the CDS archive is created. For example, we could run an AOT compiler to created compiled methods for the classes in the CDS archive.
// We have finished dumping the static archive. At this point, there may be pending VM
// operations. We have changed some global states (such as vmClasses::_klasses) that
// may cause these VM operations to fail. For safety, forget these operations and
// exit the VM directly.
void MetaspaceShared::exit_after_static_dump() {
os::_exit(0);
}
=============================
For example, before
void vmClasses::metaspace_pointers_do(MetaspaceClosure* it) {
for (auto id : EnumRange<vmClassID>{}) {
it->push(klass_addr_at(id));
}
}
After
=================
Benefits of this RFE:
[1] After this RFE is implemented, we can remove some of the MetaspaceShared::unrecoverable_writing_error() calls mentioned in
[2] We can perform further ahead-of-time optimization after the CDS archive is created. For example, we could run an AOT compiler to created compiled methods for the classes in the CDS archive.
- relates to
-
JDK-8306580 Propagate CDS dumping errors instead of directly exiting the VM
- Resolved
-
JDK-8307567 Avoid relocating global roots to metaspaceObjs in CDS dump
- Resolved
-
JDK-8316994 Avoid modifying ClassLoader and Module objects during -Xshare:dump
- Resolved
-
JDK-8306580 Propagate CDS dumping errors instead of directly exiting the VM
- Resolved
(1 links to)