Use calloc for non-Wasm SharedArrayRawBuffer
Categories
(Core :: JavaScript Engine, task, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox104 | --- | fixed |
People
(Reporter: jandem, Assigned: jandem)
References
(Blocks 1 open bug)
Details
Attachments
(4 files)
Bug 1777231 reports our mapped-buffer-limit causing problems when using SharedArrayBuffer
in JS.
A lot of the fields in SharedArrayRawBuffer
are Wasm-specific. The plan is to add a WasmSharedArrayRawBuffer
that contains the Wasm-specific bits. We can then also use calloc
for the non-Wasm buffers, similar to what we already do for non-shared array buffers.
This is faster and will use less memory when allocating (many) SABs from JS.
Assignee | ||
Comment 1•2 years ago
|
||
This forks the non-Wasm and Wasm code paths, which will make it easier to simplify
the non-Wasm code in a later patch.
Assignee | ||
Comment 2•2 years ago
|
||
This ensures the buffer can still be used in dropRawBuffer before dropping the reference.
Depends on D151008
Assignee | ||
Comment 3•2 years ago
|
||
The Wasm-specific fields are moved from SharedArrayRawBuffer
into a new derived class,
WasmSharedArrayRawBuffer
. This is similar to how non-shared buffers use WasmArrayRawBuffer
.
The non-Wasm allocation code now uses calloc
instead of mmap
. This is also more like
how non-shared buffers work.
These changes make the non-Wasm SABs a lot more lightweight. This will help fix bug 1777231
and similar issues.
Depends on D151009
Assignee | ||
Comment 4•2 years ago
|
||
This fixes a pre-existing issue: Mutex
has a destructor so we should call it.
Depends on D151010
Pushed by jdemooij@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/32fcf7ae995e part 1 - Inline SharedArrayRawBuffer::AllocateInternal into the two callers. r=sfink https://hg.mozilla.org/integration/autoland/rev/3cc226c5c2a7 part 2 - Move dropReference call into dropRawBuffer. r=sfink https://hg.mozilla.org/integration/autoland/rev/401aac8b1523 part 3 - Optimize non-Wasm SharedArrayBuffers. r=sfink https://hg.mozilla.org/integration/autoland/rev/ac06b42c5b02 part 4 - Call WasmSharedArrayRawBuffer's destructor to ensure the mutex is destroyed. r=sfink
Comment 6•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/32fcf7ae995e
https://hg.mozilla.org/mozilla-central/rev/3cc226c5c2a7
https://hg.mozilla.org/mozilla-central/rev/401aac8b1523
https://hg.mozilla.org/mozilla-central/rev/ac06b42c5b02
Description
•