Skip to content
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

Remove fibre::{Fiber, Suspend} types #220

Merged
merged 9 commits into from
Sep 3, 2024
Merged

Conversation

frank-emrich
Copy link

This PR performs a refactoring required by a follow-up PR that will implement actual pooling of VMContRefs.

This PR removes the types Fiber and Suspend from the fibre create (i.e., our version of wasmtime-fiber). These two types are effectively leftovers from wasmtime-fiber, but only add a layer of unnecessary indirection at this point.

Note that the fibre::FiberStack type remains. Some functions originally implemented on Fiber are moved to FiberStack now. Further, the VMContRef definition used in the optimized implementation now owns a fibre::FiberStack directly, rather than storing a Fiber as a wrapper around the FiberStack.

This PR does not affect the baseline implementation since it doesn't use the fibre crate at all.

@frank-emrich frank-emrich requested a review from dhil August 30, 2024 15:43
Copy link
Member

@dhil dhil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brilliant!

@frank-emrich
Copy link
Author

This ended up requiring a bit more back-and-forth with the test suite. The culprit is the test where we enable the unsafe_disable_continuation_linearity_check feature and then run cont_twice.wast.

The exact behavior of this test under the hood changed a bit: In the past, it was a mechanism inside the Fiber that detects if a Fiber has run to completion, and panics if you try to run it again afterwards. Since Fiber is gone now, this check does not exist any more. However, this was always somewhat superfluous, because we are already doing the same kind of checking using the VMContRef's state field. But I've had to make sure that we check the state field earlier on in the translation of resume instructions.

Given these headaches, I'm inclined to just remove unsafe_disable_continuation_linearity_check in a follow-up PR. The performance of the linearity check should be good enough so that we don't need to be able to disable it anymore.

@frank-emrich frank-emrich merged commit 6ffb849 into main Sep 3, 2024
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants