Closed Bug 1820120 Opened 2 years ago Closed 2 years ago

Manage Wasm{Array,Struct}Object OOL-storage-blocks using a thread-private cache

Categories

(Core :: JavaScript: WebAssembly, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
112 Branch
Tracking Status
firefox112 --- fixed

People

(Reporter: jseward, Assigned: jseward)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

This is actually the patch at bug 1817385 comment 1 and comment 4.

Wasm{Array,Struct}Objects may be freely nursery-allocated, hence enjoying the
benefits of generational GC. However, those with out-of-line storage in the
C++ heap (called "trailer blocks" in the patch) have those blocks managed by
js_malloc/js_free. This is expensive, and especially for objects which don't
get tenured, undercuts the benefit gained from generational GC.

This patch adds to js::Nursery, two new mechanisms:

  • a cache of blocks, js::gc::MallocedBlockCache, which are suitable for use as
    trailers. Allocation and freeing of trailers is done mostly from this
    cache. A supporting type, js::PointerAndUint7, has also been added, as
    extra data (a freelist ID) is needed when returning blocks to the cache.

  • a more limited version of the existing Nursery::mallocedBuffers mechanism.
    The goal is the same -- to enumerate the subtraction of sets of allocated vs
    tenured trailer blocks, at the end of minor GC. The new version differs in
    that (1) it tracks PointerAndUint7, not void*s, (2) block resizing is not
    supported, and (3) the difference is computed via vector comparison rather
    than a hash set, for performance reasons.

An SMDOC explaining the mechanisms in detail has been added to WasmGcObject.cpp.

Blocks: 1820802
Pushed by jseward@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/596e62e6b969 Manage Wasm{Array,Struct}Object OOL-storage-blocks using a thread-private cache. r=jonco,rhunt.
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 112 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: