-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add shared memories #4187
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
Merged
alexcrichton
merged 47 commits into
bytecodealliance:main
from
abrown:shared-memory-vmcontext
Jun 8, 2022
Merged
Add shared memories #4187
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
13113d8
Add shared memories
abrown 8e88076
review: remove thread feature check
abrown 6281c86
review: swap wasmtime-types dependency for existing wasmtime-environ use
abrown 9a6d871
review: remove unused VMMemoryUnion
abrown 234ea40
review: reword cross-engine error message
abrown 681a627
review: improve tests
abrown 41a5016
review: refactor to separate prevent Memory <-> SharedMemory conversion
abrown 4cc2ddf
review: into_shared_memory -> as_shared_memory
abrown 9cc4db0
review: remove commented out code
abrown 7a723e1
review: limit shared min/max to 32 bits
abrown 04aaf4f
review: skip imported memories
abrown 26c22f5
review: imported memories are not owned
abrown 188cb65
review: remove TODO
abrown 06dbb4d
review: document unsafe send + sync
abrown 2f9d139
review: add limiter assertion
abrown e236a24
review: remove TODO
abrown 0b1f51b
review: improve tests
abrown 90d452e
review: fix doc test
abrown 7402dc1
fix: fixes based on discussion with Alex
abrown f79b322
review: add `Extern::SharedMemory`
abrown 25f4a4e
review: remove TODO
abrown 09f8d3d
review: atomically load from VMMemoryDescription in JIT-generated code
abrown 6669977
review: add test probing the last available memory slot across threads
abrown bee0ece
fix: move assertion to new location due to rebase
abrown 12420e4
fix: doc link
abrown 1be4ad0
fix: add TODOs to c-api
abrown e44a58a
fix: broken doc link
abrown 14ce663
fix: modify pooling allocator messages in tests
abrown f087502
review: make owned_memory_index panic instead of returning an option
abrown b8ef602
review: clarify calculation of num_owned_memories
abrown e37f881
review: move 'use' to top of file
abrown 87da77a
review: change '*const [u8]' to '*mut [u8]'
abrown 17f8961
review: remove TODO
abrown 8d981bf
review: avoid hard-coding memory index
abrown b154a16
review: remove 'preallocation' parameter from 'Memory::_new'
abrown e90c3ea
fix: component model memory length
abrown bd6e799
review: check that shared memory plans are static
abrown 2bdaaed
review: ignore growth limits for shared memory
abrown 19f3081
review: improve atomic store comment
abrown 0a13a7d
review: add FIXME for memory growth failure
abrown 75ddcd1
review: add comment about absence of bounds-checked 'memory.size'
abrown a96fccd
review: make 'current_length()' doc comment more precise
abrown 480a1e1
review: more comments related to memory.size non-determinism
abrown be221c7
review: make 'vmmemory' unreachable for shared memory
abrown 6868519
review: move code around
abrown e8101a0
review: thread plan through to 'wrap()'
abrown 9e71b72
review: disallow shared memory allocation with the pooling allocator
abrown File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This got me thinking "does this need to be an atomic load?" and I think the answer is no because shared memories never have their base pointer change (so it's write-once only during initialization). That being said though one thing this did remind me of is that the
current_lengthshould never be used here. I think it's only used for dynamic memories, so could this have an assert below that the dynamic memory branch is never taken if the memory is shared?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.
Not sure I understand what you mean by "dynamic memory branch" here... there is an
if is_shared ...above?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 think in the sense of "make sure we don't feed
current_lengthto the heap-access machinery in Cranelift"-safety, we could maybe makecurrent_length_offsetanOptionhere, and returnNonefor the shared case. Then below wherever we use it, unwrap it with "expected current-length field (always present on non-shared memories)" or something of the sort as anexpecterror?