RFR: 8344168: Change Unsafe base offset from int to long
Chen Liang
liach at openjdk.org
Thu Nov 14 15:01:22 UTC 2024
On Thu, 14 Nov 2024 14:41:13 GMT, Glavo <duke at openjdk.org> wrote:
>> The type of the Unsafe base offset constant is int, which may cause overflow when adding int offsets, such as 8343925 (PR #22012). 8343984 (PR #22027) fixes most of the offset overflows in JDK, but ArraysSupport and CRC32C are still unfixed.
>>
>> @liach proposed the idea of changing the Unsafe base offset to long, which is a complete solution to the Unsafe offset overflow. After discussing with @liach, I submitted this PR to implement @liach's idea.
>
> I'm concerned that such a change could have unintended consequences, and perhaps deprecating them and providing new long constants would be a better option.
@Glavo This change only happens to jdk.internal.misc.Unsafe. The values in sun.misc.Unsafe are untouched, and they are already deprecated for removal.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/22095#issuecomment-2476590198
More information about the core-libs-dev
mailing list