-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
WebAssembly Shared Memory #4762
Conversation
f3218e8
to
57c2b26
Compare
57c2b26
to
06aa106
Compare
lib/WasmReader/WasmParseTree.cpp
Outdated
return false; | ||
} | ||
#endif | ||
return (uint32)(type - 1) < (WasmTypes::Limit - 1); |
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.
can you do type > Void && type < Limit? I checked and compiler generates same code.
newBuffer = m_buffer->GrowMemory(newBytes); | ||
if (newBuffer == nullptr) | ||
AssertOrFailFast(Wasm::Threads::IsEnabled()); | ||
if (!((WebAssemblySharedArrayBuffer*)PointerValue(m_buffer))->GrowMemory(newBytes)) |
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.
doing PointerValue strikes me as a bad practice, maybe we should be casting to Field(WebAssemblySharedArrayBuffer*)?
@@ -21,6 +21,25 @@ WebAssemblyMemory::WebAssemblyMemory(WebAssemblyArrayBuffer* buffer, uint32 init | |||
Assert(m_buffer->GetByteLength() >= UInt32Math::Mul<WebAssembly::PageSize>(initial)); | |||
} | |||
|
|||
|
|||
__checkReturn bool WebAssemblyMemory::AreLimitsValid(uint32 initial, uint32 maximum) |
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.
nit: that's old sal, better to use _Must_inspect_result_
@@ -98,6 +98,7 @@ namespace Js | |||
class SourceTextModuleRecord; | |||
class ArrayBufferBase; | |||
class SharedContents; |
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.
nit: duplicate line
} | ||
} | ||
|
||
void SharedArrayBuffer::FreeBuffer(BYTE* buffer, uint32 length, uint32 maxLength) |
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.
nit: there deserve to be some comments explaining maxLength, since this is a wasm specific parameter, and makes no sense for JS where you can't grow SABs
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.
Revert "Temporarily allow non-shared memory for atomic operator in wabt" Enable WasmThreads only if ESSharedArrayBuffer is enabled
6a13913
to
6aadf05
Compare
Merge pull request #4762 from Cellule:wasm/shared_memory Implementation for WebAssembly shared memory. Currently WebAssemblySharedArrayBuffer depends directly on SharedArrayBuffer and thus are available only if SharedArrayBuffer are available. See [ChakraFull PR](https://devdiv.visualstudio.com/DevDiv/Chakra/_git/Chakra/pullrequest/108729?_a=overview) for chakra full changes.
Implementation for WebAssembly shared memory.
Currently WebAssemblySharedArrayBuffer depends directly on SharedArrayBuffer and thus are available only if SharedArrayBuffer are available.
See ChakraFull PR for chakra full changes.
This change is