@@ -99,10 +99,11 @@ phases. The current list of phases is specified in class [Compiler] as follows:
9999 protected def frontendPhases : List [List [Phase ]] =
100100 List (new FrontEnd ) :: // Compiler frontend: scanner, parser, namer, typer
101101 List (new YCheckPositions ) :: // YCheck positions
102- List (new Staging ) :: // Check PCP, heal quoted types and expand macros
103102 List (new sbt.ExtractDependencies ) :: // Sends information on classes' dependencies to sbt via callbacks
104103 List (new semanticdb.ExtractSemanticDB ) :: // Extract info into .semanticdb files
105104 List (new PostTyper ) :: // Additional checks and cleanups after type checking
105+ List (new sjs.PrepJSInterop ) :: // Additional checks and transformations for Scala.js (Scala.js only)
106+ List (new Staging ) :: // Check PCP, heal quoted types and expand macros
106107 List (new sbt.ExtractAPI ) :: // Sends a representation of the API of classes to sbt via callbacks
107108 List (new SetRootTree ) :: // Set the `rootTreeOrProvider` on class symbols
108109 Nil
@@ -119,74 +120,79 @@ phases. The current list of phases is specified in class [Compiler] as follows:
119120 new CheckReentrant , // Internal use only: Check that compiled program has no data races involving global vars
120121 new ElimPackagePrefixes , // Eliminate references to package prefixes in Select nodes
121122 new CookComments , // Cook the comments: expand variables, doc, etc.
122- new CompleteJavaEnums ) :: // Fill in constructors for Java enums
123- List (new CheckStatic , // Check restrictions that apply to @static members
124- new ElimRepeated , // Rewrite vararg parameters and arguments
123+ new CheckStatic , // Check restrictions that apply to @static members
124+ new BetaReduce , // Reduce closure applications
125+ new init.Checker ) :: // Check initialization of objects
126+ List (new ElimRepeated , // Rewrite vararg parameters and arguments
125127 new ExpandSAMs , // Expand single abstract method closures to anonymous classes
126128 new ProtectedAccessors , // Add accessors for protected members
127129 new ExtensionMethods , // Expand methods of value classes with extension methods
128- new CacheAliasImplicits , // Cache RHS of parameterless alias implicits
129- new ShortcutImplicits , // Allow implicit functions without creating closures
130+ new UncacheGivenAliases , // Avoid caching RHS of simple parameterless given aliases
130131 new ByNameClosures , // Expand arguments to by-name parameters to closures
131132 new HoistSuperArgs , // Hoist complex arguments of supercalls to enclosing scope
132- new ClassOf , // Expand `Predef.classOf` calls.
133+ new SpecializeApplyMethods , // Adds specialized methods to FunctionN
133134 new RefChecks ) :: // Various checks mostly related to abstract members and overriding
134135 List (new ElimOpaque , // Turn opaque into normal aliases
135136 new TryCatchPatterns , // Compile cases in try/catch
136137 new PatternMatcher , // Compile pattern matches
138+ new sjs.ExplicitJSClasses , // Make all JS classes explicit (Scala.js only)
137139 new ExplicitOuter , // Add accessors to outer classes from nested ones.
138140 new ExplicitSelf , // Make references to non-trivial self types explicit as casts
139- new StringInterpolatorOpt , // Optimizes raw and s string interpolators by rewriting them to string concatentations
140- new CrossCastAnd ) :: // Normalize selections involving intersection types.
141+ new ElimByName , // Expand by-name parameter references
142+ new StringInterpolatorOpt ) :: // Optimizes raw and s string interpolators by rewriting them to string concatentations
141143 List (new PruneErasedDefs , // Drop erased definitions from scopes and simplify erased expressions
144+ new InlinePatterns , // Remove placeholders of inlined patterns
142145 new VCInlineMethods , // Inlines calls to value class methods
143146 new SeqLiterals , // Express vararg arguments as arrays
144147 new InterceptedMethods , // Special handling of `==`, `|=`, `getClass` methods
145148 new Getters , // Replace non-private vals and vars with getter defs (fields are added later)
146- new ElimByName , // Expand by-name parameter references
149+ new SpecializeFunctions , // Specialized Function{0,1,2} by replacing super with specialized super
150+ new LiftTry , // Put try expressions that might execute on non-empty stacks into their own methods
147151 new CollectNullableFields , // Collect fields that can be nulled out after use in lazy initialization
148152 new ElimOuterSelect , // Expand outer selections
149- new AugmentScala2Traits , // Augments Scala2 traits so that super accessors are made non-private
150153 new ResolveSuper , // Implement super accessors
151154 new FunctionXXLForwarders , // Add forwarders for FunctionXXL apply method
155+ new ParamForwarding , // Add forwarders for aliases of superclass parameters
152156 new TupleOptimizations , // Optimize generic operations on tuples
157+ new LetOverApply , // Lift blocks from receivers of applications
153158 new ArrayConstructors ) :: // Intercept creation of (non-generic) arrays and intrinsify.
154159 List (new Erasure ) :: // Rewrite types to JVM model, erasing all type parameters, abstract types and refinements.
155160 List (new ElimErasedValueType , // Expand erased value types to their underlying implmementation types
161+ new PureStats , // Remove pure stats from blocks
156162 new VCElideAllocations , // Peep-hole optimization to eliminate unnecessary value class allocations
157163 new ArrayApply , // Optimize `scala.Array.apply([....])` and `scala.Array.apply(..., [....])` into `[...]`
164+ new sjs.AddLocalJSFakeNews , // Adds fake new invocations to local JS classes in calls to `createLocalJSClass`
158165 new ElimPolyFunction , // Rewrite PolyFunction subclasses to FunctionN subclasses
159166 new TailRec , // Rewrite tail recursion to loops
167+ new CompleteJavaEnums , // Fill in constructors for Java enums
160168 new Mixin , // Expand trait fields and trait initializers
161169 new LazyVals , // Expand lazy vals
162170 new Memoize , // Add private fields to getters and setters
163171 new NonLocalReturns , // Expand non-local returns
164172 new CapturedVars ) :: // Represent vars captured by closures as heap objects
165173 List (new Constructors , // Collect initialization code in primary constructors
166174 // Note: constructors changes decls in transformTemplate, no InfoTransformers should be added after it
167- new FunctionalInterfaces , // Rewrites closures to implement @specialized types of Functions.
168- new Instrumentation , // Count closure allocations under -Yinstrument-closures
169- new GetClass , // Rewrites getClass calls on primitive types.
170- new LiftTry ) :: // Put try expressions that might execute on non-empty stacks into their own methods their implementations
175+ new Instrumentation ) :: // Count calls and allocations under -Yinstrument
171176 List (new LambdaLift , // Lifts out nested functions to class scope, storing free variables in environments
172- // Note: in this mini-phase block scopes are incorrect. No phases that rely on scopes should be here
173- new ElimStaticThis ) :: // Replace `this` references to static objects by global identifiers
174- List (new Flatten , // Lift all inner classes to package scope
177+ // Note: in this mini-phase block scopes are incorrect. No phases that rely on scopes should be here
178+ new ElimStaticThis , // Replace `this` references to static objects by global identifiers
179+ new CountOuterAccesses ) :: // Identify outer accessors that can be dropped
180+ List (new DropOuterAccessors , // Drop unused outer accessors
181+ new Flatten , // Lift all inner classes to package scope
175182 new RenameLifted , // Renames lifted classes to local numbering scheme
176183 new TransformWildcards , // Replace wildcards with default values
177184 new MoveStatics , // Move static methods from companion to the class itself
178185 new ExpandPrivate , // Widen private definitions accessed from nested classes
179186 new RestoreScopes , // Repair scopes rendered invalid by moving definitions in prior phases of the group
180187 new SelectStatic , // get rid of selects that would be compiled into GetStatic
181188 new sjs.JUnitBootstrappers , // Generate JUnit-specific bootstrapper classes for Scala.js (not enabled by default)
182- new CollectEntryPoints , // Find classes with main methods
183189 new CollectSuperCalls ) :: // Find classes that are called with super
184190 Nil
185191
186192 /** Generate the output of the compilation */
187193 protected def backendPhases : List [List [Phase ]] =
188- List (new sjs.GenSJSIR ) :: // Generate .sjsir files for Scala.js (not enabled by default)
189- List (new GenBCode ) :: // Generate JVM bytecode
194+ List (new backend. sjs.GenSJSIR ) :: // Generate .sjsir files for Scala.js (not enabled by default)
195+ List (new GenBCode ) :: // Generate JVM bytecode
190196 Nil
191197```
192198
0 commit comments