-
Notifications
You must be signed in to change notification settings - Fork 482
Open
Description
The ResizableArrayBuffer and GrowableSharedArrayBuffer proposal is a TC39 proposal that is currently stage 2.
There was some discussion of how the proposal might integrate with the Wasm/JS API. It seems better to move the discussion here to get a concrete plan and to get more Wasm eyes on the issue.
As a starting point, I suggest the following changes to the WebAssembly.Memory API:
Memory
will have a newresizableBuffer
attribute.- Returns a
ResizableArrayBuffer
orGrowableSharedArrayBuffer
instance. - If an
ArrayBuffer
was vended by thebuffer
attribute on the same instance, thatArrayBuffer
instance will be detached.SharedArrayBuffers
andGrowableSharedArrayBuffer
will alias the same memory. - If the
Memory
was created with a maximum size, that size will be reflected on theResizableArrayBuffer
orGrowableSharedArrayBuffer
instance. - Otherwise, the maximum size is
2^32
.
- Returns a
Memory
'sbuffer
attribute will detach anyResizableArrayBuffer
buffers vended by theresizableBuffer
attribute.ResizableArrayBuffer
s gotten viaMemory
'sresizableBuffer
attribute will:- Throw on
transfer()
, since they can't be detached. - Throw on
resize()
calls that are shrinks. - Throw on
resize()
calls that are not in multiples of the wasm page size. (Thanks @conrad-watt)
- Throw on
GrowableArrayBuffer
s gotten viaMemory
'sresizableBuffer
attribute will:- Throw on
grow()
calls that are not in multiples of the wasm page size.
- Throw on
Thoughts welcome.
(Also, what is the process for bringing such a "normative PR" that's not a full proposal to the CG? Is it just an agenda item?)
LifeIsStrange
Metadata
Metadata
Assignees
Labels
No labels