Package

scala.tools.nsc

transform

Permalink

package transform

Content Hierarchy
Visibility
  1. Public
  2. All

Type Members

  1. abstract class AddInterfaces extends SubComponent with InfoTransform

    Permalink
  2. abstract class CleanUp extends Statics with Transform with TreeDSL

    Permalink
  3. abstract class Constructors extends Statics with Transform with TreeDSL

    Permalink

    This phase converts classes with parameters into Java-like classes with fields, which are assigned to from constructors.

  4. abstract class Delambdafy extends SubComponent with Transform with TypingTransformers with TreeDSL with TypeAdaptingTransformer

    Permalink

    This transformer is responsible for preparing lambdas for runtime, by either translating to anonymous classes or to a tree that will be convereted to invokedynamic by the JVM 1.8+ backend.

    This transformer is responsible for preparing lambdas for runtime, by either translating to anonymous classes or to a tree that will be convereted to invokedynamic by the JVM 1.8+ backend.

    The main assumption it makes is that a lambda {args => body} has been turned into {args => liftedBody()} where lifted body is a top level method that implements the body of the lambda. Currently Uncurry is responsible for that transformation.

    From a lambda, Delambdafy will create:

    Under -target:jvm-1.7 and below:

    1) a new top level class that a) has fields and a constructor taking the captured environment (including possibly the "this" reference) b) an apply method that calls the target method c) if needed a bridge method for the apply method 2) an instantiation of the newly created class which replaces the lambda

    Under -target:jvm-1.8 with GenBCode:

    1) An application of the captured arguments to a fictional symbol representing the lambda factory. This will be translated by the backed into an invokedynamic using a bootstrap method in JDK8's LambdaMetaFactory. The captured arguments include this if liftedBody is unable to be made STATIC.

  5. abstract class Erasure extends AddInterfaces with reflect.internal.transform.Erasure with Analyzer with TypingTransformers with TreeDSL with TypeAdaptingTransformer

    Permalink
  6. abstract class ExplicitOuter extends SubComponent with InfoTransform with TypingTransformers with TreeDSL

    Permalink

    This class ...

    This class ...

    Version

    1.0

  7. abstract class ExtensionMethods extends SubComponent with Transform with TypingTransformers

    Permalink

    Perform Step 1 in the inline classes SIP: Creates extension methods for all methods in a value class, except parameter or super accessors, or constructors.

    Perform Step 1 in the inline classes SIP: Creates extension methods for all methods in a value class, except parameter or super accessors, or constructors.

    Version

    2.10

  8. abstract class Flatten extends SubComponent with InfoTransform

    Permalink
  9. trait InfoTransform extends SubComponent with Transform

    Permalink

    An InfoTransform contains a compiler phase that transforms trees and symbol infos -- making sure they stay consistent.

    An InfoTransform contains a compiler phase that transforms trees and symbol infos -- making sure they stay consistent. The symbol info is transformed assuming it is consistent right before this phase. The info transformation is triggered by Symbol::rawInfo, which caches the results in the symbol's type history. This way sym.info (during an enteringPhase(p)) can look up what the symbol's info should look like at the beginning of phase p. (If the transformed info had not been stored yet, rawInfo will compute the info by composing the info-transformers of the most recent phase before p, up to the transformer of the phase right before p.)

    Concretely, enteringPhase(p) { sym.info } yields the info *before* phase p has transformed it. Imagine you're a phase and it all makes sense.

  10. trait InlineErasure extends AnyRef

    Permalink
  11. abstract class LambdaLift extends SubComponent with InfoTransform

    Permalink
  12. abstract class LazyVals extends SubComponent with Transform with TypingTransformers with TreeDSL

    Permalink
  13. abstract class Mixin extends SubComponent with InfoTransform with TreeDSL

    Permalink
  14. abstract class OverridingPairs extends SymbolPairs

    Permalink

    A class that yields a kind of iterator (Cursor), which yields pairs of corresponding symbols visible in some base class, unless there's a parent class that already contains the same pairs.

    A class that yields a kind of iterator (Cursor), which yields pairs of corresponding symbols visible in some base class, unless there's a parent class that already contains the same pairs. Most of the logic is in SymbolPairs, which contains generic pair-oriented traversal logic.

  15. trait PostErasure extends SubComponent with InfoTransform with TypingTransformers with reflect.internal.transform.PostErasure

    Permalink

    This phase maps ErasedValueTypes to the underlying unboxed representation and performs peephole optimizations.

  16. abstract class SampleTransform extends SubComponent with Transform

    Permalink

    A sample transform.

  17. abstract class SpecializeTypes extends SubComponent with InfoTransform with TypingTransformers

    Permalink

    Specialize code on types.

    Specialize code on types.

    Make sure you've read the thesis:

    Iulian Dragos: Compiling Scala for Performance (chapter 4)

    There are some things worth noting, (possibly) not mentioned there: 0) Make sure you understand the meaning of various SpecializedInfo descriptors defined below.

    1) Specializing traits by introducing bridges in specialized methods of the specialized trait may introduce problems during mixin composition. Concretely, it may cause cyclic calls and result in a stack overflow. See ticket #4351. This was solved by introducing an Abstract specialized info descriptor. Instead of generating a bridge in the trait, an abstract method is generated.

    2) Specialized private members sometimes have to be switched to protected. In some cases, even this is not enough. Example:

    class A[@specialized T](protected val d: T) {
      def foo(that: A[T]) = that.d
    }

    Specialization will generate a specialized class and a specialized method:

    class A$mcI$sp(protected val d: Int) extends A[Int] {
      def foo(that: A[Int]) = foo$mcI$sp(that)
      def foo(that: A[Int]) = that.d
    }

    Above, A$mcI$sp cannot access d, so the method cannot be typechecked.

  18. abstract class Statics extends SubComponent with Transform with TreeDSL

    Permalink
  19. abstract class TailCalls extends SubComponent with Transform

    Permalink

    Perform tail recursive call elimination.

    Perform tail recursive call elimination.

    Version

    1.0

  20. trait Transform extends SubComponent

    Permalink

    A base class for transforms.

    A base class for transforms.

    A transform contains a compiler phase which applies a tree transformer.

    Version

    1.0

  21. trait TypeAdaptingTransformer extends AnyRef

    Permalink

    A trait usable by transforms that need to adapt trees of one type to another type

  22. trait TypingTransformers extends AnyRef

    Permalink

    A base class for transforms.

    A base class for transforms. A transform contains a compiler phase which applies a tree transformer.

  23. abstract class UnCurry extends SubComponent with InfoTransform with reflect.internal.transform.UnCurry with TypingTransformers with TreeDSL

    Permalink

    - uncurry all symbol and tree types (@see UnCurryPhase) -- this includes normalizing all proper types.

    - uncurry all symbol and tree types (@see UnCurryPhase) -- this includes normalizing all proper types.

    • for every curried parameter list: (ps_1) ... (ps_n) ==> (ps_1, ..., ps_n)
    • for every curried application: f(args_1)...(args_n) ==> f(args_1, ..., args_n)
    • for every type application: f[Ts] ==> f[Ts]() unless followed by parameters
    • for every use of a parameterless function: f ==> f() and q.f ==> q.f()
    • for every def-parameter: x: => T ==> x: () => T
    • for every use of a def-parameter: x ==> x.apply()
    • for every argument to a def parameter x: => T': if argument is not a reference to a def parameter: convert argument e to (expansion of) () => e'
    • for every repeated Scala parameter x: T*' --> x: Seq[T].
    • for every repeated Java parameter x: T...' --> x: Array[T], except: if T is an unbounded abstract type, replace --> x: Array[Object]
    • for every method defining repeated parameters annotated with @varargs, generate a synthetic Java-style vararg method
    • for every argument list that corresponds to a repeated Scala parameter (a_1, ..., a_n) => (Seq(a_1, ..., a_n))
    • for every argument list that corresponds to a repeated Java parameter (a_1, ..., a_n) => (Array(a_1, ..., a_n))
    • for every argument list that is an escaped sequence (a_1:_*) => (a_1) (possibly converted to sequence or array, as needed)
    • convert implicit method types to method types
    • convert non-trivial catches in try statements to matches
    • convert non-local returns to throws with enclosing try statements.
    • convert try-catch expressions in contexts where there might be values on the stack to a local method and a call to it (since an exception empties the evaluation stack):

    meth(x_1,..., try { x_i } catch { ..}, .. x_b0) ==> { def liftedTry$1 = try { x_i } catch { .. } meth(x_1, .., liftedTry$1(), .. ) }

    • remove calls to elidable methods and replace their bodies with NOPs when elide-below requires it

Value Members

  1. package patmat

    Permalink

Ungrouped