Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scala 2.11.4 #1204

Closed
sjrd opened this issue Oct 29, 2014 · 50 comments
Closed

Scala 2.11.4 #1204

sjrd opened this issue Oct 29, 2014 · 50 comments
Assignees
Labels
enhancement Feature request (that does not concern language semantics, see "language")
Milestone

Comments

@sjrd
Copy link
Member

sjrd commented Oct 29, 2014

  • Publish 0.5.5 against it
  • Upgrade master to it
@gzm0 gzm0 modified the milestone: v0.6.0 Oct 30, 2014
@gzm0 gzm0 self-assigned this Oct 30, 2014
@gzm0 gzm0 added the enhancement Feature request (that does not concern language semantics, see "language") label Oct 30, 2014
@gzm0
Copy link
Contributor

gzm0 commented Oct 30, 2014

We cannot compile our partest suite with 2.11.4. It seems that the pattern matcher goes into some kind of infinite loop:

Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded
    at scala.collection.immutable.HashMap$HashTrieMap.updated0(HashMap.scala:330)
    at scala.collection.immutable.HashMap$HashTrieMap.updated0(HashMap.scala:322)
    at scala.collection.immutable.HashMap.$plus(HashMap.scala:60)
    at scala.collection.immutable.HashMap.$plus(HashMap.scala:37)
    at scala.tools.nsc.transform.patmat.Solving$Solver$$anonfun$expandUnassigned$1$1$$anonfun$apply$2.force$1(Solving.scala:178)
    at scala.tools.nsc.transform.patmat.Solving$Solver$$anonfun$expandUnassigned$1$1$$anonfun$apply$2.apply(Solving.scala:180)
    at scala.tools.nsc.transform.patmat.Solving$Solver$$anonfun$expandUnassigned$1$1$$anonfun$apply$2.apply(Solving.scala:176)
    at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
    at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48)
    at scala.tools.nsc.transform.patmat.Solving$Solver$class.expandUnassigned$1(Solving.scala:173)
    at scala.tools.nsc.transform.patmat.Solving$Solver$class.findAllModels$1(Solving.scala:209)
    at scala.tools.nsc.transform.patmat.Solving$Solver$class.findAllModelsFor(Solving.scala:217)
    at scala.tools.nsc.transform.patmat.PatternMatching$OptimizingMatchTranslator.findAllModelsFor(PatternMatching.scala:89)
    at scala.tools.nsc.transform.patmat.PatternMatching$OptimizingMatchTranslator.findAllModelsFor(PatternMatching.scala:89)
    at scala.tools.nsc.transform.patmat.MatchAnalysis$MatchAnalyzer$class.exhaustive(MatchAnalysis.scala:523)
    at scala.tools.nsc.transform.patmat.PatternMatching$OptimizingMatchTranslator.exhaustive(PatternMatching.scala:89)
    at scala.tools.nsc.transform.patmat.MatchAnalysis$MatchAnalyzer$class.analyzeCases(MatchAnalysis.scala:783)
    at scala.tools.nsc.transform.patmat.PatternMatching$OptimizingMatchTranslator.analyzeCases(PatternMatching.scala:89)
    at scala.tools.nsc.transform.patmat.MatchTreeMaking$TreeMakers$class.combineCasesNoSubstOnly(MatchTreeMaking.scala:576)
    at scala.tools.nsc.transform.patmat.PatternMatching$OptimizingMatchTranslator.combineCasesNoSubstOnly(PatternMatching.scala:89)
    at scala.tools.nsc.transform.patmat.MatchTreeMaking$TreeMakers$class.combineCases(MatchTreeMaking.scala:533)
    at scala.tools.nsc.transform.patmat.PatternMatching$OptimizingMatchTranslator.combineCases(PatternMatching.scala:89)
    at scala.tools.nsc.transform.patmat.MatchTranslation$MatchTranslator$class.translateMatch(MatchTranslation.scala:235)
    at scala.tools.nsc.transform.patmat.PatternMatching$OptimizingMatchTranslator.translateMatch(PatternMatching.scala:89)
    at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:62)
    at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:57)
    at scala.reflect.internal.Trees$$anonfun$itransform$1.apply(Trees.scala:1350)
    at scala.reflect.internal.Trees$$anonfun$itransform$1.apply(Trees.scala:1349)
    at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2600)
    at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
    at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:25)
    at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:17)
[error] java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded

/ping @adriaanm @gkossakowski

@gkossakowski
Copy link

Which project is that? Would scala/community-build#65 catch this?

@sjrd
Copy link
Member Author

sjrd commented Oct 30, 2014

@gkossakowski No, it wouldn't. This is the partest project, which I did not include in the community build patch. I did not because it's just a dependency of the partestSuite project, and I explained in scala/community-build#65 that running the partest suite on Scala.js takes hours on its own. We could just add the compilation of the partest project to the community build if you want, though.

The sources of this project are in https://github.com/scala-js/scala-js/tree/master/partest/src/main/scala/scala/tools

@gkossakowski
Copy link

I think including as much code to be compiled makes sense. The general rule would be: include everything that's relevant and valuable for the project and use excludes only when necessary (e.g. because tests are very expensive to run).

@adriaanm
Copy link
Contributor

I'll look into it: as a workaround: -Xno-patmat-analysis

@adriaanm
Copy link
Contributor

I tried compiling the partest project on master on 2.11.4 (after publish-local of the compiler project) but couldn't repro. Could you tell me the right sequence of commands?

@gzm0
Copy link
Contributor

gzm0 commented Oct 30, 2014

@adriaanm It sufficient to say: sbt> ++2.11.4 partest/compile
(This doesn't compile anything to JavaScript).

I have the suspicion that this is a JDK8 only issue (just realized I was using JDK8 when testing this).

@gzm0
Copy link
Contributor

gzm0 commented Oct 30, 2014

Also happens in JDK7. Trying JDK6.

@gzm0
Copy link
Contributor

gzm0 commented Oct 30, 2014

Also happens on JDK6 for me (but different reason):

Caused by: java.lang.OutOfMemoryError: Java heap space
    at scala.collection.immutable.HashMap$HashTrieMap.updated0(HashMap.scala:330)
    at scala.collection.immutable.HashMap$HashTrieMap.updated0(HashMap.scala:322)
    at scala.collection.immutable.HashMap.$plus(HashMap.scala:60)
    at scala.collection.immutable.HashMap.$plus(HashMap.scala:37)
    at scala.tools.nsc.transform.patmat.Solving$Solver$$anonfun$expandUnassigned$1$1$$anonfun$apply$2.force$1(Solving.scala:178)
    at scala.tools.nsc.transform.patmat.Solving$Solver$$anonfun$expandUnassigned$1$1$$anonfun$apply$2.apply(Solving.scala:181)
    at scala.tools.nsc.transform.patmat.Solving$Solver$$anonfun$expandUnassigned$1$1$$anonfun$apply$2.apply(Solving.scala:176)
    at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
    at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48)
    at scala.tools.nsc.transform.patmat.Solving$Solver$class.expandUnassigned$1(Solving.scala:173)
    at scala.tools.nsc.transform.patmat.Solving$Solver$class.findAllModels$1(Solving.scala:209)
    at scala.tools.nsc.transform.patmat.Solving$Solver$class.findAllModelsFor(Solving.scala:217)
    at scala.tools.nsc.transform.patmat.PatternMatching$OptimizingMatchTranslator.findAllModelsFor(PatternMatching.scala:89)
    at scala.tools.nsc.transform.patmat.PatternMatching$OptimizingMatchTranslator.findAllModelsFor(PatternMatching.scala:89)
    at scala.tools.nsc.transform.patmat.MatchAnalysis$MatchAnalyzer$class.exhaustive(MatchAnalysis.scala:523)
    at scala.tools.nsc.transform.patmat.PatternMatching$OptimizingMatchTranslator.exhaustive(PatternMatching.scala:89)
    at scala.tools.nsc.transform.patmat.MatchAnalysis$MatchAnalyzer$class.analyzeCases(MatchAnalysis.scala:783)
    at scala.tools.nsc.transform.patmat.PatternMatching$OptimizingMatchTranslator.analyzeCases(PatternMatching.scala:89)
    at scala.tools.nsc.transform.patmat.MatchTreeMaking$TreeMakers$class.combineCasesNoSubstOnly(MatchTreeMaking.scala:576)
    at scala.tools.nsc.transform.patmat.PatternMatching$OptimizingMatchTranslator.combineCasesNoSubstOnly(PatternMatching.scala:89)
    at scala.tools.nsc.transform.patmat.MatchTreeMaking$TreeMakers$class.combineCases(MatchTreeMaking.scala:533)
    at scala.tools.nsc.transform.patmat.PatternMatching$OptimizingMatchTranslator.combineCases(PatternMatching.scala:89)
    at scala.tools.nsc.transform.patmat.MatchTranslation$MatchTranslator$class.translateMatch(MatchTranslation.scala:235)
    at scala.tools.nsc.transform.patmat.PatternMatching$OptimizingMatchTranslator.translateMatch(PatternMatching.scala:89)
    at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:62)
    at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:57)
    at scala.reflect.internal.Trees$$anonfun$itransform$1.apply(Trees.scala:1350)
    at scala.reflect.internal.Trees$$anonfun$itransform$1.apply(Trees.scala:1349)
    at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2600)
    at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
    at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:25)
    at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:17)

