WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.7% of users enabled 2FA.

Commit 3884e361 authored by Kunshan Wang's avatar Kunshan Wang
Browse files

WIP: still refactoring...

parent 1595a0e6
......@@ -72,47 +72,28 @@ class IRBuilder(globalBundle: GlobalBundle, idFactory: IDFactory) {
// There are scripts in microvm-refimpl2/migrate_scripts/ to convert this program to the MuCtxIRBuilderPart or the
// common instruction executor. Keep the next line exact
// SCRIPT: BEGIN HERE
def newBundle(): TB = {
val b = new TrantientBundle()
b
}
def getNode(b: TB, id: Int): TopLevel = {
globalBundle.topLevelNs.get(id).getOrElse {
throw new IllegalArgumentException("No top-level entity has id %d".format(id))
}
}
def getID(b: TB, node: ChildNode): Int = {
node.id
}
def setName(b: TB, node: ChildNode, name: String): Unit = {
node.name = Some(validateName(name))
// NOTE: When the name is set, the TrantientBundle's namespaces still do not index the object by its name,
// because the objects are added before their names are set. But by the time when the TrantientBundle is merged with
// the GlobalBundle, all objects in all namespaces will have been re-added to the GlobalBundle. For this reason,
// globalBundle.someNs.get("@the.name.of.object") will still return the object as long as it has a name.
}
def load(): Unit = ???
def abort(): Unit = ???
def genSym(name: Option[String]): Unit = ???
// format: OFF
def newTypeInt (b: TB, len: Int): TypeInt = newObj(b.typeNs, TypeInt(len))
def newTypeFloat (b: TB): TypeFloat = newObj(b.typeNs, TypeFloat())
def newTypeDouble (b: TB): TypeDouble = newObj(b.typeNs, TypeDouble())
def newTypeUPtr (b: TB): TypeUPtr = newObj(b.typeNs, TypeUPtr(null))
def newTypeUFuncPtr (b: TB): TypeUFuncPtr = newObj(b.typeNs, TypeUFuncPtr(null))
def newTypeVoid (b: TB): TypeVoid = newObj(b.typeNs, TypeVoid())
def newTypeRef (b: TB): TypeRef = newObj(b.typeNs, TypeRef(null))
def newTypeIRef (b: TB): TypeIRef = newObj(b.typeNs, TypeIRef(null))
def newTypeWeakRef (b: TB): TypeWeakRef = newObj(b.typeNs, TypeWeakRef(null))
def newTypeFuncRef (b: TB): TypeFuncRef = newObj(b.typeNs, TypeFuncRef(null))
def newTypeTagRef64 (b: TB): TypeTagRef64 = newObj(b.typeNs, TypeTagRef64())
def newTypeThreadRef (b: TB): TypeThreadRef = newObj(b.typeNs, TypeThreadRef())
def newTypeStackRef (b: TB): TypeStackRef = newObj(b.typeNs, TypeStackRef())
def newTypeFrameCursorRef(b: TB): TypeFrameCursorRef = newObj(b.typeNs, TypeFrameCursorRef())
def newTypeIRNodeRef (b: TB): TypeIRNodeRef = newObj(b.typeNs, TypeIRNodeRef())
def newTypeInt (id: MuID, len: Int): Unit = ???
def newTypeFloat (id: MuID): Unit = ???
def newTypeDouble (id: MuID): Unit = ???
def newTypeUPtr (id: MuID): Unit = ???
def newTypeUFuncPtr (id: MuID): Unit = ???
def newTypeVoid (id: MuID): Unit = ???
def newTypeRef (id: MuID): Unit = ???
def newTypeIRef (id: MuID): Unit = ???
def newTypeWeakRef (id: MuID): Unit = ???
def newTypeFuncRef (id: MuID): Unit = ???
def newTypeTagRef64 (id: MuID): Unit = ???
def newTypeThreadRef (id: MuID): Unit = ???
def newTypeStackRef (id: MuID): Unit = ???
def newTypeFrameCursorRef(id: MuID): Unit = ???
def newTypeIRBuilderRef (id: MuID): Unit = ???
def newTypeStruct(b: TB, fieldTys: Seq[Type]): TypeStruct = newObj(b.typeNs, TypeStruct(fieldTys))
def newTypeHybrid(b: TB, fixedTys: Seq[Type], varTy: Type): TypeHybrid = newObj(b.typeNs, TypeHybrid(fixedTys, varTy))
......@@ -207,67 +188,6 @@ class IRBuilder(globalBundle: GlobalBundle, idFactory: IDFactory) {
}
}
def addDest(inst: Instruction, kind: DestKind.Value, bb: BB, vars: Seq[Var]): Unit = {
val destClause = DestClause(bb, vars)
kind match {
case DestKind.NORMAL => inst match {
case i: InstBranch => i.dest = destClause
case i: HasExcClause => getOrCreateExcClause(i).nor = destClause
case i => {
throw new IllegalArgumentException(
"NORMAL requires BRANCH or instructions with exception clause. Found: %s".format(i.getClass.getName))
}
}
case DestKind.EXCEPT => inst match {
case i: HasExcClause => getOrCreateExcClause(i).exc = destClause
case i: InstWatchPoint => {
i.exc = Some(destClause)
}
case i => {
throw new IllegalArgumentException(
"EXCEPT requires WATCHPOINT or instructions with exception clause. Found: %s".format(i.getClass.getName))
}
}
case DestKind.TRUE => inst match {
case i: InstBranch2 => i.ifTrue = destClause
case i => {
throw new IllegalArgumentException(
"TRUE requires BRANCH2. Found: %s".format(i.getClass.getName))
}
}
case DestKind.FALSE => inst match {
case i: InstBranch2 => i.ifFalse = destClause
case i => {
throw new IllegalArgumentException(
"FALSE requires BRANCH2. Found: %s".format(i.getClass.getName))
}
}
case DestKind.DEFAULT => inst match {
case i: InstSwitch => i.defDest = destClause
case i => {
throw new IllegalArgumentException(
"DEFAULT requires SWITCH. Found: %s".format(i.getClass.getName))
}
}
case DestKind.DISABLED => inst match {
case i: InstWatchPoint => i.dis = destClause
case i: InstWPBranch => i.dis = destClause
case i => {
throw new IllegalArgumentException(
"DISABLED requires WATCHPOINT OR WPBRANCH. Found: %s".format(i.getClass.getName))
}
}
case DestKind.ENABLED => inst match {
case i: InstWatchPoint => i.ena = destClause
case i: InstWPBranch => i.ena = destClause
case i => {
throw new IllegalArgumentException(
"ENABLED requires WATCHPOINT OR WPBRANCH. Found: %s".format(i.getClass.getName))
}
}
}
}
def addKeepalives(inst: HasKeepaliveClause, lvs: Seq[LocalVariable]): Unit = {
inst.keepalives = lvs
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment