On Tue, 11 Nov 2025 06:43:42 GMT, Jaikiran Pai <[email protected]> wrote:
>> Check whether `osSupport::map_memory` actually succeeded in all compliation
>> modes, instead of crashing shortly after in non-debug builds. Ideally we
>> should fall back to just reading the entire file into memory manually or use
>> seek+read, but this is good enough for now to avoid crashing.
>
> src/java.base/share/native/libjimage/imageFile.cpp line 334:
>
>> 332: // Memory map image (minimally the index.)
>> 333: _index_data = (u1*)osSupport::map_memory(_fd, _name, 0,
>> (size_t)map_size());
>> 334: if (_index_data == nullptr) {
>
> The rest of the code in the `libjimage` library uses `NULL`, including the
> return value in `osSupport::map_memory(...)`. So I think it would be better
> to use `NULL` here for consistency.
I agree, have a mix is annoying. In any case, changing the assert to have it
fail looks right. The jimage file is opened during startup so less likely, but
still possible, that this mmap fails.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28087#discussion_r2521919635