On Fri, 6 Feb 2026 12:38:25 GMT, Johan Sjölen <[email protected]> wrote:
>> AOT cache uses pointer compression to store 64-bit pointers in 32 bits. >> Currently the compression algorithm is simply (base + narrowPtr). However, >> in [JDK-8376125](https://bugs.openjdk.org/browse/JDK-8376125), we may change >> it to (base + narrowPtr << 3). >> >> This RFE changed the encoded pointer from an u4 to (thanks to @jdksjolen for >> the idea): >> >> >> enum class narrowPtr : u4; >> >> >> This allows better tracking of where the encoded pointers are stored. Also, >> we can distinguish between byte offsets vs encoded pointers -- they >> currently have the same numerical values but after >> [JDK-8376125](https://bugs.openjdk.org/browse/JDK-8376125), they will be >> different. >> >> Also minor clean up in ArchiveBuilder to change some `uintx` to `size_t`, >> which is used by `pointer_delta()`. > > src/hotspot/share/cds/aotCompressedPointers.hpp line 169: > >> 167: inline u4 to_u4(AOTCompressedPointers::narrowPtr narrowp) { >> 168: return cast_from_narrowPtr<u4>(narrowp); >> 169: } > > Seems like `cast_to_narrowPtr` could do with a `from_u4` analogue, and the > only usage of the cast_to_narrowPtr can actually be replaced with that call. > Maybe we don't need those globals, and the `from_` `to_` u4 variants are the > only necessary ones? BTW, you're also saving quite a few keystrokes if you make encode/decode global, but that's up to you. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/29590#discussion_r2773973154
