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

Split out fiber stacks from fibers. #2741

Merged
merged 4 commits into from
Mar 22, 2021

Conversation

peterhuene
Copy link
Member

This PR splits out a FiberStack from Fiber, allowing the instance
allocator trait to return FiberStack rather than raw stack pointers. This
keeps the stack creation mostly in wasmtime_fiber, but now the on-demand
instance allocator can make use of it.

The instance allocators no longer have to return a "not supported" error to
indicate that the store should allocate its own fiber stack.

This includes a bunch of cleanup in the instance allocator to scope stacks to
the new "async" feature in the runtime.

Closes #2708.

@peterhuene peterhuene force-pushed the refactor-fiber-stacks branch 4 times, most recently from 96324fb to 4ed3160 Compare March 19, 2021 02:45
This commit splits out a `FiberStack` from `Fiber`, allowing the instance
allocator trait to return `FiberStack` rather than raw stack pointers. This
keeps the stack creation mostly in `wasmtime_fiber`, but now the on-demand
instance allocator can make use of it.

The instance allocators no longer have to return a "not supported" error to
indicate that the store should allocate its own fiber stack.

This includes a bunch of cleanup in the instance allocator to scope stacks to
the new "async" feature in the runtime.

Closes bytecodealliance#2708.
@peterhuene peterhuene force-pushed the refactor-fiber-stacks branch from 4ed3160 to 13dbba6 Compare March 19, 2021 03:21
@github-actions github-actions bot added the wasmtime:api Related to the API of the `wasmtime` crate itself label Mar 19, 2021
@github-actions
Copy link

Subscribe to Label Action

cc @peterhuene

This issue or pull request has been labeled: "wasmtime:api"

Thus the following users have been cc'd because of the following labels:

  • peterhuene: wasmtime:api

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

@peterhuene peterhuene force-pushed the refactor-fiber-stacks branch from 13dbba6 to 386a24e Compare March 19, 2021 06:23
@peterhuene peterhuene force-pushed the refactor-fiber-stacks branch from 386a24e to 8e34022 Compare March 19, 2021 06:57
This commit fixes the Windows implementation of fibers in Wasmtime to
reserve enough staack space for Rust to handle any stack overflow
exceptions.
@peterhuene peterhuene force-pushed the refactor-fiber-stacks branch from 595f788 to f556bd1 Compare March 19, 2021 21:48
* Add assert to `StackPool::deallocate` to ensure the fiber stack given to it
  comes from the pool.
* Remove outdated comment about windows and stacks as the allocator now returns
  fiber stacks.
* Remove conditional compilation around `stack_size` in the allocators as it
  was just clutter.
@peterhuene peterhuene requested a review from alexcrichton March 20, 2021 07:07
@peterhuene peterhuene merged commit 4471d27 into bytecodealliance:main Mar 22, 2021
@peterhuene peterhuene deleted the refactor-fiber-stacks branch March 22, 2021 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wasmtime:api Related to the API of the `wasmtime` crate itself
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wasmtime: lift fiber creation implementation into instance allocator
2 participants