Dotty Documentation

0.5.0-bin-SNAPSHOT

class Simplify
extends MiniPhase with IdentityDenotTransformer

This phase consists of a series of small, simple, local optimisations applied as a fix point transformation over Dotty Trees.

The termination condition uses referential equality on Trees. Furthermore, termination relies of every optimisation to be shrinking transformations.

This phase is intended to be run multiple times in the compilation pipeline. This is due to several reasons: - running this phase early allows to reduce size of compilation unit, speeding up subsequent transformations. - running this phase late allows to eliminate inefficiencies created by previous phase - different patters are easier to optimize at different moments of pipeline

[-] Constructors

Simplify ( )

[-] Members

[+] var CommutativePrimitiveOperations : Set [ Symbol ]
[+] var SeqFactoryClass : Symbol
[+] override val cpy : TypedTreeCopier
[+] var fuel : Int

Optimisation fuel, for debugging. Decremented every time Simplify applies an optimisation until fuel == 0. Original idea from Automatic Isolation of Compiler Errors by David Whalley. Unable with -Yopt-fuel.

The fuel can be used to do a bisection on large test cases that fail -optimise. See compiler/test/bisect.sh for a shell script to automates the bisection search.

[+] var optimisations : List [ Optimisation ]
[+] def CommutativePrimitiveOperations_= ( x$1: Set [ Symbol ] ) : Unit
[+] def SeqFactoryClass_= ( x$1: Symbol ) : Unit
[+] private def afterErasure : List [ Optimisation ]

See comment on beforeErasure

[+] private def beforeErasure : List [ Optimisation ]

The original intention is to run most optimizations both before and after erasure. Erasure creates new inefficiencies as well as new optimization opportunities.

The order of optimizations is tuned to converge faster. Reordering them may require quadratically more rounds to finish.

[+] def fuel_= ( x$1: Int ) : Unit

Optimisation fuel, for debugging. Decremented every time Simplify applies an optimisation until fuel == 0. Original idea from Automatic Isolation of Compiler Errors by David Whalley. Unable with -Yopt-fuel.

The fuel can be used to do a bisection on large test cases that fail -optimise. See compiler/test/bisect.sh for a shell script to automates the bisection search.

[+] def optimisations_= ( x$1: List [ Optimisation ] ) : Unit
[+] override def phaseName : String

A name given to the Phase that can be used to debug the compiler. For instance, it is possible to print trees after a given phase using:

$ ./bin/dotc -Xprint:<phaseNameHere> sourceFile.scala
[+] override def prepareForUnit ( tree: Tree ) ( implicit ctx: Context ) : Context
[+] private def printIfDifferent ( tree1: Tree , tree2: => Tree , opt: Optimisation ) ( implicit ctx: Context ) : Tree
[+] override def transformDefDef ( tree: DefDef ) ( implicit ctx: Context ) : Tree