There's overlap between HeapShared::can_write() and CDSConfig::is_dumping_heap(). The former can return true while the latter returns false:
https://github.com/openjdk/jdk/blob/8cf0735839727300e446828f4f4a8ef6354a8c7a/src/hotspot/share/cds/cdsConfig.cpp#L531-L534
bool CDSConfig::is_dumping_heap() {
// heap dump is not supported in dynamic dump
return is_dumping_static_archive() && HeapShared::can_write();
}
We have lots of places where "if (HeapShared::can_write())" should be rewritten as "if (CDSConfig::is_dumping_heap())".
Also, all the logic of deciding whether heap objects can be dumped should be consolidated into the CDSConfig class.
https://github.com/openjdk/jdk/blob/8cf0735839727300e446828f4f4a8ef6354a8c7a/src/hotspot/share/cds/cdsConfig.cpp#L531-L534
bool CDSConfig::is_dumping_heap() {
// heap dump is not supported in dynamic dump
return is_dumping_static_archive() && HeapShared::can_write();
}
We have lots of places where "if (HeapShared::can_write())" should be rewritten as "if (CDSConfig::is_dumping_heap())".
Also, all the logic of deciding whether heap objects can be dumped should be consolidated into the CDSConfig class.
- links to
-
Commit(master) openjdk/jdk/b985347c
-
Review(master) openjdk/jdk/23249