On Tue, 18 Jul 2023 01:26:55 GMT, 温绍锦 <d...@openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/Integer.java line 528: >> >>> 526: i = q; >>> 527: charPos -= 2; >>> 528: UNSAFE.putShortUnaligned(buf, >>> Unsafe.ARRAY_BYTE_BASE_OFFSET + charPos, PACKED_DIGITS[r], false); >> >> When switching to use Unsafe, `getChars` should do the array bounds check in >> the loop of the store index. > > The value range of the r variable is 0-99, and the length of PACKED_DIGITS is > 100, There is no need to check the array boundary here. I think he means to check the `charPos` to ensure it is not out of bounds. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14699#discussion_r1266080264