JDK-6875866 : Intrinsic for String.indexOf() is broken on x86 with SSE4.2
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: hs16
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris
  • CPU: x86
  • Submitted: 2009-08-26
  • Updated: 2012-08-20
  • Resolved: 2011-03-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
JDK 6 JDK 7 Other
6u18Fixed 7Fixed hs16Fixed
Related Reports
Relates :  
Relates :  
Description
Implementation of String.indexOf() intrinsic using SSE 4.2 instructions is incorrect.
The regression is introduced by 6761600 in HS15_b05 so jdk6u14p, jdk6u18 and JDK7 are affected.

% cat Test.java
public class Test {

  static int IndexOfTest(String str) {
    return str.indexOf("11111xx1x");
  }

  public static void main(String args[]) {
    String str = "11111xx11111xx1x";
    int idx = IndexOfTest(str);  
    System.out.println("IndexOf = " + idx);
  }
}

% /java/re/jdk/6u14/promoted/p/b03/binaries/solaris-amd64/bin/java -d64 -Xcomp Test
IndexOf = -1

% /java/re/jdk/6u18/promoted/latest/binaries/solaris-i586/bin/java -Xcomp Test
IndexOf = -1
i% /java/re/jdk/6u18/promoted/latest/binaries/solaris-amd64/bin/java -d64 -Xcomp Test
IndexOf = -1
% /java/re/jdk/6u18/promoted/latest/binaries/solaris-i586/bin/java  -XX:-UseSSE42Intrinsics -Xcomp Test
IndexOf = 7

Comments
EVALUATION http://hg.openjdk.java.net/jdk7/hotspot-comp/hotspot/rev/62001a362ce9
2009-09-15

EVALUATION http://hg.openjdk.java.net/hsx/hsx16/master/rev/9f00229d78ce
2009-09-04

PUBLIC COMMENTS Problem: String.indexOf SSE4.2 code starts string rescanning from a wrong place after failing to match a part of substring. Solution: Start from the next element after the previous match.
2009-08-26

EVALUATION http://hg.openjdk.java.net/hsx/hsx16/baseline/rev/9f00229d78ce
2009-08-26