-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wasmfx #76
wasmfx #76
Conversation
// FIXME: handlers are lost here | ||
kont(s ++ restStack, List(), s1 => k1(s1, List(), m1)) // mkont lost here | ||
val index = trail.indexWhere { case (_, tags) => tags.contains(tagId) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you guarantee you always find the first handler of tag_id
} | ||
val newStack = ContV(kr) :: inputs | ||
hs.find(_._1 == tagId) match { | ||
case Some((_, handler)) => handler(newStack, initK[Ans], List(), mkont) | ||
case Some((_, handler)) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ideally hs.find(_._1 == tagId)
and tags.contains(tagId)
find the same resume
clause
I think this implementation is pretty mature. There's one more thing I want to test. make nested_resume a bit more nested to test whether we are handling Then, we can maybe get rid of meta-continuations for wasmfx |
src/main/scala/wasm/MiniWasmFX.scala
Outdated
val kr = (s: Stack, _: Cont[Ans], t1: Trail[Ans], m1: MCont[Ans], hs1: Handlers[Ans]) => { | ||
val index = trail.indexWhere { case (_, tags) => tags.contains(tagId) } | ||
val newTrail = if (index >= 0) trail.take(index) else trail | ||
kont(s ++ restStack, newTrail ++ t1, m1, hs1) // mkont lost here, and it's safe if we never modify it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we replace newTrail
to just trail.dropRight(1)
. nested-strip.wat
test is the only one that will fail
* implemet multi tag, found bug at suspend16 for forgetting meta-continuation * forgor one test * only the control flow structure for failed suspend16 test * push wast file * newMk doesn't work also * push wast file * revert nested resume * some refactor; add test spec * revert accidental change * use the right remaining stack * rebase on Dinghong's version * check point * refactoring * minor refactor * handler * refactor eval, taking only single inst * try catch * rebase Dinghong's tests * some clean up * unify value repr for cont * test case: throw -> resume -> throw -> no resume * initial impl for wasmfx * unreachable not trap * rm redundant case * fix call ref * create tfp only, delete trail, simplify handlers * simplify contV, comment on handler * this brnach only runs tfp, not fx * reflect fix of return_call in #76 * drafting sem for fused eval * rm comment * support for loop Co-authored-by: Jiaaaaatai <[email protected] * first try with return_call.wast * look at return_call.wast failure * even odd had the same problem, ignore ASSERT_INVALID * forgor * rm wasmfx conflictst * both FX and TFP in CI --------- Co-authored-by: ahuoguo <[email protected]> Co-authored-by: butterunderflow <[email protected]> Co-authored-by: Alex Bai <[email protected]>
This PR is the implementation for wasmfx effect handlers. We added a
Trail
in our semantics, which represents the stack of pure clauses forresume
.TODO (Dec 18):
not dropping
tags
innewTrail
failsHandler
to only take inStack