From a06695749e5a146775f0b640c8a5234f63b19f10 Mon Sep 17 00:00:00 2001 From: butterunderflow Date: Sun, 1 Dec 2024 12:01:19 +0800 Subject: [PATCH] cleanup --- src/main/scala/wasm/MiniWasmFX.scala | 3 +- src/test/scala/genwasym/TestFx.scala | 44 +++++++++++++--------------- 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/src/main/scala/wasm/MiniWasmFX.scala b/src/main/scala/wasm/MiniWasmFX.scala index 443b38d9..aa47e0cb 100644 --- a/src/main/scala/wasm/MiniWasmFX.scala +++ b/src/main/scala/wasm/MiniWasmFX.scala @@ -220,9 +220,8 @@ case class EvaluatorFX(module: ModuleInstance) { // resumable try-catch exception handling: case TryCatch(es1, es2) => - // push trail1 to join point + // put trail1 into join point val join: MCont[Ans] = (newStack) => eval(rest, stack, frame, kont, trail1, mkont, trail2, h) - // todo: update comment here // here we clear the trail2, to forbid breaking out of the try-catch block val newHandler: Handler[Ans] = (newStack) => eval(es2, newStack, frame, init: Cont[Ans], List(), join, List(), h) eval(es1, List(), frame, init: Cont[Ans], List(), join, List(), newHandler) diff --git a/src/test/scala/genwasym/TestFx.scala b/src/test/scala/genwasym/TestFx.scala index 5cd0104f..c953c933 100644 --- a/src/test/scala/genwasym/TestFx.scala +++ b/src/test/scala/genwasym/TestFx.scala @@ -132,29 +132,6 @@ class TestFx extends FunSuite { testFileOutput("./benchmarks/wasm/trycatch/try_catch_block.wat", List(1, 2, 3, 4, 5)) } - // Note: the interaction between try-catch and block is not well-defined yet - - - /* REAL WASMFX STUFF */ - - // TODO: test after implemented cont_bind3 - // test("simple script") { - // TestWastFile("./benchmarks/wasm/wasmfx/cont_bind3.bin.wast") - // } - - // test("cont") { - // // testFile("./benchmarks/wasm/wasmfx/callcont.wast", None, ExpInt(11)) - // testWastFile("./benchmarks/wasm/wasmfx/callcont.bin.wast") - // } - - test("resume w/o suspend") { - testWastFile("./benchmarks/wasm/wasmfx/resume1.bin.wast") - } - - // test("test_cont") { - // testFile("./benchmarks/wasm/wasmfx/test_cont-strip.wast") - // } - test("try-catch-br2") { testFileOutput("./benchmarks/wasm/trycatch/try_catch_br2.wat", List(1, 2, 6, 4, 5)) } @@ -181,4 +158,25 @@ class TestFx extends FunSuite { test("try-catch-catch-br") { testFileOutput("./benchmarks/wasm/trycatch/try_catch_catch_br.wat", List(1, 2, 6, 4, 6, 5)) } + + /* REAL WASMFX STUFF */ + + // TODO: test after implemented cont_bind3 + // test("simple script") { + // TestWastFile("./benchmarks/wasm/wasmfx/cont_bind3.bin.wast") + // } + + // test("cont") { + // // testFile("./benchmarks/wasm/wasmfx/callcont.wast", None, ExpInt(11)) + // testWastFile("./benchmarks/wasm/wasmfx/callcont.bin.wast") + // } + + test("resume w/o suspend") { + testWastFile("./benchmarks/wasm/wasmfx/resume1.bin.wast") + } + + // test("test_cont") { + // testFile("./benchmarks/wasm/wasmfx/test_cont-strip.wast") + // } + }