Skip to content

Make LinkAll a proper phase #3219

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

Merged
merged 1 commit into from
Oct 1, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions compiler/src/dotty/tools/dotc/transform/LinkAll.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,24 @@ package dotty.tools.dotc.transform
import dotty.tools.dotc.CompilationUnit
import dotty.tools.dotc.ast.Trees._
import dotty.tools.dotc.ast.tpd
import dotty.tools.dotc.core.Phases.Phase
import dotty.tools.dotc.core.Contexts._
import dotty.tools.dotc.core.SymDenotations.ClassDenotation
import dotty.tools.dotc.core.Symbols._
import dotty.tools.dotc.core.Flags._
import dotty.tools.dotc.transform.TreeTransforms._

/** Loads all potentially reachable trees from tasty. ▲
* Only performed on whole world optimization mode. ▲ ▲
*
* TODO: Next step is to only load compilation units reachable in the call graph
*/
class LinkAll extends MiniPhaseTransform {
class LinkAll extends Phase {
import tpd._
import LinkAll._

override def phaseName = "linkAll"
def phaseName: String = "linkAll"

/** Do not transform the any tree, runOn will traverse the trees and reload compilation units if needed */
override def prepareForUnit(tree: tpd.Tree)(implicit ctx: Context): TreeTransform = NoTransform
def run(implicit ctx: Context): Unit = ()

override def runOn(units: List[CompilationUnit])(implicit ctx: Context): List[CompilationUnit] = {
/** Loads and processes new compilation units, possibly loading more units. */
Expand All @@ -35,7 +34,7 @@ class LinkAll extends MiniPhaseTransform {
}
}

if (ctx.settings.XlinkOptimise.value) super.runOn(allUnits(Set.empty, units.toSet, Set.empty))
if (ctx.settings.XlinkOptimise.value) allUnits(Set.empty, units.toSet, Set.empty)
else units
}

Expand Down