On Thu, 30 Jan 2025 00:37:16 GMT, Shaojin Wen <s...@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. > > Shaojin Wen has updated the pull request incrementally with one additional > commit since the last revision: > > copyright Re dougxc: This migration is specific to the Java language. I am not so sure about the C++ counterparts, especially that C++ has unsigned types that can complicate things. Another motivation of the Java change is that unsafe is widely used in the Java codebase so upgrading the type can potentially make future usages safer. For example, this already revealed a misuse of the array base offset in the benchmarks in #23393. ------------- PR Comment: https://git.openjdk.org/jdk/pull/22095#issuecomment-2648951653