Closed Bug 1812283 Opened 2 years ago Closed 2 years ago

WasmArrayObject::create: don't create zero-sized payload blocks

Categories

(Core :: JavaScript: WebAssembly, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
111 Branch
Tracking Status
firefox111 --- fixed

People

(Reporter: jseward, Assigned: jseward)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

The Dart Barista-3 benchmark creates around 662,000 wasm-gc arrays. Of these,
308,000 have no elements (bizarrely); as a result we end up malloc-heap
allocating a zero-sized payload area for them. It would be better not to.

This changes an invariant for WasmArrayObject from "data pointer is never
null" to "data pointer is null iff the number of elements is zero". But
that's no big deal.

The Dart Barista-3 benchmark creates around 662,000 wasm-gc arrays. Of these,
308,000 have no elements (bizarrely); as a result we end up malloc-heap
allocating a zero-sized payload area for them. It would be better not to.

This patch changes WasmArrayObject::createArray so as to allocate the data
area only if the number of elements is non-zero. As a result the invariant
for WasmArrayObject "data pointer is never null" is changed to "data pointer
is null iff the number of elements is zero". But that's no big deal.

::obj_trace and ::obj_finalize are updated accordingly.

Pushed by jseward@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/abb99e805e70 WasmArrayObject::create: don't create zero-sized payload blocks. r=rhunt.
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 111 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: