-
Bug
-
Resolution: Fixed
-
P4
-
None
-
8u45
-
x86_64
-
linux
FULL PRODUCT VERSION :
java -version
openjdk version "1.8.0_60"
OpenJDK Runtime Environment (build 1.8.0_60-b16)
OpenJDK 64-Bit Server VM (build 25.60-b16, mixed mode)
and other JDK
java -version
openjdk version "1.8.0_45"
OpenJDK Runtime Environment (build 1.8.0_45-b14)
OpenJDK 64-Bit Server VM (build 25.45-b02, mixed mode)
FULL OS VERSION :
Fedora Linux x64, different version from F17-to F21
A DESCRIPTION OF THE PROBLEM :
At some point hotspot incorrectly inline functions,
option Option -XX:InlineSmallCode=0 does help.
See https://bugzilla.redhat.com/show_bug.cgi?id=1233827
THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: No
THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
run YY.java code
at some point you would get
k= rmoms=[D@4b1d6571 moms=[D@1b835480 r=[D@3549bca9
k= rmoms=[D@4f25b795 moms=[D@6fb365ed r=[D@6e950bcf
k= rmoms=null moms=null r=null
Exception in thread "main" java.lang.NullPointerException
at YY.mulVV(YY.java:78)
at YY.mulVV(YY.java:70)
at YY.getX(YY.java:33)
at YY.runTests(YY.java:14)
at YY.main(YY.java:88)
EXPECTED VERSUS ACTUAL BEHAVIOR :
java -XX:InlineSmallCode=0 YY
y=6405.9478662121455
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
class YY {
static final java.util.Random R=new java.util.Random(1);
double runTests(final int ntests)
{
double yy=0;
for(int k=0;k<ntests;k++)
{
final int d=R.nextInt(23)+3;
final double [] m=new double [d];
for(int j=0;j<d;j++) m[j]=R.nextDouble();
final double [] v=getX(m);
for(int j=0;j<v.length;j++) yy+=v[j];
}
return yy;
}
public double [] getX(final double [] moms)
{
final double [] r=new double [moms.length-1];
final double [] rmoms=new double [moms.length];
//System.err.println("INIT:rmoms="+rmoms+" moms="+moms+" r="+r);
for(int k=0;k<r.length;k++)
{
final double [] tmp=new double [k+1];
tmp[k]=1;
setxP(rmoms,tmp);
System.err.println("k="/*+k*/+" rmoms="+rmoms+" moms="+moms+" r="+r);
r[k]=mulVV(k+2,rmoms,moms); // Line 544 !!! Arguments are null !!!
}
return r;
}
public void setxP(final double [] r,final double [] x)
{
setxP(x.length,r,x);
}
static final YY BASIS=new YY();
public void setxP(final int n,final double [] res,final double [] p)
{
BASIS.setaxbP(n-1,res,p,1,0);
}
public void setaxbP(final int n,final double [] res,final double [] p,final double a,final double b)
{
double r=p[n];
res[n]=res[n+1]=0;
for(int k=n;k>=0;k--)
{
final double ar=a*r;
res[k+1]-=(k+1)*(ar);
res[k]+=(2*k+1)*(ar)+b*r;
if(k>0)
{
final double t=p[k-1];
res[k-1]=-k*(ar);
r=t;
}
}
}
public static double mulVV(final int n,final double [] a,final double [] b)
{
return mulVV(n,a,0,b,0);
}
public static double mulVV(final int n,final double [] a,final int off_a,final double [] b,final int off_b)
{
double s=0;
for(int i=n;--i>=0;)
{
s+=a[i+off_a]*b[i+off_b];
}
return s;
}
public static void main(String [] args)
{
final int ntests=10000000;
final double y=new YY().runTests(ntests);
System.err.println("y="+y);
}
}
---------- END SOURCE ----------
java -version
openjdk version "1.8.0_60"
OpenJDK Runtime Environment (build 1.8.0_60-b16)
OpenJDK 64-Bit Server VM (build 25.60-b16, mixed mode)
and other JDK
java -version
openjdk version "1.8.0_45"
OpenJDK Runtime Environment (build 1.8.0_45-b14)
OpenJDK 64-Bit Server VM (build 25.45-b02, mixed mode)
FULL OS VERSION :
Fedora Linux x64, different version from F17-to F21
A DESCRIPTION OF THE PROBLEM :
At some point hotspot incorrectly inline functions,
option Option -XX:InlineSmallCode=0 does help.
See https://bugzilla.redhat.com/show_bug.cgi?id=1233827
THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: No
THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
run YY.java code
at some point you would get
k= rmoms=[D@4b1d6571 moms=[D@1b835480 r=[D@3549bca9
k= rmoms=[D@4f25b795 moms=[D@6fb365ed r=[D@6e950bcf
k= rmoms=null moms=null r=null
Exception in thread "main" java.lang.NullPointerException
at YY.mulVV(YY.java:78)
at YY.mulVV(YY.java:70)
at YY.getX(YY.java:33)
at YY.runTests(YY.java:14)
at YY.main(YY.java:88)
EXPECTED VERSUS ACTUAL BEHAVIOR :
java -XX:InlineSmallCode=0 YY
y=6405.9478662121455
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
class YY {
static final java.util.Random R=new java.util.Random(1);
double runTests(final int ntests)
{
double yy=0;
for(int k=0;k<ntests;k++)
{
final int d=R.nextInt(23)+3;
final double [] m=new double [d];
for(int j=0;j<d;j++) m[j]=R.nextDouble();
final double [] v=getX(m);
for(int j=0;j<v.length;j++) yy+=v[j];
}
return yy;
}
public double [] getX(final double [] moms)
{
final double [] r=new double [moms.length-1];
final double [] rmoms=new double [moms.length];
//System.err.println("INIT:rmoms="+rmoms+" moms="+moms+" r="+r);
for(int k=0;k<r.length;k++)
{
final double [] tmp=new double [k+1];
tmp[k]=1;
setxP(rmoms,tmp);
System.err.println("k="/*+k*/+" rmoms="+rmoms+" moms="+moms+" r="+r);
r[k]=mulVV(k+2,rmoms,moms); // Line 544 !!! Arguments are null !!!
}
return r;
}
public void setxP(final double [] r,final double [] x)
{
setxP(x.length,r,x);
}
static final YY BASIS=new YY();
public void setxP(final int n,final double [] res,final double [] p)
{
BASIS.setaxbP(n-1,res,p,1,0);
}
public void setaxbP(final int n,final double [] res,final double [] p,final double a,final double b)
{
double r=p[n];
res[n]=res[n+1]=0;
for(int k=n;k>=0;k--)
{
final double ar=a*r;
res[k+1]-=(k+1)*(ar);
res[k]+=(2*k+1)*(ar)+b*r;
if(k>0)
{
final double t=p[k-1];
res[k-1]=-k*(ar);
r=t;
}
}
}
public static double mulVV(final int n,final double [] a,final double [] b)
{
return mulVV(n,a,0,b,0);
}
public static double mulVV(final int n,final double [] a,final int off_a,final double [] b,final int off_b)
{
double s=0;
for(int i=n;--i>=0;)
{
s+=a[i+off_a]*b[i+off_b];
}
return s;
}
public static void main(String [] args)
{
final int ntests=10000000;
final double y=new YY().runTests(ntests);
System.err.println("y="+y);
}
}
---------- END SOURCE ----------