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

Can't compile a large source file #10053

Open
scabug opened this issue Nov 14, 2016 · 2 comments
Open

Can't compile a large source file #10053

scabug opened this issue Nov 14, 2016 · 2 comments

Comments

@scabug
Copy link

scabug commented Nov 14, 2016

I compiled a scala source which was generated by another scala program. then the scala compiler crashed with exception:

[root@docker RulesEngine]# sbt compile
[info] Loading project definition from /root/xu/RulesEngine/project
[info] Set current project to RulesEngine (in build file:/root/xu/RulesEngine/)
[info] Compiling 1 Scala source to /root/xu/RulesEngine/target/scala-2.11/classes...
[warn] /root/xu/RulesEngine/src/main/scala/oz/rulesengine/Syslog.scala:10711: unreachable code
[warn] case "STORAGE" => 
[warn]                ^
[warn] /root/xu/RulesEngine/src/main/scala/oz/rulesengine/Syslog.scala:10751: unreachable code
[warn] case "STORAGE" => 
[warn]                ^
[warn] /root/xu/RulesEngine/src/main/scala/oz/rulesengine/Syslog.scala:75228: unreachable code
[warn] case "CMDTIMEOUT" => 
[warn]                   ^
[warn] /root/xu/RulesEngine/src/main/scala/oz/rulesengine/Syslog.scala:337548: unreachable code
[warn] case "FIBLC_OOSEQ" => 
[warn]                    ^
[warn] /root/xu/RulesEngine/src/main/scala/oz/rulesengine/Syslog.scala:678216: unreachable code
[warn] 		if((pr_match(context.ov("NodeAlias"),"NF12WA02")) && (regmatch(context.ov("Summary"),""".*POS1/0.*declared.*""")))
[warn] 		^
java.lang.ArrayIndexOutOfBoundsException: -32768
	at scala.tools.asm.ClassWriter.addType(ClassWriter.java:1630)
	at scala.tools.asm.ClassWriter.addUninitializedType(ClassWriter.java:1605)
	at scala.tools.asm.Frame.execute(Frame.java:1213)
	at scala.tools.asm.MethodWriter.visitTypeInsn(MethodWriter.java:838)
	at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder.genPrimitive$1(GenASM.scala:2716)
	at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder.scala$tools$nsc$backend$jvm$GenASM$JPlainBuilder$$genInstr$1(GenASM.scala:2298)
	at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder$$anonfun$genBlock$1$2.apply(GenASM.scala:2227)
	at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder$$anonfun$genBlock$1$2.apply(GenASM.scala:2213)
	at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
	at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186)
	at scala.tools.nsc.backend.icode.BasicBlocks$BasicBlock.foreach(BasicBlocks.scala:195)
	at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder.genBlock$1(GenASM.scala:2213)
	at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder.genBlocks$1(GenASM.scala:2152)
	at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder.genCode(GenASM.scala:2746)
	at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder.genMethod(GenASM.scala:1471)
	at scala.tools.nsc.backend.jvm.GenASM$JPlainBuilder.genClass(GenASM.scala:1341)
	at scala.tools.nsc.backend.jvm.GenASM$AsmPhase.emitFor$1(GenASM.scala:198)
	at scala.tools.nsc.backend.jvm.GenASM$AsmPhase.run(GenASM.scala:204)
	at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1501)
	at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1486)
	at scala.tools.nsc.Global$Run.compileSources(Global.scala:1481)
	at scala.tools.nsc.Global$Run.compile(Global.scala:1582)
	at xsbt.CachedCompiler0.run(CompilerInterface.scala:116)
	at xsbt.CachedCompiler0.run(CompilerInterface.scala:95)
	at xsbt.CompilerInterface.run(CompilerInterface.scala:26)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:101)
	at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:47)
	at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:41)
	at sbt.compiler.MixedAnalyzingCompiler$$anonfun$compileScala$1$1.apply$mcV$sp(MixedAnalyzingCompiler.scala:51)
	at sbt.compiler.MixedAnalyzingCompiler$$anonfun$compileScala$1$1.apply(MixedAnalyzingCompiler.scala:51)
	at sbt.compiler.MixedAnalyzingCompiler$$anonfun$compileScala$1$1.apply(MixedAnalyzingCompiler.scala:51)
	at sbt.compiler.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:75)
	at sbt.compiler.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:50)
	at sbt.compiler.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:65)
	at sbt.compiler.IC$$anonfun$compileInternal$1.apply(IncrementalCompiler.scala:160)
	at sbt.compiler.IC$$anonfun$compileInternal$1.apply(IncrementalCompiler.scala:160)
	at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:66)
	at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:64)
	at sbt.inc.IncrementalCommon.cycle(IncrementalCommon.scala:31)
	at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:62)
	at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:61)
	at sbt.inc.Incremental$.manageClassfiles(Incremental.scala:89)
	at sbt.inc.Incremental$.compile(Incremental.scala:61)
	at sbt.inc.IncrementalCompile$.apply(Compile.scala:54)
	at sbt.compiler.IC$.compileInternal(IncrementalCompiler.scala:160)
	at sbt.compiler.IC$.incrementalCompile(IncrementalCompiler.scala:138)
	at sbt.Compiler$.compile(Compiler.scala:128)
	at sbt.Compiler$.compile(Compiler.scala:114)
	at sbt.Defaults$.sbt$Defaults$$compileIncrementalTaskImpl(Defaults.scala:814)
	at sbt.Defaults$$anonfun$compileIncrementalTask$1.apply(Defaults.scala:805)
	at sbt.Defaults$$anonfun$compileIncrementalTask$1.apply(Defaults.scala:803)
	at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
	at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
	at sbt.std.Transform$$anon$4.work(System.scala:63)
	at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
	at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
	at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
	at sbt.Execute.work(Execute.scala:235)
	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
	at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
	at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
[error] (compile:compileIncremental) java.lang.ArrayIndexOutOfBoundsException: -32768
[error] Total time: 14569 s, completed Nov 14, 2016 4:49:27 AM

I tried it on my osx 10.11.6 and my centos 7.2 linux box.
the result is the same:Crash!
The scala source code is 32m byte or 680k line. and it was compiled almost 10 hours until the compiler crash.

@scabug
Copy link
Author

scabug commented Nov 14, 2016

Imported From: https://issues.scala-lang.org/browse/SI-10053?orig=1
Reporter: macgaffin
Affected Versions: 2.11.8

@scabug
Copy link
Author

scabug commented Nov 15, 2016

@lrytz said:
Without a reproducible example, this is unlikely to get fixed. Even then, given the enormous compile time.. I think the right approach is to re-structure that code, even if it's generated.

@scabug scabug added this to the Backlog milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant