-
Notifications
You must be signed in to change notification settings - Fork 2
Add switch to fiber interface, support fiber_switch in asyncify implementation
#15
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
base: main
Are you sure you want to change the base?
Conversation
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
This patch:
fiber-switch.hwith a new fiber operationfiber_switch.hello_switch.cthat usesfiber_switch.fiber_switchwhich works with the test program above.