United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6636352 Unit tests for supplementary character support fail with -XX:+AggressiveOpts
JDK-6636352 : Unit tests for supplementary character support fail with -XX:+AggressiveOpts

Details
Type:
Bug
Submit Date:
2007-12-01
Status:
Closed
Updated Date:
2011-03-07
Project Name:
JDK
Resolved Date:
2011-03-07
Component:
hotspot
OS:
solaris_10,solaris_nevada
Sub-Component:
compiler
CPU:
sparc
Priority:
P2
Resolution:
Fixed
Affected Versions:
6u4p,6u10
Fixed Versions:
hs12 (b02)

Related Reports
Backport:
Backport:
Duplicate:
Duplicate:
Duplicate:
Duplicate:
Relates:

Sub Tasks

Description
Java Release            : 6u4p
Java Builds             : b01
VM flavors              : server
VM Modes                : -Xmixed
Java flags              : -XX:+AggressiveOpts
Platform(s)             : solaris-sparc, solaris-sparcv9
Hostnames with OS info  : vm-t2000-01, nanonano (Solaris 10)

So, the failure is reproduced only on solaris-sparc/v9, with 
-server -Xmixed -XX:+AggressiveOpts or
-d64 -server -Xmixed -XX:+AggressiveOpts

The failure is not reproduced with 
- -Xint, -Xcomp
- without -XX:+AggressiveOpts
- on linux, sol-x86/amd, windows
- latest jdk7 (b23)
- latest jdk6u4 (b09)
- with rt.jar from latest 6u4 (b09) 

Running the tests with latest jdk6u4b09 but with jvm copied from 6u4p01 results in tests failure. So, the problem is 6u4p specific and is in HotSpot

Test cases: 
 java/lang/Character/Supplementary.java
 java/lang/String/Supplementary.java
 java/lang/StringBuffer/Supplementary.java
 java/lang/StringBuilder/Supplementary.java

Error Log : 
1. java/lang/String/Supplementary.java fails with
java.lang.RuntimeException: Error: offsetByCodePoints(input[0], 10, -14) returned an unexpected value. got 0x9, expecte
d 0xa
        at Supplementary.check(Supplementary.java:589)
        at Supplementary.test9(Supplementary.java:412)
        at Supplementary.main(Supplementary.java:19)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:78)
        at java.lang.Thread.run(Thread.java:619)

2. java/lang/Character/Supplementary.java fails with
   java.lang.RuntimeException: isValidCodePoint failed with 0xffef2a3e
        at Supplementary.test00(Supplementary.java:95)
        at Supplementary.main(Supplementary.java:25)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:78)
        at java.lang.Thread.run(Thread.java:619)

3. java/lang/StringBuffer/Supplementary.java fails with
java.lang.RuntimeException: Error: offsetByCodePoints(input[4], 5, -11) returned an unexpected value. got 0x4, expected
 0x5
        at Supplementary.check(Supplementary.java:357)
        at Supplementary.test6(Supplementary.java:252)
        at Supplementary.main(Supplementary.java:16)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:78)
        at java.lang.Thread.run(Thread.java:619)

4. java/lang/StringBuilder/Supplementary.java fails with
java.lang.RuntimeException: Error: offsetByCodePoints(input[4], 5, -11) returned an unexpected value. got 0x4, expected
 0x5
        at Supplementary.check(Supplementary.java:357)
        at Supplementary.test6(Supplementary.java:252)
        at Supplementary.main(Supplementary.java:16)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:78)
        at java.lang.Thread.run(Thread.java:619)

                                    

Comments
SUGGESTED FIX

*** /tmp/geta26640      Mon Dec  3 17:43:49 2007 
--- sparc.ad    Mon Dec  3 16:37:18 2007 
*************** 
*** 6025,6031 **** 
    ins_pipe(ialu_imm); 
  %} 
   
! instruct cmovII_U_reg(cmpOp cmp, flagsRegU icc, iRegI dst, iRegI src) %{ 
    match(Set dst (CMoveI (Binary cmp icc) (Binary dst src))); 
    ins_cost(150); 
    size(4); 
--- 6025,6031 ---- 
    ins_pipe(ialu_imm); 
  %} 
   
! instruct cmovII_U_reg(cmpOpU cmp, flagsRegU icc, iRegI dst, iRegI src) %{ 
    match(Set dst (CMoveI (Binary cmp icc) (Binary dst src))); 
    ins_cost(150); 
    size(4); 
*************** 
*** 6034,6040 **** 
    ins_pipe(ialu_reg); 
  %} 
   
! instruct cmovII_U_imm(cmpOp cmp, flagsRegU icc, iRegI dst, immI11 src) %{ 
    match(Set dst (CMoveI (Binary cmp icc) (Binary dst src))); 
    ins_cost(140); 
    size(4); 
--- 6034,6040 ---- 
    ins_pipe(ialu_reg); 
  %} 
   
! instruct cmovII_U_imm(cmpOpU cmp, flagsRegU icc, iRegI dst, immI11 src) %{ 
    match(Set dst (CMoveI (Binary cmp icc) (Binary dst src))); 
    ins_cost(140); 
    size(4);
                                     
2007-12-04
EVALUATION

This a latent bug in the encoding for cmove with unsigned compares in sparc.ad.  Code for folding compares as part of autobox elimination created opportunites to use these instructions.  It appears they hadn't been used before.
                                     
2007-12-04



Hardware and Software, Engineered to Work Together