-
Notifications
You must be signed in to change notification settings - Fork 517
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:
Memorywill have a newresizableBufferattribute.- Returns a
ResizableArrayBufferorGrowableSharedArrayBufferinstance. - If an
ArrayBufferwas vended by thebufferattribute on the same instance, thatArrayBufferinstance will be detached.SharedArrayBuffersandGrowableSharedArrayBufferwill alias the same memory. - If the
Memorywas created with a maximum size, that size will be reflected on theResizableArrayBufferorGrowableSharedArrayBufferinstance. - Otherwise, the maximum size is
2^32.
- Returns a
Memory'sbufferattribute will detach anyResizableArrayBufferbuffers vended by theresizableBufferattribute.ResizableArrayBuffers gotten viaMemory'sresizableBufferattribute 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
GrowableArrayBuffers gotten viaMemory'sresizableBufferattribute 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?)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels