Skip to content

Store one fiber stack in a Store<T>#9604

Merged
alexcrichton merged 2 commits intobytecodealliance:mainfrom
alexcrichton:cache-one-stack
Nov 14, 2024
Merged

Store one fiber stack in a Store<T>#9604
alexcrichton merged 2 commits intobytecodealliance:mainfrom
alexcrichton:cache-one-stack

Conversation

@alexcrichton
Copy link
Copy Markdown
Member

This commit stores a single fiber stack in Store<T> as a cache to be used throughout the lifetime of the Store. This should help amortize the cost of allocating a stack for use in a store because the same stack can be used continuously throughout the lifetime of the Store<T>. This notably reduces contention on the lock used to manage the pooling allocator when possible.

This commit stores a single fiber stack in `Store<T>` as a cache to be
used throughout the lifetime of the `Store`. This should help amortize
the cost of allocating a stack for use in a store because the same stack
can be used continuously throughout the lifetime of the `Store<T>`. This
notably reduces contention on the lock used to manage the pooling
allocator when possible.
@alexcrichton alexcrichton requested a review from a team as a code owner November 14, 2024 05:29
@alexcrichton alexcrichton requested review from pchickey and removed request for a team November 14, 2024 05:29
@github-actions github-actions bot added the wasmtime:api Related to the API of the `wasmtime` crate itself label Nov 14, 2024
Copy link
Copy Markdown
Contributor

@pchickey pchickey left a comment

Choose a reason for hiding this comment

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

Love it!

@alexcrichton alexcrichton added this pull request to the merge queue Nov 14, 2024
Merged via the queue into bytecodealliance:main with commit 7bd09e6 Nov 14, 2024
@alexcrichton alexcrichton deleted the cache-one-stack branch November 14, 2024 21:08
alexcrichton added a commit to alexcrichton/wasmtime that referenced this pull request Jan 14, 2025
This commit fixes a regression from bytecodealliance#9604 where using `Store::into_data`
wouldn't properly drop a cached stack in a store like a `Drop`
destructor. The fix here is to add the `flush_fiber_stack` method into
the `into_data` here as well.
github-merge-queue bot pushed a commit that referenced this pull request Jan 14, 2025
This commit fixes a regression from #9604 where using `Store::into_data`
wouldn't properly drop a cached stack in a store like a `Drop`
destructor. The fix here is to add the `flush_fiber_stack` method into
the `into_data` here as well.
alexcrichton added a commit to alexcrichton/wasmtime that referenced this pull request Jan 14, 2025
…0009)

This commit fixes a regression from bytecodealliance#9604 where using `Store::into_data`
wouldn't properly drop a cached stack in a store like a `Drop`
destructor. The fix here is to add the `flush_fiber_stack` method into
the `into_data` here as well.
alexcrichton added a commit to alexcrichton/wasmtime that referenced this pull request Jan 14, 2025
…0009)

This commit fixes a regression from bytecodealliance#9604 where using `Store::into_data`
wouldn't properly drop a cached stack in a store like a `Drop`
destructor. The fix here is to add the `flush_fiber_stack` method into
the `into_data` here as well.
alexcrichton added a commit that referenced this pull request Jan 14, 2025
This commit fixes a regression from #9604 where using `Store::into_data`
wouldn't properly drop a cached stack in a store like a `Drop`
destructor. The fix here is to add the `flush_fiber_stack` method into
the `into_data` here as well.
alexcrichton added a commit that referenced this pull request Jan 14, 2025
This commit fixes a regression from #9604 where using `Store::into_data`
wouldn't properly drop a cached stack in a store like a `Drop`
destructor. The fix here is to add the `flush_fiber_stack` method into
the `into_data` here as well.
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.

2 participants