class LazyVals
extends MiniPhaseTransform with IdentityDenotTransformer

Constructors

LazyVals ( )

Members

class OffsetInfo

this map contains mutable state of transformation: OffsetDefs to be appended to companion object definitions, and number of bits currently used

this map contains mutable state of transformation: OffsetDefs to be appended to companion object definitions, and number of bits currently used

val appendOffsetDefs : Map [ Symbol, OffsetInfo ]
val containerFlags : FlagSet
val containerFlagsMask : FlagSet
val initFlags : FlagSet
private def addInFront ( prefix: List [ Tree ] , stats: List [ Tree ] ) : List [ A ]
[+] def mkDefNonThreadSafeNonNullable ( target: Symbol , rhs: Tree ) ( implicit ctx: Context ) : If

Create non-threadsafe lazy accessor for not-nullable types equivalent to such code def methodSymbol() = { if (target eq null) { target = rhs target } else...

Create non-threadsafe lazy accessor for not-nullable types equivalent to such code def methodSymbol() = { if (target eq null) { target = rhs target } else target }

def mkNonThreadSafeDef ( target: Tree , flag: Tree , rhs: Tree ) ( implicit ctx: Context ) : If
[+] def mkThreadSafeDef ( methodSymbol: TermSymbol , claz: ClassSymbol , ord: Int , target: Symbol , rhs: Tree , tp: Type , offset: Tree , getFlag: Tree , stateMask: Tree , casFlag: Tree , setFlagState: Tree , waitOnLock: Tree ) ( implicit ctx: Context ) : DefDef

Create a threadsafe lazy accessor equivalent to such code

def methodSymbol(): Int = { val result: Int = 0 val retry: Boolean = true var flag: Long = 0L whi...

Create a threadsafe lazy accessor equivalent to such code

def methodSymbol(): Int = { val result: Int = 0 val retry: Boolean = true var flag: Long = 0L while retry do { flag = dotty.runtime.LazyVals.get(this, $claz.$OFFSET) dotty.runtime.LazyVals.STATE(flag, 0) match { case 0 => if dotty.runtime.LazyVals.CAS(this, $claz.$OFFSET, flag, 1, $ord) { try {result = rhs} catch { case x: Throwable => dotty.runtime.LazyVals.setFlag(this, $claz.$OFFSET, 0, $ord) throw x } $target = result dotty.runtime.LazyVals.setFlag(this, $claz.$OFFSET, 3, $ord) retry = false } case 1 => dotty.runtime.LazyVals.wait4Notification(this, $claz.$OFFSET, flag, $ord) case 2 => dotty.runtime.LazyVals.wait4Notification(this, $claz.$OFFSET, flag, $ord) case 3 => retry = false result = $target } } result }

[+] 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:

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 runsAfter : Set [ Class [ Nothing <: Phase ] ]

List of names of phases that should have finished processing of tree before this phase starts processing same tree

List of names of phases that should have finished processing of tree before this phase starts processing same tree

override def transformDefDef ( tree: DefDef ) ( implicit ctx: Context , info: TransformerInfo ) : Tree
def transformLazyVal ( tree: ValOrDefDef ) ( implicit ctx: Context , info: TransformerInfo ) : Tree
def transformLocalDef ( x: ValOrDefDef ) ( implicit ctx: Context ) : Thicket

Replace a local lazy val inside a method, with a LazyHolder from dotty.runtime(eg dotty.runtime.LazyInt)

Replace a local lazy val inside a method, with a LazyHolder from dotty.runtime(eg dotty.runtime.LazyInt)

def transformMemberDefNonVolatile ( x: ValOrDefDef ) ( implicit ctx: Context ) : Thicket
def transformMemberDefVolatile ( x: ValOrDefDef ) ( implicit ctx: Context ) : Thicket
override def transformStats ( trees: List [ Tree ] ) ( implicit ctx: Context , info: TransformerInfo ) : List [ Tree ]
def transformSyntheticModule ( tree: ValOrDefDef ) ( implicit ctx: Context ) : Thicket

Make an eager val that would implement synthetic module. Eager val ensures thread safety and has less code generated.

Make an eager val that would implement synthetic module. Eager val ensures thread safety and has less code generated.

override def transformTemplate ( template: Template ) ( implicit ctx: Context , info: TransformerInfo ) : Tree

Append offset fields to companion objects

Append offset fields to companion objects

override def transformValDef ( tree: ValDef ) ( implicit ctx: Context , info: TransformerInfo ) : Tree
def transformer : LazyVals