> I recently noticed a behavioral discrepancy in > jdk.internal.util.ArraysSupport.vectorizedMismatch between the Java > implementation and the platform intrinsic implementations. > > Current behavior > > The Java implementation may leave a tail of elements unchecked, returning the > bitwise complement of the number of remaining elements (i.e., ~remaining). > The x86_64 intrinsic, by contrast, compares all elements and simply returns > -1 when no mismatch is found. > > Proposed change > > This PR refines the Java implementation so that it always compares all > elements and returns -1 when no mismatch is found, matching the x86_64 > intrinsic behavior. > > A regression test is included at > `test/hotspot/jtreg/compiler/intrinsics/VectorizedMismatchReturnDiffTest.java` > which demonstrates the original behavioral difference. > > ## Test > - [x] tier1 test suites on linux x86_64 > - [x] tier1 test suites on linux aarch64 > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai).
Kuai Wei has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains nine additional commits since the last revision: - Use private method as intrinsic candidate - Merge remote-tracking branch 'upstream/master' into refine_mismatch_pr - Fix indent - Recovery comments - Fix copyright header - Check remaining bytes wo temp buffer - change callsites of other java source - recover some comments - 8387812: Refine ArraysSupport.vectorizedMismatch to compare all elements. ------------- Changes: - all: https://git.openjdk.org/jdk/pull/31802/files - new: https://git.openjdk.org/jdk/pull/31802/files/0305db76..ffacc911 Webrevs: - full: https://webrevs.openjdk.org/?repo=jdk&pr=31802&range=06 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=31802&range=05-06 Stats: 240541 lines in 2541 files changed: 219675 ins; 7074 del; 13792 mod Patch: https://git.openjdk.org/jdk/pull/31802.diff Fetch: git fetch https://git.openjdk.org/jdk.git pull/31802/head:pull/31802 PR: https://git.openjdk.org/jdk/pull/31802
