FULL PRODUCT VERSION :
java version "1.6.0_14"
Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
Java HotSpot(TM) Server VM (build 14.0-b16, mixed mode)
FULL OS VERSION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
A specific Scala method crashes when Hotspot tries to compile it but only when the following VM flags are set:
-server -XX:+DoEscapeAnalysis -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC
removing either EA or G1 prevents the crash
THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: No
THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Execute the supplied Scala application
EXPECTED VERSUS ACTUAL BEHAVIOR :
The program should run without crash, the C2 compiler crashes
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Attached seperatly.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
case class Vec3(x:Float, y:Float, z:Float)
object Vec3 {
def min(xs:Iterable[Vec3]):Vec3 = {
val i = xs.elements
var Vec3(x,y,z) = i.next
while(i.hasNext) {
val v = i.next
if(v.x < x) x = v.x
if(v.y < y) y = v.y
if(v.z < z) z = v.z
}
Vec3(x,y,z)
}
def main(args:Array[String]) {
val l = new _root_.scala.collection.mutable.ArrayBuffer[Vec3]
for(i <- 0 to 80000) l+= Vec3(i,i,i)
for(j <- 1 to 10) {
println(min(l))
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Disable G1 or EscapeAnalysis