@adriaanm
Copy link
Contributor

I'm on JDK8, and what you asked me to do is what I did without problem, so not sure :-(

@adriaanm
Copy link
Contributor

maybe you just need to up -Xmx ?

@adriaanm
Copy link
Contributor

I run under "-Xmx3g"

@gzm0
Copy link
Contributor

gzm0 commented Oct 30, 2014

Checking...

@gzm0
Copy link
Contributor

gzm0 commented Oct 30, 2014

Happens even with -Xmx3g. Going higher.

My sbt is:

SBT_OPTS="-Xms512M -Xmx3g -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M"
java $SBT_OPTS -jar `dirname $0`/sbt-launch.jar "$@"

@adriaanm
Copy link
Contributor

sorry i was actually running under Xmx5200M (runner script was overriding it)

@sjrd
Copy link
Member Author

sjrd commented Oct 30, 2014

I can build it on Linux with

/usr/lib/jvm/java-1.7.0-openjdk-amd64/bin/java -Xms1024M -Xmx4G -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=768M -jar `dirname $0`/sbt-launch.jar "$@"

MaxPermSize, maybe?

@gzm0
Copy link
Contributor

gzm0 commented Oct 30, 2014

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256M; support was removed in 8.0

but -Xms is lower for me, too... I'll try further.

@adriaanm
Copy link
Contributor

it compiles with 3G for me -- runner script:

SBT_OPTS="-Xms512M -Xmx3200M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=512M -XX:ReservedCodeCacheSize=512M"
java $SBT_OPTS -jar `dirname $0`/sbt-launch-0.13.1-RC5.jar "$@"

EDIT: also compiles fine with a 2G heap: (lots of deprecation warnings, guys!)

scala-js/ (master=) $ g clean -fxd
Removing compiler/target/
Removing partest/target/
Removing project/project/target/
Removing project/target/
Removing target/
Removing tools/jvm/target/

scala-js/ (master=) $ g show
commit 2741545cef (HEAD, origin/master, origin/HEAD, master)
Merge: d24afe02e0 b40d3c372d
Author: Tobias Schlatter <tobias@meisch.ch>
Date:   4 hours ago

    Merge pull request #1209 from gzm0/optimizer-options-tostring

    Fix #1207: Good toString for OptimizerOptions

scala-js/ (master=) $ sbt ++2.11.4 partest/compile
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512M; support was removed in 8.0
[info] Loading project definition from /Users/adriaan/git/scala-js/project/project
[info] Updating {file:/Users/adriaan/git/scala-js/project/project/}scala-js-build-build...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Compiling 1 Scala source to /Users/adriaan/git/scala-js/project/project/target/scala-2.10/sbt-0.13/classes...
[info] Loading project definition from /Users/adriaan/git/scala-js/project
[info] Updating {file:/Users/adriaan/git/scala-js/project/}scala-js-build...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
[info] Compiling 112 Scala sources to /Users/adriaan/git/scala-js/project/target/scala-2.10/sbt-0.13/classes...
[warn] there were 3 deprecation warning(s); re-run with -deprecation for details
[warn] there were 3 unchecked warning(s); re-run with -unchecked for details
[warn] two warnings found
[info] Set current project to Scala.js (in build file:/Users/adriaan/git/scala-js/)
[info] Setting version to 2.11.4
[info] Set current project to Scala.js (in build file:/Users/adriaan/git/scala-js/)
[info] Updating {file:/Users/adriaan/git/scala-js/}compiler...
[info] Resolving jline#jline;2.12 ...
[info] Done updating.
[info] Updating {file:/Users/adriaan/git/scala-js/}partest...
[info] Resolving jline#jline;2.12 ...
[info] Done updating.
[info] Compiling 31 Scala sources to /Users/adriaan/git/scala-js/compiler/target/scala-2.11/classes...
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/Compat210Component.scala:24: method originalName in class Symbol is deprecated: Use unexpandedName
[warn]     def unexpandedName: Name = self.originalName
[warn]                                     ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/Compat210Component.scala:27: method isLocal in class Symbol is deprecated: Use isLocalToBlock instead
[warn]     def isLocalToBlock: Boolean = self.isLocal
[warn]                                        ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/GenJSCode.scala:393: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]         currentUnit.error(exp.pos,
[warn]                     ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/GenJSCode.scala:426: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]         currentUnit.error(exp.pos, "You may not export a trait")
[warn]                     ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/GenJSCode.scala:1636: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]             currentUnit.error(pos,
[warn]                         ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/GenJSCode.scala:2761: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]             currentUnit.error(pos,
[warn]                         ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/GenJSCode.scala:2765: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]             currentUnit.error(pos,
[warn]                         ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/GenJSCode.scala:2817: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]             currentUnit.error(pos,
[warn]                         ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/GenJSCode.scala:2821: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]             currentUnit.error(pos,
[warn]                         ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/GenJSCode.scala:2838: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]               currentUnit.error(pos, "js.native may only be used as stub implementation in facade types")
[warn]                           ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/GenJSCode.scala:3088: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]         currentUnit.error(pos,
[warn]                     ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/GenJSExports.scala:94: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]           currentUnit.error(pos, "You may not use @JSNamedExport on an object")
[warn]                       ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/GenJSExports.scala:128: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]         currentUnit.error(pos,
[warn]                     ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/GenJSExports.scala:167: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]         currentUnit.error(alts.head.pos,
[warn]                     ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/GenJSExports.scala:339: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]         currentUnit.error(pos,
[warn]                     ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/JSGlobalAddons.scala:96: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]           currentUnit.error(annot.pos,
[warn]                       ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/JSGlobalAddons.scala:110: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]           currentUnit.error(annot.pos, "A method ending in _= will be exported " +
[warn]                       ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/JSGlobalAddons.scala:122: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]           currentUnit.error(pos,
[warn]                       ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/JSGlobalAddons.scala:130: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]           currentUnit.error(annot.pos, "You may not export a zero-argument " +
[warn]                       ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/JSGlobalAddons.scala:135: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]           currentUnit.error(annot.pos,
[warn]                       ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/JSGlobalAddons.scala:171: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]             currentUnit.error(sym.pos,
[warn]                         ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/PrepJSExports.scala:37: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]     def err(msg: String) = { currentUnit.error(exports.head.pos, msg); Nil }
[warn]                                          ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/PrepJSInterop.scala:101: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]         unit.error(idef.pos, "Traits, classes and objects extending js.Any " +
[warn]              ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/PrepJSInterop.scala:139: method warning in class CompilationUnit is deprecated: Call global.reporter.warning (or typer.context.warning) directly instead.
[warn]         unit.warning(tree.pos,
[warn]              ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/PrepJSInterop.scala:146: method warning in class CompilationUnit is deprecated: Call global.reporter.warning (or typer.context.warning) directly instead.
[warn]         unit.warning(tree.pos,
[warn]              ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/PrepJSInterop.scala:153: method warning in class CompilationUnit is deprecated: Call global.reporter.warning (or typer.context.warning) directly instead.
[warn]         unit.warning(tree.pos,
[warn]              ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/PrepJSInterop.scala:160: method warning in class CompilationUnit is deprecated: Call global.reporter.warning (or typer.context.warning) directly instead.
[warn]         unit.warning(tree.pos,
[warn]              ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/PrepJSInterop.scala:186: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]             unit.error(tpeArg.pos, s"Type ${tpeArg} is not a class type")
[warn]                  ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/PrepJSInterop.scala:190: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]           unit.error(classOfTree.pos,
[warn]                ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/PrepJSInterop.scala:212: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]             currentUnit.error(exp.pos, msg)
[warn]                         ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/PrepJSInterop.scala:272: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]             currentUnit.error(exp.pos, msg)
[warn]                         ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/PrepJSInterop.scala:295: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]           unit.error(implDef.pos, "Classes and objects extending " +
[warn]                ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/PrepJSInterop.scala:302: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]           unit.error(implDef.pos, s"${sym.nameString} extends ${badName} " +
[warn]                ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/PrepJSInterop.scala:308: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]           unit.error(implDef.pos, "Anonymous classes may not " +
[warn]                ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/PrepJSInterop.scala:314: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]           unit.error(implDef.pos, "Classes extending js.Any may not be " +
[warn]                ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/PrepJSInterop.scala:318: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]           unit.error(implDef.pos, "Objects extending js.Any may not be " +
[warn]                ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/PrepJSInterop.scala:322: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]           unit.error(implDef.pos, "Local classes and objects may not " +
[warn]                ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/PrepJSInterop.scala:328: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]           unit.error(implDef.pos, "Only objects may extend js.GlobalScope")
[warn]                ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/PrepJSInterop.scala:353: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]         unit.error(exports.head.pos, s"You may not export a $memType of a subclass of js.Any")
[warn]              ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/PrepJSInterop.scala:358: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]         unit.error(tree.pos, "Setters that do not return Unit are " +
[warn]              ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/PrepJSInterop.scala:364: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]         unit.error(tree.pos, "Methods in a js.Any may not be @native")
[warn]              ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/PrepJSInterop.scala:371: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]         currentUnit.error(annot.pos,
[warn]                     ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/PrepJSInterop.scala:393: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]               unit.error(tree.pos,
[warn]                    ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/PrepJSInterop.scala:405: method error in class CompilationUnit is deprecated: Call global.reporter.error (or typer.context.error) directly instead.
[warn]             unit.error(tree.pos, "A secondary constructor of a class " +
[warn]                  ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/PrepJSInterop.scala:414: method warning in class CompilationUnit is deprecated: Call global.reporter.warning (or typer.context.warning) directly instead.
[warn]             unit.warning(pos, "Members of traits, classes and objects " +
[warn]                  ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/PrepJSInterop.scala:423: method warning in class CompilationUnit is deprecated: Call global.reporter.warning (or typer.context.warning) directly instead.
[warn]           unit.warning(tree.pos, s"The type of $name got inferred " +
[warn]                ^
[warn] /Users/adriaan/git/scala-js/compiler/src/main/scala/scala/scalajs/compiler/ScalaJSPlugin.scala:28: method forScaladoc in trait Required is deprecated: Scaladoc is implemented with a custom Global; this flag is ignored
[warn]     if (global.forScaladoc)
[warn]                ^
[warn] 47 warnings found
[info] Packaging /Users/adriaan/git/scala-js/compiler/target/scala-2.11/scalajs-compiler_2.11.4-0.6.0-SNAPSHOT.jar ...
[info] Done packaging.
[success] Total time: 22 s, completed Oct 30, 2014 2:31:23 PM

@adriaanm
Copy link
Contributor

could you narrow down which file is causing the problem?

@sjrd
Copy link
Member Author

sjrd commented Oct 30, 2014

(lots of deprecation warnings, guys!)

When you compile against the compiler API and you want to support 2.10.2+, you have to live with them. Note that this bunch was just introduced by 2.11.4. Until 2.11.2 we had only 3 or 4, and they are protected by implicit conversions in https://github.com/scala-js/scala-js/blob/master/compiler/src/main/scala/scala/scalajs/compiler/Compat210Component.scala

@gzm0
Copy link
Contributor

gzm0 commented Oct 30, 2014

could you narrow down which file is causing the problem?

How can I do that?

gzm0 added a commit to gzm0/scala-js that referenced this issue Oct 30, 2014
gzm0 added a commit to gzm0/scala-js that referenced this issue Oct 30, 2014
Also bump partest version to 1.0.1.
@adriaanm
Copy link
Contributor

you have to live with them.

I think those newly deprecated methods can be avoided on 2.10. Let me know if I can help -- this was part of the big reporting refactoring (to enable configuring error reporting).

@adriaanm
Copy link
Contributor

Pass -verbose to scalac?

@gzm0
Copy link
Contributor

gzm0 commented Oct 30, 2014

It happens on our CI as well.

@gzm0
Copy link
Contributor

gzm0 commented Oct 30, 2014

@adriaanm passing -verbose doesn't show the file it is compiling.

Further, note that using -Xno-patmat-analysis doesn't solve the issue, but just makes the compiler fail faster (almost immediate):

Caused by: java.lang.OutOfMemoryError: Java heap space
    at scala.collection.mutable.ArrayBuffer.sizeHint(ArrayBuffer.scala:69)
    at scala.tools.nsc.transform.patmat.Solving$Solver$class.expandUnassigned$1(Solving.scala:165)
    at scala.tools.nsc.transform.patmat.Solving$Solver$class.findAllModels$1(Solving.scala:209)
    at scala.tools.nsc.transform.patmat.Solving$Solver$class.findAllModelsFor(Solving.scala:217)
    at scala.tools.nsc.transform.patmat.PatternMatching$OptimizingMatchTranslator.findAllModelsFor(PatternMatching.scala:89)
    at scala.tools.nsc.transform.patmat.PatternMatching$OptimizingMatchTranslator.findAllModelsFor(PatternMatching.scala:89)
    at scala.tools.nsc.transform.patmat.MatchAnalysis$MatchAnalyzer$class.exhaustive(MatchAnalysis.scala:523)
    at scala.tools.nsc.transform.patmat.PatternMatching$OptimizingMatchTranslator.exhaustive(PatternMatching.scala:89)
    at scala.tools.nsc.transform.patmat.MatchAnalysis$MatchAnalyzer$class.analyzeCases(MatchAnalysis.scala:783)
    at scala.tools.nsc.transform.patmat.PatternMatching$OptimizingMatchTranslator.analyzeCases(PatternMatching.scala:89)
    at scala.tools.nsc.transform.patmat.MatchTreeMaking$TreeMakers$class.combineCasesNoSubstOnly(MatchTreeMaking.scala:576)
    at scala.tools.nsc.transform.patmat.PatternMatching$OptimizingMatchTranslator.combineCasesNoSubstOnly(PatternMatching.scala:89)
    at scala.tools.nsc.transform.patmat.MatchTreeMaking$TreeMakers$class.combineCases(MatchTreeMaking.scala:533)
    at scala.tools.nsc.transform.patmat.PatternMatching$OptimizingMatchTranslator.combineCases(PatternMatching.scala:89)
    at scala.tools.nsc.transform.patmat.MatchTranslation$MatchTranslator$class.translateMatch(MatchTranslation.scala:235)
    at scala.tools.nsc.transform.patmat.PatternMatching$OptimizingMatchTranslator.translateMatch(PatternMatching.scala:89)
    at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:62)
    at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:57)
    at scala.reflect.internal.Trees$$anonfun$itransform$1.apply(Trees.scala:1350)
    at scala.reflect.internal.Trees$$anonfun$itransform$1.apply(Trees.scala:1349)
    at scala.reflect.api.Trees$Transformer.atOwner(Trees.scala:2600)
    at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:30)
    at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:25)
    at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.atOwner(TypingTransformers.scala:17)
    at scala.reflect.internal.Trees$class.itransform(Trees.scala:1348)
    at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
    at scala.reflect.internal.SymbolTable.itransform(SymbolTable.scala:16)
    at scala.reflect.api.Trees$Transformer.transform(Trees.scala:2555)
    at scala.tools.nsc.transform.TypingTransformers$TypingTransformer.transform(TypingTransformers.scala:44)
    at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:73)
    at scala.tools.nsc.transform.patmat.PatternMatching$MatchTransformer.transform(PatternMatching.scala:57)
    at scala.reflect.api.Trees$Transformer$$anonfun$transformStats$1.apply(Trees.scala:2589)

