Commit b8e74486 authored by Kunshan Wang's avatar Kunshan Wang

Implemented the @kill_dependency instruction.

parent ee0fd07d
......@@ -32,4 +32,5 @@ object CommInsts extends SimpleNamespace[CommInst] {
commInst(0x222, "@uvm.futex.wake")
commInst(0x223, "@uvm.futex.cmp_requeue")
commInst(0x230, "@uvm.kill_dependency")
}
\ No newline at end of file
......@@ -130,6 +130,7 @@ object TypeInferer {
case "@uvm.futex.wait_timeout" => I32
case "@uvm.futex.wake" => I32
case "@uvm.futex.cmp_requeue" => I32
case "@uvm.kill_dependency" => i.typeList(0)
}
}
}
\ No newline at end of file
......@@ -971,6 +971,13 @@ class InterpreterThread(val id: Int, microVM: MicroVM, initialStack: Interpreter
}
}
case "@uvm.kill_dependency" => {
val Seq(v) = argList
val vBox = boxOf(v)
boxOf(i).copyFrom(vBox)
continueNormally()
}
// Insert more CommInsts here.
case ciName => {
......
......@@ -1139,4 +1139,20 @@ class UvmInterpreterSpec extends UvmBundleTesterBase {
ca.close()
}
"COMMINST @uvm.kill_dependency" should "do nothing" in {
val ca = microVM.newClientAgent()
val func = ca.putFunction("@testdependency")
testFunc(ca, func, Seq()) { (ca, th, st, wp) =>
val Seq(b) = ca.dumpKeepalives(st, 0)
b.vb.asSInt(64) shouldBe 3
TrapRebindPassVoid(st)
}
ca.close()
}
}
\ No newline at end of file
......@@ -829,3 +829,10 @@
COMMINST @uvm.thread_exit
}
.funcdef @testdependency VERSION @testdependency_v1 <@noparamsnoret> () {
%entry:
%a = ADD <@i64> @I64_1 @I64_2
%b = COMMINST @uvm.kill_dependency <@i64> (%a)
TRAP <@void> KEEPALIVE (%b)
COMMINST @uvm.thread_exit
}
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