mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 03:58:21 +00:00
8360271: String.indexOf intrinsics fail with +EnableX86ECoreOpts and -CompactStrings
Reviewed-by: thartmann, jbhateja, sviswanathan
This commit is contained in:
parent
87cbcadacf
commit
1d889b92bd
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024, 2025, Intel Corporation. All rights reserved.
|
||||
* Copyright (c) 2024, 2026, Intel Corporation. All rights reserved.
|
||||
*
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -1330,10 +1330,12 @@ static void big_case_loop_helper(bool sizeKnown, int size, Label &noMatch, Label
|
||||
// Clarification: The BYTE_K compare above compares haystack[(n-32):(n-1)]. We need to
|
||||
// compare haystack[(k-1):(k-1+31)]. Subtracting either index gives shift value of
|
||||
// (k + 31 - n): x = (k-1+31)-(n-1) = k-1+31-n+1 = k+31-n.
|
||||
// When isU is set, similarly, shift is from haystack[(n-32):(n-1)] to [(k-2):(k-2+31)]
|
||||
|
||||
if (sizeKnown) {
|
||||
__ movl(temp2, 31 + size);
|
||||
__ movl(temp2, (isU ? 30 : 31) + size);
|
||||
} else {
|
||||
__ movl(temp2, 31);
|
||||
__ movl(temp2, isU ? 30 : 31);
|
||||
__ addl(temp2, needleLen);
|
||||
}
|
||||
__ subl(temp2, hsLength);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2024, Intel Corporation. All rights reserved.
|
||||
* Copyright (c) 2024, 2026, Intel Corporation. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -37,6 +37,15 @@
|
||||
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:-TieredCompilation -XX:UseAVX=2 -XX:+UnlockDiagnosticVMOptions -XX:+EnableX86ECoreOpts IndexOf
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8360271
|
||||
* @summary test String indexOf() intrinsic
|
||||
* @requires vm.cpu.features ~= ".*avx2.*"
|
||||
* @requires vm.compiler2.enabled
|
||||
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:-TieredCompilation -XX:UseAVX=2 -XX:+UnlockDiagnosticVMOptions -XX:+EnableX86ECoreOpts -XX:-CompactStrings IndexOf
|
||||
*/
|
||||
|
||||
public class IndexOf {
|
||||
final int scope = 32*2+16+8;
|
||||
final char a, aa, b, c, d;
|
||||
@ -56,11 +65,11 @@
|
||||
d = 'd';
|
||||
break;
|
||||
case UU:
|
||||
a = '\u0061';
|
||||
a = '\u1061';
|
||||
aa = a;
|
||||
b = '\u0062';
|
||||
b = '\u1062';
|
||||
c = '\u1063';
|
||||
d = '\u0064';
|
||||
d = '\u1064';
|
||||
break;
|
||||
default: //case UL:
|
||||
a = 'a';
|
||||
@ -73,7 +82,7 @@
|
||||
}
|
||||
|
||||
// needle =~ /ab*d/
|
||||
// badNeedle =~ /ab*db*d/
|
||||
// badNeedle =~ /ab*cb*d/
|
||||
interface Append {void append(int pos, char cc);}
|
||||
String newNeedle(int size, int badPosition) {
|
||||
if (size<2) {throw new RuntimeException("Fix testcase "+size);}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user