Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
butterunderflow committed Dec 1, 2024
1 parent 602d7e0 commit a066957
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 25 deletions.
3 changes: 1 addition & 2 deletions src/main/scala/wasm/MiniWasmFX.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
44 changes: 21 additions & 23 deletions src/test/scala/genwasym/TestFx.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand All @@ -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")
// }

}

0 comments on commit a066957

Please sign in to comment.