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.

Commit e250d63a authored by Kunshan Wang's avatar Kunshan Wang
Browse files

Rewritten interpreter with syntax sugars.

parent d584994d
...@@ -29,18 +29,18 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner { ...@@ -29,18 +29,18 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner {
case "@uvm.new_stack" => { case "@uvm.new_stack" => {
val Seq(sig) = sigList val Seq(sig) = sigList
val Seq(func) = argList val Seq(func) = argList
val funcVal = boxOf(func).asInstanceOf[BoxFunc].func.getOrElse { val funcVal = func.asFunc.getOrElse {
throw new UvmRuntimeException(ctx + "Attempt to create new thread for NULL Mu function.") throw new UvmRuntimeException(ctx + "Attempt to create new thread for NULL Mu function.")
} }
val sta = microVM.threadStackManager.newStack(funcVal, mutator) val sta = microVM.threadStackManager.newStack(funcVal, mutator)
resultBox(0).asInstanceOf[BoxStack].stack = Some(sta) resultBox(0).asStack = Some(sta)
continueNormally() continueNormally()
} }
case "@uvm.kill_stack" => { case "@uvm.kill_stack" => {
val Seq(s) = argList val Seq(s) = argList
val sta = boxOf(s).asInstanceOf[BoxStack].stack.getOrElse { val sta = s.asStack.getOrElse {
throw new UvmRuntimeException(ctx + "Attempt to kill NULL stack.") throw new UvmRuntimeException(ctx + "Attempt to kill NULL stack.")
} }
sta.kill() sta.kill()
...@@ -52,8 +52,7 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner { ...@@ -52,8 +52,7 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner {
} }
case "@uvm.current_stack" => { case "@uvm.current_stack" => {
val bi = resultBox(0) results(0).asStack = Some(curStack)
bi.asInstanceOf[BoxStack].stack = stack
continueNormally() continueNormally()
} }
...@@ -61,59 +60,48 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner { ...@@ -61,59 +60,48 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner {
case "@uvm.tr64.is_fp" => { case "@uvm.tr64.is_fp" => {
val Seq(tr) = argList val Seq(tr) = argList
val raw = boxOf(tr).asInstanceOf[BoxTagRef64].raw results(0).asBoolean = OpHelper.tr64IsFp(tr.asTR64Raw)
val result = OpHelper.tr64IsFp(raw)
writeBooleanResult(result, resultBox(0))
continueNormally() continueNormally()
} }
case "@uvm.tr64.is_int" => { case "@uvm.tr64.is_int" => {
val Seq(tr) = argList val Seq(tr) = argList
val raw = boxOf(tr).asInstanceOf[BoxTagRef64].raw results(0).asBoolean = OpHelper.tr64IsInt(tr.asTR64Raw)
val result = OpHelper.tr64IsInt(raw)
writeBooleanResult(result, resultBox(0))
continueNormally() continueNormally()
} }
case "@uvm.tr64.is_ref" => { case "@uvm.tr64.is_ref" => {
val Seq(tr) = argList val Seq(tr) = argList
val raw = boxOf(tr).asInstanceOf[BoxTagRef64].raw results(0).asBoolean = OpHelper.tr64IsRef(tr.asTR64Raw)
val result = OpHelper.tr64IsRef(raw)
writeBooleanResult(result, resultBox(0))
continueNormally() continueNormally()
} }
case "@uvm.tr64.from_fp" => { case "@uvm.tr64.from_fp" => {
val Seq(v) = argList val Seq(v) = argList
val vFP = boxOf(v).asInstanceOf[BoxDouble].value results(0).asTR64Raw = OpHelper.fpToTr64(v.asDouble)
val raw = OpHelper.fpToTr64(vFP)
resultBox(0).asInstanceOf[BoxTagRef64].raw = raw
continueNormally() continueNormally()
} }
case "@uvm.tr64.from_int" => { case "@uvm.tr64.from_int" => {
val Seq(v) = argList val Seq(v) = argList
val vInt = OpHelper.prepareUnsigned(boxOf(v).asInstanceOf[BoxInt].value, 52) results(0).asTR64Raw = OpHelper.intToTr64(v.getUInt(52).longValue)
val raw = OpHelper.intToTr64(vInt.longValue())
resultBox(0).asInstanceOf[BoxTagRef64].raw = raw
continueNormally() continueNormally()
} }
case "@uvm.tr64.from_ref" => { case "@uvm.tr64.from_ref" => {
val Seq(ref, tag) = argList val Seq(ref, tag) = argList
val vRef = boxOf(ref).asInstanceOf[BoxRef].objRef val vRef = ref.asRef
val vTag = OpHelper.prepareUnsigned(boxOf(tag).asInstanceOf[BoxInt].value, 6) val vTag = tag.getSInt(6).longValue
val raw = OpHelper.refToTr64(vRef, vTag.longValue()) resultBox(0).asTR64Raw = OpHelper.refToTr64(vRef, vTag)
resultBox(0).asInstanceOf[BoxTagRef64].raw = raw
continueNormally() continueNormally()
} }
case "@uvm.tr64.to_fp" => { case "@uvm.tr64.to_fp" => {
val Seq(tr) = argList val Seq(tr) = argList
val raw = boxOf(tr).asInstanceOf[BoxTagRef64].raw val raw = tr.asTR64Raw
if (OpHelper.tr64IsFp(raw)) { if (OpHelper.tr64IsFp(raw)) {
val result = OpHelper.tr64ToFp(raw) val result = OpHelper.tr64ToFp(raw)
resultBox(0).asInstanceOf[BoxDouble].value = result results(0).asDouble = result
continueNormally() continueNormally()
} else { } else {
throw new UvmRuntimeException(ctx + "Attempt to extract double from a tagref64 which is not holding a double") throw new UvmRuntimeException(ctx + "Attempt to extract double from a tagref64 which is not holding a double")
...@@ -122,10 +110,10 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner { ...@@ -122,10 +110,10 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner {
case "@uvm.tr64.to_int" => { case "@uvm.tr64.to_int" => {
val Seq(tr) = argList val Seq(tr) = argList
val raw = boxOf(tr).asInstanceOf[BoxTagRef64].raw val raw = tr.asTR64Raw
if (OpHelper.tr64IsInt(raw)) { if (OpHelper.tr64IsInt(raw)) {
val result = OpHelper.tr64ToInt(raw) val result = OpHelper.tr64ToInt(raw)
resultBox(0).asInstanceOf[BoxInt].value = OpHelper.unprepare(result, 52) results(0).setInt(result, 52)
continueNormally() continueNormally()
} else { } else {
throw new UvmRuntimeException(ctx + "Attempt to extract int from a tagref64 which is not holding a int") throw new UvmRuntimeException(ctx + "Attempt to extract int from a tagref64 which is not holding a int")
...@@ -134,10 +122,10 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner { ...@@ -134,10 +122,10 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner {
case "@uvm.tr64.to_ref" => { case "@uvm.tr64.to_ref" => {
val Seq(tr) = argList val Seq(tr) = argList
val raw = boxOf(tr).asInstanceOf[BoxTagRef64].raw val raw = tr.asTR64Raw
if (OpHelper.tr64IsRef(raw)) { if (OpHelper.tr64IsRef(raw)) {
val result = OpHelper.tr64ToRef(raw) val result = OpHelper.tr64ToRef(raw)
resultBox(0).asInstanceOf[BoxRef].objRef = result results(0).asRef = result
continueNormally() continueNormally()
} else { } else {
throw new UvmRuntimeException(ctx + "Attempt to extract ref from a tagref64 which is not holding a ref") throw new UvmRuntimeException(ctx + "Attempt to extract ref from a tagref64 which is not holding a ref")
...@@ -146,10 +134,10 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner { ...@@ -146,10 +134,10 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner {
case "@uvm.tr64.to_tag" => { case "@uvm.tr64.to_tag" => {
val Seq(tr) = argList val Seq(tr) = argList
val raw = boxOf(tr).asInstanceOf[BoxTagRef64].raw val raw = tr.asTR64Raw
if (OpHelper.tr64IsRef(raw)) { if (OpHelper.tr64IsRef(raw)) {
val result = OpHelper.tr64ToTag(raw) val result = OpHelper.tr64ToTag(raw)
resultBox(0).asInstanceOf[BoxInt].value = OpHelper.unprepare(result, 6) results(0).setInt(result, 6)
continueNormally() continueNormally()
} else { } else {
throw new UvmRuntimeException(ctx + "Attempt to extract tag from a tagref64 which is not holding a ref") throw new UvmRuntimeException(ctx + "Attempt to extract tag from a tagref64 which is not holding a ref")
...@@ -157,17 +145,15 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner { ...@@ -157,17 +145,15 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner {
} }
case "@uvm.futex.wait" => { case "@uvm.futex.wait" => {
val Seq(ty) = typeList val Seq(ty: TypeInt) = typeList
val Seq(loc, v) = argList val Seq(loc, v) = argList
val len = ty.asInstanceOf[TypeInt].length val len = ty.length
val bLoc = boxOf(loc).asInstanceOf[BoxIRef] val (objRef, offset) = loc.asIRef
val objRef = bLoc.objRef
val offset = bLoc.offset
val locWord = objRef + offset val locWord = objRef + offset
val bv = boxOf(v).asInstanceOf[BoxInt] val exp = v.asIntRaw
val equal = MemoryOperations.cmpInt(len, locWord, bv) val equal = MemoryOperations.cmpInt(len, locWord, exp)
if (equal) { if (equal) {
microVM.threadStackManager.futexManager.futexWaitNoCheck(objRef, offset, curThread, None) microVM.threadStackManager.futexManager.futexWaitNoCheck(objRef, offset, curThread, None)
...@@ -179,21 +165,18 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner { ...@@ -179,21 +165,18 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner {
} }
case "@uvm.futex.wait_timeout" => { case "@uvm.futex.wait_timeout" => {
val Seq(ty) = typeList val Seq(ty: TypeInt) = typeList
val Seq(loc, v, timeout) = argList val Seq(loc, v, timeout) = argList
val len = ty.asInstanceOf[TypeInt].length val len = ty.length
val bLoc = boxOf(loc).asInstanceOf[BoxIRef] val (objRef, offset) = loc.asIRef
val objRef = bLoc.objRef
val offset = bLoc.offset
val locWord = objRef + offset val locWord = objRef + offset
val bv = boxOf(v).asInstanceOf[BoxInt] val toVal = timeout.asSInt64.longValue
val bto = boxOf(timeout).asInstanceOf[BoxInt] val exp = v.asIntRaw
val toVal = OpHelper.prepareSigned(bto.value, 64).longValue
if (toVal < 0L) throw new UvmRefImplException(ctx + "This refimpl treats timeout as signed due to restriction of Java.") if (toVal < 0L) throw new UvmRefImplException(ctx + "This refimpl treats timeout as signed due to restriction of Java.")
val equal = MemoryOperations.cmpInt(len, locWord, bv) val equal = MemoryOperations.cmpInt(len, locWord, exp)
if (equal) { if (equal) {
microVM.threadStackManager.futexManager.futexWaitNoCheck(objRef, offset, curThread, Some(toVal)) microVM.threadStackManager.futexManager.futexWaitNoCheck(objRef, offset, curThread, Some(toVal))
...@@ -205,15 +188,13 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner { ...@@ -205,15 +188,13 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner {
} }
case "@uvm.futex.wake" => { case "@uvm.futex.wake" => {
val Seq(ty) = typeList val Seq(ty: TypeInt) = typeList
val Seq(loc, nthread) = argList val Seq(loc, nthread) = argList
val len = ty.asInstanceOf[TypeInt].length val len = ty.length
val bLoc = boxOf(loc).asInstanceOf[BoxIRef] val (objRef, offset) = loc.asIRef
val objRef = bLoc.objRef
val offset = bLoc.offset
val locWord = objRef + offset val locWord = objRef + offset
val nth = OpHelper.prepareSigned(boxOf(nthread).asInstanceOf[BoxInt].value, 32).intValue val nth = nthread.asSInt32.intValue
if (nth < 0) throw new UvmRuntimeException(ctx + "nthread must not be negative") if (nth < 0) throw new UvmRuntimeException(ctx + "nthread must not be negative")
...@@ -226,14 +207,14 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner { ...@@ -226,14 +207,14 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner {
val Seq(locSrc, locDst, expected, nthread) = argList val Seq(locSrc, locDst, expected, nthread) = argList
val len = ty.asInstanceOf[TypeInt].length val len = ty.asInstanceOf[TypeInt].length
val (objRefSrc, offsetSrc) = boxOf(locSrc).asInstanceOf[BoxIRef].oo val (objRefSrc, offsetSrc) = locSrc.asIRef
val (objRefDst, offsetDst) = boxOf(locDst).asInstanceOf[BoxIRef].oo val (objRefDst, offsetDst) = locDst.asIRef
val bExp = boxOf(expected).asInstanceOf[BoxInt] val exp = expected.asIntRaw
val nth = OpHelper.prepareSigned(boxOf(nthread).asInstanceOf[BoxInt].value, 32).intValue val nth = nthread.asSInt32.intValue
if (nth < 0) throw new UvmRuntimeException(ctx + "nthread must not be negative") if (nth < 0) throw new UvmRuntimeException(ctx + "nthread must not be negative")
val equal = MemoryOperations.cmpInt(len, objRefSrc + offsetSrc, bExp) val equal = MemoryOperations.cmpInt(len, objRefSrc + offsetSrc, exp)
if (equal) { if (equal) {
val nWoken = microVM.threadStackManager.futexManager.futexRequeue(objRefSrc, offsetSrc, objRefDst, offsetDst, nth) val nWoken = microVM.threadStackManager.futexManager.futexRequeue(objRefSrc, offsetSrc, objRefDst, offsetDst, nth)
...@@ -255,8 +236,8 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner { ...@@ -255,8 +236,8 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner {
val Seq(r) = argList val Seq(r) = argList
val (addr, offset) = ty match { val (addr, offset) = ty match {
case TypeRef(_) => (boxOf(r).asInstanceOf[BoxRef].objRef, 0L) case TypeRef(_) => (r.asRef, 0L)
case TypeIRef(_) => boxOf(r).asInstanceOf[BoxIRef].oo case TypeIRef(_) => r.asIRef
} }
pin(addr) pin(addr)
...@@ -270,8 +251,8 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner { ...@@ -270,8 +251,8 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner {
val Seq(r) = argList val Seq(r) = argList
val addr = ty match { val addr = ty match {
case TypeRef(_) => boxOf(r).asInstanceOf[BoxRef].objRef case TypeRef(_) => r.asRef
case TypeIRef(_) => boxOf(r).asInstanceOf[BoxIRef].objRef case TypeIRef(_) => r.asIRef._1
} }
unpin(addr) unpin(addr)
...@@ -284,11 +265,11 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner { ...@@ -284,11 +265,11 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner {
val Seq(sig) = sigList val Seq(sig) = sigList
val Seq(func, cookie) = argList val Seq(func, cookie) = argList
val f = boxOf(func).asInstanceOf[BoxFunc].func.getOrElse { val f = func.asFunc.getOrElse {
throw new UvmRuntimeException(ctx + "Attempt to expose NULL Mu function") throw new UvmRuntimeException(ctx + "Attempt to expose NULL Mu function")
} }
val c = boxOf(cookie).asInstanceOf[BoxInt].value.toLong val c = boxOf(cookie).asSInt64.longValue
val addr = microVM.nativeCallHelper.exposeFuncDynamic(f, c) val addr = microVM.nativeCallHelper.exposeFuncDynamic(f, c)
...@@ -301,7 +282,7 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner { ...@@ -301,7 +282,7 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner {
val Seq(callConv) = flagList val Seq(callConv) = flagList
val Seq(addr) = argList val Seq(addr) = argList
val a = boxOf(addr).asInstanceOf[BoxPointer].addr val a = addr.asPtr
microVM.nativeCallHelper.unexposeFunc(a) microVM.nativeCallHelper.unexposeFunc(a)
...@@ -310,34 +291,34 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner { ...@@ -310,34 +291,34 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner {
case "@uvm.native.get_cookie" => { case "@uvm.native.get_cookie" => {
val cookie = topDefMu.cookie val cookie = topDefMu.cookie
resultBox(0).asInstanceOf[BoxInt].value = OpHelper.trunc(cookie, 64) results(0).asInt64 = cookie
continueNormally() continueNormally()
} }
case "@uvm.meta.id_of" => { case "@uvm.meta.id_of" => {
val Seq(name) = argList val Seq(name) = argList
val nameStr = MemoryOperations.bytesToStr(boxOf(name).asInstanceOf[BoxRef].objRef) val nameStr = MemoryOperations.bytesToStr(name.asRef)
val theID = microVM.idOf(nameStr) val theID = microVM.idOf(nameStr)
resultBox(0).asInstanceOf[BoxInt].value = OpHelper.unprepare(theID, 32) results(0).asInt32 = theID
continueNormally() continueNormally()
} }
case "@uvm.meta.name_of" => { case "@uvm.meta.name_of" => {
val Seq(theID) = argList val Seq(theID) = argList
val idInt = boxOf(theID).asInstanceOf[BoxInt].value.toInt val idInt = theID.asSInt32.toInt
val name = microVM.nameOf(idInt) val name = microVM.nameOf(idInt)
val bytesRef = MemoryOperations.strToBytes(name) val bytesRef = MemoryOperations.strToBytes(name)
resultBox(0).asInstanceOf[BoxRef].objRef = bytesRef results(0).asRef = bytesRef
continueNormally() continueNormally()
} }
case "@uvm.meta.load_bundle" => { case "@uvm.meta.load_bundle" => {
val Seq(bundle) = argList val Seq(bundle) = argList
val bundleStr = MemoryOperations.bytesToStr(boxOf(bundle).asInstanceOf[BoxRef].objRef) val bundleStr = MemoryOperations.bytesToStr(bundle.asRef)
MetaOperations.loadBundle(bundleStr) MetaOperations.loadBundle(bundleStr)
...@@ -346,7 +327,7 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner { ...@@ -346,7 +327,7 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner {
case "@uvm.meta.load_hail" => { case "@uvm.meta.load_hail" => {
val Seq(hailScript) = argList val Seq(hailScript) = argList
val hailStr = MemoryOperations.bytesToStr(boxOf(hailScript).asInstanceOf[BoxRef].objRef) val hailStr = MemoryOperations.bytesToStr(hailScript.asRef)
MetaOperations.loadHail(hailStr) MetaOperations.loadHail(hailStr)
...@@ -358,17 +339,17 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner { ...@@ -358,17 +339,17 @@ trait CommInstExecutor extends InterpreterActions with ObjectPinner {
??? ???
} }
case "@uvm.meta.cur_func_ver" => ??? case "@uvm.meta.cur_func_ver" => ???
case "@uvm.meta.cur_inst" => ??? case "@uvm.meta.cur_inst" => ???
case "@uvm.meta.dump_keepalives" => ??? case "@uvm.meta.dump_keepalives" => ???
case "@uvm.meta.pop_frame" => ??? case "@uvm.meta.pop_frame" => ???
case "@uvm.meta.push_frame" => ??? case "@uvm.meta.push_frame" => ???
case "@uvm.meta.enable_watchpoint" => ??? case "@uvm.meta.enable_watchpoint" => ???
case "@uvm.meta.disable_watchpoint" => ??? case "@uvm.meta.disable_watchpoint" => ???
case "@uvm.meta.set_trap_handler" => ??? case "@uvm.meta.set_trap_handler" => ???
// Insert more CommInsts here. // Insert more CommInsts here.
......
...@@ -40,7 +40,7 @@ class InterpreterThread(val id: Int, initialStack: InterpreterStack, val mutator ...@@ -40,7 +40,7 @@ class InterpreterThread(val id: Int, initialStack: InterpreterStack, val mutator
htr match { htr match {
case HowToResume.PassValues(values) => rebindPassValues(initialStack, values) case HowToResume.PassValues(values) => rebindPassValues(initialStack, values)
case HowToResume.ThrowExc(exc) => catchException(exc) case HowToResume.ThrowExc(exc) => catchException(exc)
} }
} }
...@@ -87,7 +87,7 @@ trait InterpreterThreadState { ...@@ -87,7 +87,7 @@ trait InterpreterThreadState {
protected def ctx = stack match { protected def ctx = stack match {
case None => "(Thred not bound to stack): " case None => "(Thred not bound to stack): "
case Some(s) => s.top match { case Some(s) => s.top match {
case f: NativeFrame => "TID %d, Native frame for function 0x%x: ".format(id, f.func) case f: NativeFrame => "TID %d, Native frame for function 0x%x: ".format(id, f.func)
case f: UndefinedMuFrame => "TID %d, Function %s (not defined): ".format(id, f.func.repr) case f: UndefinedMuFrame => "TID %d, Function %s (not defined): ".format(id, f.func.repr)
case f: DefinedMuFrame => { case f: DefinedMuFrame => {
val ix = f.curInstIndex val ix = f.curInstIndex
...@@ -96,7 +96,7 @@ trait InterpreterThreadState { ...@@ -96,7 +96,7 @@ trait InterpreterThreadState {
} else { } else {
"TID %d, FuncVer %s, BB %s, Inst(%d): %s (%s): ".format(id, f.funcVer.repr, curBB.repr, ix, curInst.repr, curInst match { "TID %d, FuncVer %s, BB %s, Inst(%d): %s (%s): ".format(id, f.funcVer.repr, curBB.repr, ix, curInst.repr, curInst match {
case ci: InstCommInst => ci.inst.name.get case ci: InstCommInst => ci.inst.name.get
case _ => curInst.getClass.getSimpleName() case _ => curInst.getClass.getSimpleName()
}) })
} }
} }
...@@ -106,12 +106,15 @@ trait InterpreterThreadState { ...@@ -106,12 +106,15 @@ trait InterpreterThreadState {
/** Get the value box of an SSA variable in the current stack. */ /** Get the value box of an SSA variable in the current stack. */
protected def boxOf(v: SSAVariable): ValueBox = v match { protected def boxOf(v: SSAVariable): ValueBox = v match {
case g: GlobalVariable => microVM.constantPool.getGlobalVarBox(g) case g: GlobalVariable => microVM.constantPool.getGlobalVarBox(g)
case l: LocalVariable => topDefMu.boxes(l) case l: LocalVariable => topDefMu.boxes(l)
} }
/** Get the edge-assigned value box of an edge-assigned instruction in the current stack. */ /** Get the edge-assigned value box of an edge-assigned instruction in the current stack. */
protected def edgeAssignedBoxOf(p: Parameter): ValueBox = topDefMu.edgeAssignedBoxes(p) protected def edgeAssignedBoxOf(p: Parameter): ValueBox = topDefMu.edgeAssignedBoxes(p)
/** Results (SSA Variables) of the current instruction. */
protected def results = curInst.results
/** Get the result boxes of the current instruction. */ /** Get the result boxes of the current instruction. */
protected def resultBoxes: Seq[ValueBox] = curInst.results.map(boxOf) protected def resultBoxes: Seq[ValueBox] = curInst.results.map(boxOf)
...@@ -154,7 +157,7 @@ trait InterpreterActions extends InterpreterThreadState { ...@@ -154,7 +157,7 @@ trait InterpreterActions extends InterpreterThreadState {
curInst.asInstanceOf[InstCommInst].inst.name.get) curInst.asInstanceOf[InstCommInst].inst.name.get)
logger.debug(ctx + "Setting futex return value") logger.debug(ctx + "Setting futex return value")
writeIntResult(32, rv, resultBoxes(0)) results(0).asInt32 = rv
continueNormally() continueNormally()
} }
...@@ -165,7 +168,7 @@ trait InterpreterActions extends InterpreterThreadState { ...@@ -165,7 +168,7 @@ trait InterpreterActions extends InterpreterThreadState {
topMu.justCreated = false topMu.justCreated = false