RFR: 8373411: Crash when PrintSharedArchiveAndExit is enabled but shared heap is disabled
Stefan Karlsson
stefank at openjdk.org
Thu Dec 11 08:59:22 UTC 2025
On Thu, 11 Dec 2025 07:17:48 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
> Hold on, how does it crash? I cannot see right away how this would fail:
>
> ```
> size_t StringTable::shared_entry_count() {
> assert(HeapShared::is_loading_mapping_mode(), "should not reach here");
> return _shared_table.entry_count();
> }
>
> class SimpleCompactHashtable {
> ...
> inline size_t entry_count() const {
> return _entry_count;
> }
> ...
> }
>
> static SharedStringTable _shared_table;
> ```
>
> The assert in `StringTable::shared_entry_count()` is likely incomplete too.
That one has been left as-is intentionally. We should never call `shared_entry_count` without having enabled "heap sharing" and "loading mode of heap sharing". If anyone would try to call it without enabling/initializing "loading mode", then we'll get an appropriate assert that the loading mode has not been initialized.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/28741#issuecomment-3640883819
More information about the hotspot-runtime-dev
mailing list