RFR: 8368333: [lworld] Add preview mode to ImageReader and JRT file-system [v7]
Roger Riggs
rriggs at openjdk.org
Thu Oct 23 15:51:14 UTC 2025
On Wed, 22 Oct 2025 19:35:37 GMT, David Beaumont <duke at openjdk.org> wrote:
>> src/java.base/share/classes/jdk/internal/jimage/ImageStrings.java line 38:
>>
>>> 36: // String offset constants are useful for efficient classification
>>> 37: // of location entries without string comparison. These may change
>>> 38: // between jimage versions (they are checked during initialization).
>>
>> The checking seem only to be done when ImageStringsWriter is loaded/initialized.
>> There may be a small risk that a mismatch of the image with the ImageStringsReader could occur.
>> Can they be checked also by the reader?
>
> Hmm, I don't see a nice way to do this at runtime since you can't lookup string offsets by their value (as far as I can see).
>
> It's no more fragile than the old code (which had hard-coded constants for "class" and "" (and wasn't self-checking their validity). At least now it's tested at build time.
>
> If the version number matches it should be safe. I'll add a comment about how changing existing entries is problematic.
Seems unlikely to mismatch.
ImageStringReader.match(offset, string, indxe) could be used to check the Strings or ImageStringReader.get(offset).
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/1619#discussion_r2455711286
More information about the valhalla-dev
mailing list