@adriaanm
Copy link
Contributor

how embarrassing, off-by-one-boolean in NoSuppression

@adriaanm
Copy link
Contributor

-verbose works for me on the command line... maybe sbt is hiding the output?

@gzm0
Copy link
Contributor

gzm0 commented Oct 30, 2014

Well, -verbose does give a lot of output, but not the file it is currently compiling. It gives me plenty of [parsing]... then plenty of [loaded], then [typer in -1414655564295ms] and that's it...

So I don't know which compilation unit we choke on...

@adriaanm
Copy link
Contributor

-Ydebug? It's been a while since I had to dive in big projects for a repro... Is that a good sign?

PS: scala/scala#4085

@gzm0
Copy link
Contributor

gzm0 commented Oct 30, 2014

Debug doesn't help either :( It tells me:

[info] [running phase parser on 95 compilation units]
[info] [running phase namer on 95 compilation units]
[info] [running phase packageobjects on 95 compilation units]
[info] [running phase typer on 95 compilation units]
<snip> warnings from typer
[info] [running phase patmat on 95 compilation units]
[warn] !!! resetting info of p4: List[ir.this.Trees.Tree] @ scala.`package`.$colon$plus.unapply[ir.this.Trees.Tree, immutable.this.List[ir.this.Trees.Tree]](<unapply-selector>) <unapply> ((stats @ _), (expr @ _)) to immutable.this.List[ir.this.Trees.Tree] with collection.this.SeqLike[ir.this.Trees.Tree,immutable.this.List[ir.this.Trees.Tree]]{}
[warn] !!! resetting info of p4: List[scalajs.ir.Trees.Tree] @ scala.`package`.$colon$plus.unapply[scalajs.ir.Trees.Tree, immutable.this.List[scalajs.ir.Trees.Tree]](<unapply-selector>) <unapply> ((stats @ _), (expr @ _)) to immutable.this.List[scalajs.ir.Trees.Tree] with collection.this.SeqLike[scalajs.ir.Trees.Tree,immutable.this.List[scalajs.ir.Trees.Tree]]{}
[warn] !!! resetting info of p4: List[scalajs.ir.Trees.Tree] @ scala.`package`.$colon$plus.unapply[scalajs.ir.Trees.Tree, immutable.this.List[scalajs.ir.Trees.Tree]](<unapply-selector>) <unapply> ((stats @ _), (expr @ _)) to immutable.this.List[scalajs.ir.Trees.Tree] with collection.this.SeqLike[scalajs.ir.Trees.Tree,immutable.this.List[scalajs.ir.Trees.Tree]]{}
[warn] !!! resetting info of p4: List[javascript.this.Trees.Tree] @ scala.`package`.$colon$plus.unapply[javascript.this.Trees.Tree, immutable.this.List[javascript.this.Trees.Tree]](<unapply-selector>) <unapply> ((stats @ _), (<param> expr: javascript.this.Trees.Tree)(implicit <param> pos: ir.this.Position)javascript.this.Trees.Return(()(implicit <param> pos: ir.this.Position)javascript.this.Trees.Undefined())) to immutable.this.List[javascript.this.Trees.Tree] with collection.this.SeqLike[javascript.this.Trees.Tree,immutable.this.List[javascript.this.Trees.Tree]]{}
[warn] !!! resetting info of p4: List[scalajs.ir.Trees.Tree] @ scala.`package`.$colon$plus.unapply[scalajs.ir.Trees.Tree, immutable.this.List[scalajs.ir.Trees.Tree]](<unapply-selector>) <unapply> ((stats @ _), (expr @ _)) to immutable.this.List[scalajs.ir.Trees.Tree] with collection.this.SeqLike[scalajs.ir.Trees.Tree,immutable.this.List[scalajs.ir.Trees.Tree]]{}
[warn] !!! resetting info of p4: List[javascript.this.Trees.Tree] @ scala.`package`.$colon$plus.unapply[javascript.this.Trees.Tree, immutable.this.List[javascript.this.Trees.Tree]](<unapply-selector>) <unapply> ((stats @ _), (<param> expr: javascript.this.Trees.Tree)(implicit <param> pos: ir.this.Position)javascript.this.Trees.Return(()(implicit <param> pos: ir.this.Position)javascript.this.Trees.Undefined())) to immutable.this.List[javascript.this.Trees.Tree] with collection.this.SeqLike[javascript.this.Trees.Tree,immutable.this.List[javascript.this.Trees.Tree]]{}
[warn] !!! resetting info of x1: List[ir.this.Trees.Tree] @ scala.`package`.$colon$plus.unapply[ir.this.Trees.Tree, immutable.this.List[ir.this.Trees.Tree]](<unapply-selector>) <unapply> ((stats @ _), (expr @ _)) to immutable.this.List[ir.this.Trees.Tree] with collection.this.SeqLike[ir.this.Trees.Tree,immutable.this.List[ir.this.Trees.Tree]]{}
java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: GC overhead limit exceeded

So I still don't know the CU it chokes on...

@gzm0
Copy link
Contributor

gzm0 commented Oct 31, 2014

@adriaanm this is one of the pattern matches that cause the out of memory:

JSObjectConstr(fields map {
  case (name, value) => (name, transformExpr(value))
})

From OptimizerCore.scala

So its a very simple, irrefutable pattern (up to null). This should really not take 3GB of memory to compile.

@adriaanm
Copy link
Contributor

Agreed :) how did you find it in the end? I'll look into it next week.

@gzm0
Copy link
Contributor

gzm0 commented Oct 31, 2014

Like this:

diff --git a/src/compiler/scala/tools/nsc/transform/patmat/PatternMatching.scala b/src/compiler/scala/tools/nsc/tr
index ef50e08..448a3de 100644
--- a/src/compiler/scala/tools/nsc/transform/patmat/PatternMatching.scala
+++ b/src/compiler/scala/tools/nsc/transform/patmat/PatternMatching.scala
@@ -57,6 +57,10 @@ trait PatternMatching extends Transform
   class MatchTransformer(unit: CompilationUnit) extends TypingTransformer(unit) {
     override def transform(tree: Tree): Tree = tree match {
       case Match(sel, cases) =>
+        println("Translating match!")
+        println("  Compilation unit: " + unit)
+        println("  Pos: " + tree.pos)
+        println("  Tree: " + tree)
         val origTp = tree.tpe
         // setType origTp intended for CPS -- TODO: is it necessary?
         val translated = translator.translateMatch(treeCopy.Match(tree, transform(sel), transformTrees(cases).asI
@@ -69,6 +73,9 @@ trait PatternMatching extends Transform
             translated
         }
       case Try(block, catches, finalizer) =>
+        println("Translating try!")
+        println("  Compilation unit: " + unit)
+        println("  Tree: " + tree)
         treeCopy.Try(tree, transform(block), translator.translateTry(transformTrees(catches).asInstanceOf[List[Ca
       case _ => super.transform(tree)
     }

Is it any use to you if I try to remove code around it? I'll try freezing the hierarchy we match against (by adding some finals) in the hope this solves it.

@adriaanm
Copy link
Contributor

Yeah, I really don't understand why this would be taking so long/so much memory. Can you confirm that rewriting without a match makes the problem go away? /cc @gbasler, who has the patmat analysis logic fresh in mind (I'm a bit rusty)

@gzm0
Copy link
Contributor

gzm0 commented Oct 31, 2014

I'll try to rewrite without pattern match. (However, there are many of these matches, so it might take me a while to evict them one-by-one).

gzm0 added a commit to gzm0/scala-js that referenced this issue Oct 31, 2014
Also bump partest version to 1.0.1.
@adriaanm
Copy link
Contributor

maybe go first for one with more cases/alternatives/sealed hierarchy

@gzm0
Copy link
Contributor

gzm0 commented Oct 31, 2014

They all basically match on the same tree hierarchy.

@gzm0
Copy link
Contributor

gzm0 commented Oct 31, 2014

Even a match like this fails:

val body = cases collectFirst {
  case x if x._1.exists(literal_===(_, newSelector)) => x._2
} getOrElse default

translated from

val body = cases collectFirst {
  case (alts, body) if alts.exists(literal_===(_, newSelector)) => body
} getOrElse default

@gzm0
Copy link
Contributor

gzm0 commented Oct 31, 2014

If also found matches like this failing:

x match {
  case x: Literal => // x
  case _ => // y
}

where literal is a sealed sub trait of x's type.

@adriaanm
Copy link
Contributor

Something self-contained I can try would be great.

@gzm0
Copy link
Contributor

gzm0 commented Oct 31, 2014

What's wrong with the Scala.js build itself (or more precisely the tools project)? There probably is a need for a quite large class hierarchy to reproduce this. And if the Scala.js build doesn't trigger this on your environment, it is unlikely that anything more self-contained will.

@gzm0
Copy link
Contributor

gzm0 commented Oct 31, 2014

Btw. I could reproduce this on my laptop:

Linux eos 3.13.0-37-generic #64-Ubuntu SMP Mon Sep 22 21:28:38 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

@gzm0
Copy link
Contributor

gzm0 commented Oct 31, 2014

Also on JDK7:

java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)

@gbasler
Copy link

gbasler commented Oct 31, 2014

@adriaanm I could reproduce the error, just checked out gzm0's branch and run sbt ++2.11.4 partest/compile... the unassigned list contains 137 variables, so I'm not surprised that it explodes...

A quick fix would be to abort the loop and issue a warning if e.g. more than 10 variables (=2^10 models) are expanded... sorry my bad I should have thought of that before...

There should be a nicer solution though - the expand unassigned can be avoided by just allowing unassigned variables in the model and then returning a list of counter examples in modelToCounterExample. Does that make sense? If yes - I can try to implement that... a small .scala for the regressions would be helpful though.

@gbasler
Copy link

gbasler commented Nov 2, 2014

I realized that limiting the number of variables that are expanded results in the same non deterministic behavior that I tried to fix.
I am working on the second approach (still messy and one test is failing):
gbasler/scala@a9b1d78

@gzm0
Copy link
Contributor

gzm0 commented Nov 3, 2014

Back-Published Scala.js v0.5.{0-5} for 2.11.4

@gzm0
Copy link
Contributor

gzm0 commented Nov 4, 2014

@gbasler is this filed as an SI somewhere already?

@adriaanm
Copy link
Contributor

adriaanm commented Nov 4, 2014

Ok, great, thanks @gbasler! I agree with @gzm0 that it would be good to track this as an issue on issues.scala-lang.org

gzm0 added a commit to gzm0/scala-js that referenced this issue Nov 4, 2014
@gzm0 gzm0 closed this as completed in 2a92444 Nov 4, 2014
@gzm0
Copy link
Contributor

gzm0 commented Nov 21, 2014

Filed as SI-8999

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request (that does not concern language semantics, see "language")
Projects
None yet
Development

No branches or pull requests

5 participants