@@ -38,54 +38,55 @@ class Compiler {
38
38
*/
39
39
def phases : List [List [Phase ]] =
40
40
List (
41
- List (new FrontEnd ),
42
- List (new PostTyper ),
43
- List (new Pickler ),
44
- List (new FirstTransform ,
45
- new CheckReentrant ),
46
- List (new RefChecks ,
47
- new CheckStatic ,
48
- new ElimRepeated ,
49
- new NormalizeFlags ,
50
- new ExtensionMethods ,
51
- new ExpandSAMs ,
52
- new TailRec ,
53
- new LiftTry ,
54
- new ClassOf ),
55
- List (new PatternMatcher ,
56
- new ExplicitOuter ,
57
- new ExplicitSelf ,
58
- new CrossCastAnd ,
59
- new Splitter ),
60
- List (new VCInlineMethods ,
61
- new SeqLiterals ,
62
- new InterceptedMethods ,
63
- new Getters ,
64
- new ElimByName ,
65
- new AugmentScala2Traits ,
66
- new ResolveSuper ),
67
- List (new Erasure ),
68
- List (new ElimErasedValueType ,
69
- new VCElideAllocations ,
70
- new Mixin ,
71
- new LazyVals ,
72
- new Memoize ,
73
- new LinkScala2ImplClasses ,
74
- new NonLocalReturns ,
75
- new CapturedVars , // capturedVars has a transformUnit: no phases should introduce local mutable vars here
76
- new Constructors , // constructors changes decls in transformTemplate, no InfoTransformers should be added after it
77
- new FunctionalInterfaces ,
78
- new GetClass ), // getClass transformation should be applied to specialized methods
79
- List (new LambdaLift , // in this mini-phase block scopes are incorrect. No phases that rely on scopes should be here
80
- new ElimStaticThis ,
81
- new Flatten ,
82
- // new DropEmptyCompanions,
83
- new RestoreScopes ),
84
- List (new ExpandPrivate ,
85
- new CollectEntryPoints ,
86
- new LabelDefs ),
87
- List (new GenSJSIR ),
88
- List (new GenBCode )
41
+ List (new FrontEnd ), // Compiler frontend: scanner, parser, namer, typer
42
+ List (new PostTyper ), // Additional checks and cleanups after type checking
43
+ List (new Pickler ), // Generate TASTY info
44
+ List (new FirstTransform , // Some transformations to put trees into a canonical form
45
+ new CheckReentrant ), // Internal use only: Check that compiled program has no data races involving global vars
46
+ List (new RefChecks , // Various checks mostly related to abstract members and overriding
47
+ new CheckStatic , // Check restrictions that apply to @static members
48
+ new ElimRepeated , // Rewrite vararg parameters and arguments
49
+ new NormalizeFlags , // Rewrite some definition flags
50
+ new ExtensionMethods , // Expand methods of value classes with extension methods
51
+ new ExpandSAMs , // Expand single abstract method closures to anonymous classes
52
+ new TailRec , // Rewrite tail recursion to loops
53
+ new LiftTry , // Put try expressions that might execute on non-empty stacks into their own methods
54
+ new ClassOf ), // Expand `Predef.classOf` calls.
55
+ List (new PatternMatcher , // Compile pattern matches
56
+ new ExplicitOuter , // Add accessors to outer classes from nested ones.
57
+ new ExplicitSelf , // Make references to non-trivial self types explicit as casts
58
+ new CrossCastAnd , // Normalize selections involving intersection types.
59
+ new Splitter ), // Expand selections involving union types into conditionals
60
+ List (new VCInlineMethods , // Inlines calls to value class methods
61
+ new SeqLiterals , // Express vararg arguments as arrays
62
+ new InterceptedMethods , // Special handling of `==`, `|=`, `getClass` methods
63
+ new Getters , // Replace non-private vals and vars with getter defs (fields are added later)
64
+ new ElimByName , // Expand by-name parameters and arguments
65
+ new AugmentScala2Traits , // Expand traits defined in Scala 2.11 to simulate old-style rewritings
66
+ new ResolveSuper ), // Implement super accessors and add forwarders to trait methods
67
+ List (new Erasure ), // Rewrite types to JVM model, erasing all type parameters, abstract types and refinements.
68
+ List (new ElimErasedValueType , // Expand erased value types to their underlying implmementation types
69
+ new VCElideAllocations , // Peep-hole optimization to eliminate unnecessary value class allocations
70
+ new Mixin , // Expand trait fields and trait initializers
71
+ new LazyVals , // Expand lazy vals
72
+ new Memoize , // Add private fields to getters and setters
73
+ new LinkScala2ImplClasses , // Forward calls to the implementation classes of traits defined by Scala 2.11
74
+ new NonLocalReturns , // Expand non-local returns
75
+ new CapturedVars , // Represent vars captured by closures as heap objects
76
+ new Constructors , // Collect initialization code in primary constructors
77
+ // Note: constructors changes decls in transformTemplate, no InfoTransformers should be added after it
78
+ new FunctionalInterfaces ,// Rewrites closures to implement @specialized types of Functions.
79
+ new GetClass ), // Rewrites getClass calls on primitive types.
80
+ List (new LambdaLift , // Lifts out nested functions to class scope, storing free variables in environments
81
+ // Note: in this mini-phase block scopes are incorrect. No phases that rely on scopes should be here
82
+ new ElimStaticThis , // Replace `this` references to static objects by global identifiers
83
+ new Flatten , // Lift all inner classes to package scope
84
+ new RestoreScopes ), // Repair scopes rendered invalid by moving definitions in prior phases of the group
85
+ List (new ExpandPrivate , // Widen private definitions accessed from nested classes
86
+ new CollectEntryPoints , // Find classes with main methods
87
+ new LabelDefs ), // Converts calls to labels to jumps
88
+ List (new GenSJSIR ), // Generate .js code
89
+ List (new GenBCode ) // Generate JVM bytecode
89
90
)
90
91
91
92
var runId = 1
0 commit comments