class
ModuleLowering extends Pass
Instance Constructors
-
new
ModuleLowering()(implicit top: Top)
Value Members
-
final
def
!=(arg0: AnyRef): Boolean
-
final
def
!=(arg0: Any): Boolean
-
final
def
##(): Int
-
final
def
==(arg0: AnyRef): Boolean
-
final
def
==(arg0: Any): Boolean
-
final
def
asInstanceOf[T0]: T0
-
def
clone(): AnyRef
-
final
def
eq(arg0: AnyRef): Boolean
-
def
equals(arg0: Any): Boolean
-
def
finalize(): Unit
-
implicit
def
fresh: Fresh
-
final
def
getClass(): Class[_]
-
def
hashCode(): Int
-
final
def
isInstanceOf[T0]: Boolean
-
def
isStaticModule(name: Global): Boolean
-
final
def
ne(arg0: AnyRef): Boolean
-
final
def
notify(): Unit
-
final
def
notifyAll(): Unit
-
def
onDefn(defn: Defn): Defn
-
def
onDefns(defns: Seq[Defn]): UnrolledBuffer[Defn]
-
def
onInst(inst: Inst): Inst
-
def
onInsts(insts: Seq[Inst]): Seq[Inst]
-
def
onNext(next: Next): Next
-
def
onOp(op: Op): Op
-
def
onType(ty: Type): Type
-
def
onVal(value: Val): Val
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
-
def
toString(): String
-
final
def
wait(): Unit
-
final
def
wait(arg0: Long, arg1: Int): Unit
-
final
def
wait(arg0: Long): Unit
Lowers modules into module classes with singleton instance stored in a global variable that is accessed through a dedicated accessor function.
For example a dynamic module with members:
module $name : $parent, .. $ifaces
.. $members
Translates to:
class $name : $parent, .. $ifaces
.. $members
def load.$name: () => class $name { %entry: %slot = elem[ptr] @modules, $moduleOffset %self = load[class $name] %slot %cond = ieq[class j.l.Object] %instance, null if %cond then %existing else %initialize %existing: ret %self %initialize: %alloc = alloc[class $name] call $name::init(%alloc) store[class $name] %slot, %alloc ret %alloc }