On Mon, 15 Dec 2025 20:30:51 GMT, Volkan Yazici <[email protected]> wrote:
> Moves input validation checks to Java for `java.lang.StringLatin1`
> intrinsics. While doing so, affected `java.lang.StringUTF16` methods needed
> to be updated due to relaxed checks at intrinsics. The javadocs of the
> touched methods are extensively overhauled.
Mostly comments about new comments.
Also name scoping of VM intrinsic functions.
src/hotspot/share/classfile/vmIntrinsics.hpp line 363:
> 361:
> \
> 362: do_intrinsic(_compressStringC, java_lang_StringUTF16,
> compressS_name, encodeISOArray_signature, F_S) \
> 363: do_name( compressS_name,
> "compress0") \
_compressS_name doesn't seem to follow the naming pattern.
src/java.base/share/classes/java/lang/StringLatin1.java line 112:
> 110: }
> 111:
> 112: // inline_string_equals
Is there a HotSpot specific namespace qualifier that can make it easier to
cross reference this?
Ditto the other hotspot names below.
src/java.base/share/classes/java/lang/StringLatin1.java line 207:
> 205:
> 206: /**
> 207: * Lexicographically compares a Latin-1 string sub-range to a UTF-16
It would be more specific to say it compares a "prefix" since the start is
always 0.
src/java.base/share/classes/java/lang/StringUTF16.java line 398:
> 396:
> 397: /**
> 398: * Exhaustively copies Latin-1 characters from a {@code char} array
The word Exhaustively does not fit here because it stops copying for > 0xff.
Perhaps: "Copies the prefix of Latin-1 characters".
src/java.base/share/classes/java/lang/StringUTF16.java line 457:
> 455: Objects.requireNonNull(src);
> 456: checkBoundsOffCount(srcOff, len, src);
> 457: String.checkBoundsOffCount(dstOff, len, dst.length); //
> Implicit null check on `dst`
This bouncing around between source files for methods of the same name
`checkBoundsOffCout` is bound to confuse the reader.
Be consistent, either now or later, use the local one in this file or remove
the utility method.
src/java.base/share/classes/java/lang/StringUTF16.java line 603:
> 601:
> 602: /**
> 603: * Lexicographically compares a UTF-16 string sub-range to a Latin-1
> one as
It isn't a full sub-range, the start index is 0, use prefix instead.
src/java.base/share/classes/java/lang/StringUTF16.java line 950:
> 948: }
> 949:
> 950:
Extra blank line.
-------------
PR Review: https://git.openjdk.org/jdk/pull/28832#pullrequestreview-3779872520
PR Review Comment: https://git.openjdk.org/jdk/pull/28832#discussion_r2789222662
PR Review Comment: https://git.openjdk.org/jdk/pull/28832#discussion_r2788770299
PR Review Comment: https://git.openjdk.org/jdk/pull/28832#discussion_r2788844019
PR Review Comment: https://git.openjdk.org/jdk/pull/28832#discussion_r2789099768
PR Review Comment: https://git.openjdk.org/jdk/pull/28832#discussion_r2789136344
PR Review Comment: https://git.openjdk.org/jdk/pull/28832#discussion_r2789162215
PR Review Comment: https://git.openjdk.org/jdk/pull/28832#discussion_r2789185291