Closed Bug 1903539 Opened 4 months ago Closed 3 months ago

Followups to bug 1891182 (refactoring of ModuleGenerator and ModuleEnvironment)

Categories

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

enhancement

Tracking

()

RESOLVED FIXED
129 Branch
Tracking Status
firefox129 --- fixed

People

(Reporter: jseward, Assigned: jseward)

References

(Blocks 2 open bugs)

Details

Attachments

(2 files)

The following cleanup items resulting from bug 1891182 need to be done:

(2) = higher priority, (3) = lower priority
CM = CodeMetadata, MM = ModuleMetadata

  • move
    (3) CM::codeSection to MM
    (3) CM::customSectionRanges to MM (maybe complexity with Decoder)
    (2) Module::{dataSegments_, elemSegments_, customSections_} to MM

  • (2-3) assess the costs of passing around RefPtr<CM/MM> rather than
    plain CM*/MM*; fix if needed

  • (2)
    space accounting:
    fix CodeMetadata::sizeOfExcludingThis (if it needs fixing)
    fix CodeMetadataForAsmJS::sizeOfExcludingThis (maybe?)
    fix Module::initGCMallocBytesExcludingCode
    Module::addSizeOfMisc: move imports_/exports_ accounting to MM

  • (2) wasm::CompileTier2: why does this create a ModuleMetadata?
    (also .. and a CodeMetadata?) Neither is necessary.
    -- this is a nasty tangle

  • (3) give MM a RefPtr to CM

This patch removes Module::{dataSegments_, elemSegments_, customSections_} and
adds ModuleMetadata::{dataSegments, customSections} instead.
ModuleMetadata::elemSegments already exists but was only used during module
generation.

The new code does the obvious thing -- those fields now live permanently in
ModuleMetadata. This was mostly straightforward, apart from a bit of
hoop-jumping in the deserializer, due to a circular dependency: Code must be
deserialized before ModuleMetadata so as to make types available, but Code
needs to have its codeMeta().nameCustomSectionIndex field set by using info
from ModuleMetadata.

A few comments have been tidied up.

Bug 1891182 majorly mashed around source metadata management for wasm and
asm.js, resulting in breakage to various memory reporter routines. This patch
is a best-effort attempt to fix up sizeOfExcludingThis() for
CodeMetadataForAsmJSImpl, CodeMetadata and ModuleMetadata.
Module::initGCMallocBytesExcludingCode has also been changed.

Pushed by jseward@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f6e5093b8775 part 01 - move Module::{dataSegments_, elemSegments_, customSections_} to ModuleMetadata. r=rhunt. https://hg.mozilla.org/integration/autoland/rev/2f5cd98ee842 part 02 - fix up memory reporting methods following bug 1891182. r=rhunt.
Status: NEW → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 129 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: