Closed Bug 1861078 Opened 2 years ago Closed 9 months ago

Optimize stack map finding during tracing

Categories

(Core :: JavaScript: WebAssembly, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
138 Branch
Tracking Status
firefox138 --- fixed

People

(Reporter: rhunt, Assigned: jpages)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

wasm::StackMaps is a sorted list and we do a binary search to find a stack map for each call frame when tracing roots. This can be expensive for large modules. We should consider using a hash map for this. I did see this showing up in barista3 profiles back in Feb of this year.

Type: task → enhancement
Assignee: nobody → jpages
Blocks: wasm-gc-perf
No longer blocks: wasm-gc

Metadata used offsets to the beginning of code segment. Change that to use
offsets relative to the beginning of CodeBlock. This allows us to avoid offseting
metadata later on and prepare the work for simplification of stackmaps.

Wasm stackmaps were stored in a sorted vector and traced at runtime with multiple
binary searches. Using hashmaps should reduce the complexity of iterating over stackmaps.

Attachment #9444637 - Attachment description: WIP: Bug 1861078 - wasm: make metadata offsets relative to CodeBlock->codeBase. → Bug 1861078 - wasm: make metadata offsets relative to CodeBlock->codeBase.
Attachment #9444638 - Attachment description: WIP: Bug 1861078 - wasm: Refactor stackmaps to use a hashmap instead of a vector. → Bug 1861078 - wasm: Refactor stackmaps to use a hashmap instead of a vector.
Pushed by jpages@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/9a162cc369e3 wasm: make metadata offsets relative to CodeBlock->codeBase. r=rhunt https://hg.mozilla.org/integration/autoland/rev/e6dbc240ccbb wasm: Refactor stackmaps to use a hashmap instead of a vector. r=rhunt https://hg.mozilla.org/integration/autoland/rev/2bb2770e86d0 apply code formatting via Lando
Attachment #9444637 - Attachment description: Bug 1861078 - wasm: make metadata offsets relative to CodeBlock->codeBase. → Bug 1861078 - wasm: make metadata offsets relative to CodeBlock->codeBase. r=rhunt
Flags: needinfo?(jpages)

I'll land the patch again after the code freeze, ending on March 3.

Pushed by jpages@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1a3bc285395f wasm: make metadata offsets relative to CodeBlock->codeBase. r=rhunt https://hg.mozilla.org/integration/autoland/rev/bd2b8b0c2f35 wasm: Refactor stackmaps to use a hashmap instead of a vector. r=rhunt https://hg.mozilla.org/integration/autoland/rev/24eb5e44d488 apply code formatting via Lando
Status: NEW → RESOLVED
Closed: 9 months ago
Resolution: --- → FIXED
Target Milestone: --- → 138 Branch
Regressions: 1952215
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: