From: David G. (JIRA) <ji...@co...> - 2012-03-29 17:22:13
|
[ https://jira.codehaus.org/browse/RVM-957?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] David Grove updated RVM-957: ---------------------------- Fix Version/s: 3.1.3 Assignee: David Grove > Optimizing compiler (at O1+) produces incorrect code > ---------------------------------------------------- > > Key: RVM-957 > URL: https://jira.codehaus.org/browse/RVM-957 > Project: RVM > Issue Type: Bug > Components: Compiler: Optimizing > Affects Versions: 3.1.2 > Environment: host.name=ia32-linux > config.name=production > Reporter: Andreas Sewe > Assignee: David Grove > Fix For: 3.1.3 > > Attachments: scalac.ca > > > The optimizing compiler (at levels O1 or higher) seems to produce incorrect code for a method from the {{scalac}} benchmarks of the Scala benchmark suite found at http://repo.scalabench.org/snapshots/org/scalabench/benchmarks/scala-benchmark-suite/0.1.0-SNAPSHOT/scala-benchmark-suite-0.1.0-20120216.103539-3.jar. > When run with {{./dist/production_ia32-linux/rvm -X:aos:enable_recompilation=false -X:aos:initial_compiler=opt -X:irc:O1 -jar scala-benchmark-suite-0.1.0-20120216.103539-3.jar scalac --preserve}} the following exception ensues: > {quote} > Caused by: java.lang.ClassCastException > at scala.tools.nsc.typechecker.Infer$class.isFullyDefined(Infer.scala:107) > at scala.tools.nsc.Global$analyzer$.isFullyDefined(Global.scala:301) > at scala.tools.nsc.typechecker.Infer$Inferencer$$anonfun$methTypeArgs$1.apply(Infer.scala:629) > at scala.tools.nsc.typechecker.Infer$Inferencer$$anonfun$methTypeArgs$1.apply(Infer.scala:628) > at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61) > at scala.collection.immutable.List.foreach(List.scala:45) > at scala.tools.nsc.typechecker.Infer$Inferencer.methTypeArgs(Infer.scala:628) > at scala.tools.nsc.typechecker.Infer$Inferencer.inferMethodInstance(Infer.scala:1155) > at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:2501) > at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:3380) > at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:4049) > at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4203) > at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4265) > at scala.tools.nsc.typechecker.Typers$Typer.typedFunction(Typers.scala:2072) > at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:3921) > at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:4203) > ... > {quote} > When limiting oneself to {{-X:aos:initial_compiler=opt -X:irc:O1}} or {{-X:aos:initial_compiler=base}}, this exception does not show up. > By instrumenting {{RuntimeEntrypoints.deliverHardwareException}} I was able to determine the problematic {{checkcast}} instruction; it's located at bytecode index 324 in {{scala.tools.nsc.typechecker.Infer$class.isFullyDefined(scala.tools.nsc.typechecker.Analyzer, scala.tools.nsc.symtab.Types$Type)}}: > {quote} > > javap -c -l -classpath scratch/jar/scala-compiler-2.8.1.jar scala.tools.nsc.typechecker.Infer\$class > public static boolean isFullyDefined(scala.tools.nsc.typechecker.Analyzer, scala.tools.nsc.symtab.Types$Type); > Code: > ... > 319: aload 8 > 321: invokevirtual #335; //Method scala/Tuple2._1:()Ljava/lang/Object; > 324: checkcast #104; //class scala/tools/nsc/symtab/Types$Type > ... > LineNumberTable: > line 296: 304 > line 107: 308 > line 119: 341 > ... > {quote} > In {{BC2IR}} this {{checkcast}}, unlike some others in {{isFullyDefined}} is not skipped. > As this bug is "local" to the {{isFullyDefined}} method, it is possible to use a very short compiler advice file (attached) requesting just this method to be compiled to reproduce the bug: {{./dist/production_ia32-linux/rvm -X:aos:initial_compiler=base -X:aos:enable_precompile=true -X:aos:enable_recompilation=false -X:aos:cafi=scalac.ca -jar scala-benchmark-suite-0.1.0-20120216.103539-3.jar scalac --preserve}} -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira |