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 d584994d authored by Kunshan Wang's avatar Kunshan Wang
Browse files

Test a "return-value-become-parameter" case of OSR.

parent 694684b2
......@@ -87,7 +87,7 @@ abstract class UvmBundleTesterBase extends FlatSpec with Matchers {
def testFunc(ctx: MuCtx, func: MuFuncRefValue, args: Seq[MuValue])(handler: TrapHandlerFunction): Unit = {
microVM.trapManager.trapHandler = new MockTrapHandler(handler)
microVM.setTrapHandler(new MockTrapHandler(handler))
val hStack = ctx.newStack(func)
val hThread = ctx.newThread(hStack, HowToResume.PassValues(args))
......@@ -134,4 +134,41 @@ class UvmOSRTests extends UvmBundleTesterBase {
* @param funcs many functions. funcs(0) is the bottom function.
* @param args arguments to the top function
def testFuncMulti(ctx: MuCtx, funcs: Seq[MuFuncRefValue], args: Seq[MuValue])(handler: TrapHandlerFunction): Unit = {
microVM.setTrapHandler(new MockTrapHandler(handler))
val hStack = ctx.newStack(funcs(0))
for (f <- funcs.tail) {
ctx.pushFrame(hStack, f)
val hThread = ctx.newThread(hStack, uvm.refimpl.HowToResume.PassValues(args))
"The return values" should "become the parameters of the previous frame" in {
val ctx = microVM.newContext()
val func1 = ctx.handleFromFunc("@consecutive_push_main")
val func2 = ctx.handleFromFunc("@forty_two_returner")
val arg0 = ctx.handleFromInt64(8)
testFuncMulti(ctx, Seq(func1, func2), Seq()) { (ctx, th, st, wp) =>
nameOf(ctx.curInst(st, 0)) match {
case "@consecutive_push_main.v1.entry.trap" => {
val Seq(n: MuIntValue) = ctx.dumpKeepalives(st, 0)
ctx.handleToUInt(n) shouldBe 42
\ No newline at end of file
......@@ -59,3 +59,16 @@
[%trap_opt] TRAP <> KEEPALIVE(%n %i %s)
THROW @NULLREF // unreachable
.funcdef @consecutive_push_main VERSION %v1 <@i_i> {
%entry(<@i64> %n):
[%trap] TRAP <> KEEPALIVE(%n)
COMMINST @uvm.thread_exit
.const @I64_42 <@i64> = 42
.funcdef @forty_two_returner VERSION %v1 <@v_i> {
RET @I64_42
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