On Fri, 6 Feb 2026 12:44:51 GMT, Johan Sjölen <[email protected]> wrote:
>> 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.
I moved `cast_from_u4` and `cast_to_u4` to the global scope so they can be used
similarly to `checked_cast()`. To me, `AOTCompressedPointers::cast_to_u4()`
feels unnecessarily verbose.
For the encode/decode functions, I think it's better to leave them inside
`AOTCompressedPointers` to provide a better context. Also, that follows the
patterns in `CompressedPointers` and `CompressedOops`.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29590#discussion_r2775650583