@@ -91,15 +91,18 @@ Seen from a temporal perspective, the `dotc` compiler consists of a list of
91
91
phases. The current list of phases is specified in class [ Compiler] as follows:
92
92
93
93
``` scala
94
- def phases : List [List [Phase ]] =
94
+ def phases : List [List [Phase ]] =
95
95
frontendPhases ::: picklerPhases ::: transformPhases ::: backendPhases
96
96
97
97
/** Phases dealing with the frontend up to trees ready for TASTY pickling */
98
98
protected def frontendPhases : List [List [Phase ]] =
99
99
List (new FrontEnd ) :: // Compiler frontend: scanner, parser, namer, typer
100
+ List (new YCheckPositions ) :: // YCheck positions
101
+ List (new Staging ) :: // Check PCP, heal quoted types and expand macros
100
102
List (new sbt.ExtractDependencies ) :: // Sends information on classes' dependencies to sbt via callbacks
101
103
List (new PostTyper ) :: // Additional checks and cleanups after type checking
102
104
List (new sbt.ExtractAPI ) :: // Sends a representation of the API of classes to sbt via callbacks
105
+ List (new SetRootTree ) :: // Set the `rootTreeOrProvider` on class symbols
103
106
Nil
104
107
105
108
/** Phases dealing with TASTY tree pickling and unpickling */
@@ -113,25 +116,26 @@ phases. The current list of phases is specified in class [Compiler] as follows:
113
116
List (new FirstTransform , // Some transformations to put trees into a canonical form
114
117
new CheckReentrant , // Internal use only: Check that compiled program has no data races involving global vars
115
118
new ElimPackagePrefixes , // Eliminate references to package prefixes in Select nodes
116
- new CookComments ) :: // Cook the comments: expand variables, doc, etc.
119
+ new CookComments , // Cook the comments: expand variables, doc, etc.
120
+ new CompleteJavaEnums ) :: // Fill in constructors for Java enums
117
121
List (new CheckStatic , // Check restrictions that apply to @static members
118
122
new ElimRepeated , // Rewrite vararg parameters and arguments
119
123
new ExpandSAMs , // Expand single abstract method closures to anonymous classes
120
124
new ProtectedAccessors , // Add accessors for protected members
121
125
new ExtensionMethods , // Expand methods of value classes with extension methods
126
+ new CacheAliasImplicits , // Cache RHS of parameterless alias implicits
122
127
new ShortcutImplicits , // Allow implicit functions without creating closures
123
128
new ByNameClosures , // Expand arguments to by-name parameters to closures
124
- new LiftTry , // Put try expressions that might execute on non-empty stacks into their own methods
125
129
new HoistSuperArgs , // Hoist complex arguments of supercalls to enclosing scope
126
130
new ClassOf , // Expand `Predef.classOf` calls.
127
131
new RefChecks ) :: // Various checks mostly related to abstract members and overriding
128
- List (new TryCatchPatterns , // Compile cases in try/catch
132
+ List (new ElimOpaque , // Turn opaque into normal aliases
133
+ new TryCatchPatterns , // Compile cases in try/catch
129
134
new PatternMatcher , // Compile pattern matches
130
135
new ExplicitOuter , // Add accessors to outer classes from nested ones.
131
136
new ExplicitSelf , // Make references to non-trivial self types explicit as casts
132
137
new StringInterpolatorOpt , // Optimizes raw and s string interpolators by rewriting them to string concatentations
133
- new CrossCastAnd , // Normalize selections involving intersection types.
134
- new Splitter ) :: // Expand selections involving union types into conditionals
138
+ new CrossCastAnd ) :: // Normalize selections involving intersection types.
135
139
List (new PruneErasedDefs , // Drop erased definitions from scopes and simplify erased expressions
136
140
new VCInlineMethods , // Inlines calls to value class methods
137
141
new SeqLiterals , // Express vararg arguments as arrays
@@ -140,13 +144,16 @@ phases. The current list of phases is specified in class [Compiler] as follows:
140
144
new ElimByName , // Expand by-name parameter references
141
145
new CollectNullableFields , // Collect fields that can be nulled out after use in lazy initialization
142
146
new ElimOuterSelect , // Expand outer selections
143
- new AugmentScala2Traits , // Expand traits defined in Scala 2.x to simulate old-style rewritings
144
- new ResolveSuper , // Implement super accessors and add forwarders to trait methods
147
+ new AugmentScala2Traits , // Augments Scala2 traits with additional members needed for mixin composition.
148
+ new ResolveSuper , // Implement super accessors
145
149
new FunctionXXLForwarders , // Add forwarders for FunctionXXL apply method
150
+ new TupleOptimizations , // Optimize generic operations on tuples
146
151
new ArrayConstructors ) :: // Intercept creation of (non-generic) arrays and intrinsify.
147
152
List (new Erasure ) :: // Rewrite types to JVM model, erasing all type parameters, abstract types and refinements.
148
153
List (new ElimErasedValueType , // Expand erased value types to their underlying implmementation types
149
154
new VCElideAllocations , // Peep-hole optimization to eliminate unnecessary value class allocations
155
+ new ArrayApply , // Optimize `scala.Array.apply([....])` and `scala.Array.apply(..., [....])` into `[...]`
156
+ new ElimPolyFunction , // Rewrite PolyFunction subclasses to FunctionN subclasses
150
157
new TailRec , // Rewrite tail recursion to loops
151
158
new Mixin , // Expand trait fields and trait initializers
152
159
new LazyVals , // Expand lazy vals
@@ -156,8 +163,10 @@ phases. The current list of phases is specified in class [Compiler] as follows:
156
163
List (new Constructors , // Collect initialization code in primary constructors
157
164
// Note: constructors changes decls in transformTemplate, no InfoTransformers should be added after it
158
165
new FunctionalInterfaces , // Rewrites closures to implement @specialized types of Functions.
159
- new GetClass ) :: // Rewrites getClass calls on primitive types.
160
- List (new LinkScala2Impls , // Redirect calls to trait methods defined by Scala 2.x, so that they now go to their implementations
166
+ new Instrumentation , // Count closure allocations under -Yinstrument-closures
167
+ new GetClass , // Rewrites getClass calls on primitive types.
168
+ new LiftTry ) :: // Put try expressions that might execute on non-empty stacks into their own methods their implementations
169
+ List (new LinkScala2Impls , // Redirect calls to trait methods defined by Scala 2.x, so that they now go to
161
170
new LambdaLift , // Lifts out nested functions to class scope, storing free variables in environments
162
171
// Note: in this mini-phase block scopes are incorrect. No phases that rely on scopes should be here
163
172
new ElimStaticThis ) :: // Replace `this` references to static objects by global identifiers
@@ -168,12 +177,14 @@ phases. The current list of phases is specified in class [Compiler] as follows:
168
177
new ExpandPrivate , // Widen private definitions accessed from nested classes
169
178
new RestoreScopes , // Repair scopes rendered invalid by moving definitions in prior phases of the group
170
179
new SelectStatic , // get rid of selects that would be compiled into GetStatic
180
+ new sjs.JUnitBootstrappers , // Generate JUnit-specific bootstrapper classes for Scala.js (not enabled by default)
171
181
new CollectEntryPoints , // Find classes with main methods
172
182
new CollectSuperCalls ) :: // Find classes that are called with super
173
183
Nil
174
184
175
185
/** Generate the output of the compilation */
176
186
protected def backendPhases : List [List [Phase ]] =
187
+ List (new sjs.GenSJSIR ) :: // Generate .sjsir files for Scala.js (not enabled by default)
177
188
List (new GenBCode ) :: // Generate JVM bytecode
178
189
Nil
179
190
```
0 commit comments