Skip to content

Commit 6706b9e

Browse files
committed
Do not insert -Yretain-trees when compiling with -tasty
1 parent fdbab48 commit 6706b9e

File tree

7 files changed

+39
-13
lines changed

7 files changed

+39
-13
lines changed

compiler/src/dotty/tools/dotc/core/SymbolLoaders.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ class ClassfileLoader(val classfile: AbstractFile) extends SymbolLoader {
326326
val (classRoot, moduleRoot) = rootDenots(root.asClass)
327327
val classfileParser = new ClassfileParser(classfile, classRoot, moduleRoot)(ctx)
328328
val result = classfileParser.run()
329-
if (ctx.settings.YretainTrees.value || ctx.settings.XlinkOptimise.value) {
329+
if (mayLoadTreesFromTasty) {
330330
result match {
331331
case Some(unpickler: tasty.DottyUnpickler) =>
332332
classRoot.symbol.asClass.unpickler = unpickler
@@ -335,6 +335,9 @@ class ClassfileLoader(val classfile: AbstractFile) extends SymbolLoader {
335335
}
336336
}
337337
}
338+
339+
private def mayLoadTreesFromTasty(implicit ctx: Context): Boolean =
340+
ctx.settings.YretainTrees.value || ctx.settings.XlinkOptimise.value || ctx.settings.tasty.value
338341
}
339342

340343
class SourcefileLoader(val srcfile: AbstractFile) extends SymbolLoader {

compiler/src/dotty/tools/dotc/fromtasty/ReadTastyTreesFromClasses.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ class ReadTastyTreesFromClasses extends FrontEnd {
2020

2121
def readTASTY(unit: CompilationUnit)(implicit ctx: Context): Option[CompilationUnit] = unit match {
2222
case unit: TASTYCompilationUnit =>
23-
assert(ctx.settings.YretainTrees.value)
2423
val className = unit.className.toTypeName
2524
def compilationUnit(className: TypeName): Option[CompilationUnit] = {
2625
tree(className).flatMap {

compiler/test/dotty/tools/vulpix/ParallelTesting.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,7 @@ trait ParallelTesting extends RunnerOrchestration { self =>
10991099
val target = JointCompilationSource(
11001100
testGroup.name,
11011101
Array(sourceFile),
1102-
flags.withClasspath(tastySource.getPath) and "-Yretain-trees",
1102+
flags.withClasspath(tastySource.getPath) and "-tasty",
11031103
tastySource,
11041104
fromTasty = true
11051105
)

dist/bin/dotc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ case "$1" in
8181
# Optimize for short-running applications, see https://github.com/lampepfl/dotty/issues/222
8282
-Oshort) addJava "-XX:+TieredCompilation -XX:TieredStopAtLevel=1" && shift ;;
8383
-repl) PROG_NAME="$ReplMain" && shift ;;
84-
-tasty) addScala "-Yretain-trees" && PROG_NAME="$CompilerMain" && shift ;;
8584
-compile) PROG_NAME="$CompilerMain" && shift ;;
8685
-run) PROG_NAME="$ReplMain" && shift ;;
8786
-bootcp) bootcp=true && shift ;;

project/Build.scala

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -623,17 +623,11 @@ object Build {
623623
val args0: List[String] = spaceDelimited("<arg>").parsed.toList
624624
val args = args0.filter(arg => arg != "-repl")
625625

626-
val tasty = args0.contains("-tasty")
627-
628626
val main =
629627
if (repl) "dotty.tools.repl.Main"
630628
else "dotty.tools.dotc.Main"
631629

632-
val extraArgs =
633-
if (tasty && !args.contains("-Yretain-trees")) List("-Yretain-trees")
634-
else Nil
635-
636-
val fullArgs = main :: extraArgs ::: insertClasspathInArgs(args, dottyLib)
630+
val fullArgs = main :: insertClasspathInArgs(args, dottyLib)
637631

638632
(runMain in Compile).toTask(fullArgs.mkString(" ", " ", ""))
639633
}

project/scripts/sbtBootstrappedTests

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,34 @@
22

33
# check that benchmarks can run
44
./project/scripts/sbt "dotty-bench-bootstrapped/jmh:run 1 1 tests/pos/alias.scala"
5+
6+
7+
# setup for `dotc`/`dotr` script tests
8+
./project/scripts/sbt dist-bootstrapped/pack
9+
10+
# check that `dotc` compiles and `dotr` runs it
11+
echo "testing sbt dotc and dotr"
12+
mkdir out/scriptedtest0
13+
./dist-bootstrapped/target/pack/bin/dotc tests/pos/sbtDotrTest.scala -d out/scriptedtest0
14+
# FIXME #3477
15+
#./dist-bootstrapped/target/pack/bin/dotr -classpath out/scriptedtest0 dotrtest.Test" > sbtdotr1.out
16+
#if grep -e "dotr test ok" sbtdotr1.out; then
17+
# echo "output ok"
18+
#else
19+
# exit -1
20+
#fi
21+
22+
23+
# check that `dotc` compiles and `dotr` runs it
24+
echo "testing sbt dotc -tasty and dotr -classpath"
25+
mkdir out/scriptedtest1
26+
mkdir out/scriptedtest2
27+
./dist-bootstrapped/target/pack/bin/dotc tests/pos/sbtDotrTest.scala -d out/scriptedtest1/
28+
./dist-bootstrapped/target/pack/bin/dotc -tasty -classpath out/scriptedtest1/ -d out/scriptedtest2/ dotrtest.Test
29+
# FIXME #3477
30+
#./dist-bootstrapped/target/pack/bin/dotr -classpath out/scriptedtest2/ dotrtest.Test" > sbtdotr2.out
31+
#if grep -e "dotr test ok" sbtdotr2.out; then
32+
# echo "output ok"
33+
#else
34+
# exit -1
35+
#fi

project/scripts/sbtTests

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# check that benchmarks can run
44
./project/scripts/sbt "dotty-bench/jmh:run 1 1 tests/pos/alias.scala"
55

6-
# check that `dotc` compiles and `dotr` runs it
6+
# check that `sbt dotc` compiles and `sbt dotr` runs it
77
echo "testing sbt dotc and dotr"
88
mkdir out/scriptedtest0
99
./project/scripts/sbt ";dotc tests/pos/sbtDotrTest.scala -d out/scriptedtest0 ;dotr -classpath out/scriptedtest0 dotrtest.Test" > sbtdotr1.out
@@ -13,7 +13,7 @@ else
1313
exit -1
1414
fi
1515

16-
# check that `dotc` compiles and `dotr` runs it
16+
# check that `sbt dotc` compiles and `sbt dotr` runs it
1717
echo "testing sbt dotc -tasty and dotr -classpath"
1818
mkdir out/scriptedtest1
1919
mkdir out/scriptedtest2

0 commit comments

Comments
 (0)