Closed
Description
I just did this:
/Users/odersky/workspace/dotty/src/dotty/tools/dotc> time java -Xms1g -Xmx3g dotty.tools.dotc.Main -d /classes *.scala */*.scala */*/*.scala
And then did it again (with /classes at the head of the classpath)
I got at first:
Exception in thread "main" java.lang.NoClassDefFoundError: Ldotty/tools/dotc/core/Phases$PhasesBase$TerminalPhase$;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2575)
at java.lang.Class.getDeclaredField(Class.java:2060)
at dotty.runtime.LazyVals$.getOffset(LazyVals.scala:71)
This pointed to a problem that somewhere a reference to a removed empty companion object survived. I disabled the dropEmptyCompanion phase and then that part worked. (I instrumented the "getOffset" method and got this.
/Users/odersky/workspace/dotty/src/dotty/tools/dotc> time java -Xms1g -Xmx3g dotty.tools.dotc.Main -d /classes *.scala */*.scala */*/*.scala
getting offset of class dotty.tools.dotc.core.Contexts$ContextBase . bitmap$0
getting offset of class dotty.tools.dotc.config.PathResolver . bitmap$0
getting offset of class dotty.tools.dotc.core.Contexts$Context . bitmap$0
getting offset of class dotty.tools.dotc.core.unpickleScala2.Scala2Unpickler . bitmap$0
getting offset of class dotty.tools.dotc.core.StdNames$ScalaNames . bitmap$0
getting offset of class dotty.tools.dotc.core.classfile.ClassfileParser . bitmap$0
getting offset of class dotty.tools.dotc.transform.PatternMatcher$Translator . bitmap$0
getting offset of class dotty.tools.dotc.transform.PatternMatcher$Translator . bitmap$0
getting offset of class dotty.tools.dotc.core.Definitions . bitmap$0
getting offset of class dotty.tools.dotc.core.StdNames$ScalaTermNames . bitmap$0
getting offset of class dotty.tools.dotc.typer.VarianceChecker . bitmap$0
So, this is fine. But after some more time compiling with the bootstrapped compiler, I got this:
Exception in thread "main" java.lang.ClassCastException: dotty.tools.dotc.core.Types$CachedThisType cannot be cast to dotty.tools.dotc.core.Types$TypeRef
at dotty.tools.dotc.core.TypeApplications$.$anonfun$appliedTo$extension3$1(TypeApplications.scala:484)
at dotty.tools.dotc.core.TypeApplications$$$Lambda$405/2114444063.apply(Unknown Source)
This raises the following questions:
- Do we really use the bootstrapped dotty compiler in partest-bootstrapped? It seems this is impossible, given the failures I have observed.
- Eliminating empty companion objects is very important: generated code went up from ~30K blocks to ~34K blocks, a 13.3% increase, after dropEmptyCompanions was disabled. But it seems very hard to do in a miniphase (not sure about the backend). Concretely in the case at hand I believe an accessor got copied into the inheriting class Context. When eliminating the companion object of the base class
Phases #TerminalPhase
, that accessor was overlooked. Is it even possible to remove all accessors in separate compilation? - Where does the classcast exception come from?
Metadata
Metadata
Assignees
Labels
No labels