Add switch to fiber interface, support fiber_switch in asyncify implementation#15
Add switch to fiber interface, support fiber_switch in asyncify implementation#15dhil merged 24 commits intowasmfx:mainfrom
switch to fiber interface, support fiber_switch in asyncify implementation#15Conversation
Co-authored-by: Daniel Hillerström <1827113+dhil@users.noreply.github.com>
…estion, updated the hello world test program accordingly
|
@dhil The new commit tries to do everything you mentioned above, it works with my updated version of
|
dhil
left a comment
There was a problem hiding this comment.
It's looking good. Just a few comments.
Semantically, I think the canonical reduction rule for switch is something like:
[switch] fiber_main(E[fiber_switch(target_E', arg, out)]) ~> fiber_main(E'[(arg, E)])
where E denotes the current evaluation context, and E' subscript denotes the evaluation context of the target, and the notation (arg, E) means substitute arg as the return value in E' and substitute E for out in E'.
inc/fiber_switch.h
Outdated
| /** trying stuff */ | ||
| export("get_active_fiber") | ||
| fiber_t get_active_fiber(void); |
There was a problem hiding this comment.
I don't understand why this is needed -- I would be hesitant to add it, because I think it will be a bit problematic to implement in the WasmFX backend, as we would need to track which fiber is currently executing there too.
There was a problem hiding this comment.
Would if be better if I changed it to something like get_main_fiber, where it returns fiber_main specifically? (where fiber_main is the fiber running the main function of the user program)
Co-authored-by: Daniel Hillerström <1827113+dhil@users.noreply.github.com>
Co-authored-by: Daniel Hillerström <1827113+dhil@users.noreply.github.com>
Co-authored-by: Daniel Hillerström <1827113+dhil@users.noreply.github.com>
Co-authored-by: Daniel Hillerström <1827113+dhil@users.noreply.github.com>
…r_main() to make it work after Daniel's changes
…h switches to a target fiber and destroys the existing one. Added test file racecar.c for `fiber_return_switch`.
Removed `get_main_fiber` function from `fiber_switch.h` Updated test files `hello_switch` and `racecar` to make them work again
Co-authored-by: Daniel Hillerström <1827113+dhil@users.noreply.github.com>
Co-authored-by: Daniel Hillerström <1827113+dhil@users.noreply.github.com>
Co-authored-by: Daniel Hillerström <1827113+dhil@users.noreply.github.com>
Co-authored-by: Daniel Hillerström <1827113+dhil@users.noreply.github.com>
Co-authored-by: Daniel Hillerström <1827113+dhil@users.noreply.github.com>
This patch:
fiber-switch.hwith a new fiber operationfiber_switch.hello_switch.cthat usesfiber_switch.fiber_switchwhich works with the test program above.