Open Bug 1814520 Opened 2 years ago Updated 6 months ago

Add support back for allocation tracking with GC types

Categories

(Core :: JavaScript: WebAssembly, task, P2)

task

Tracking

()

People

(Reporter: rhunt, Unassigned)

References

(Blocks 1 open bug)

Details

Bug 1814519 temporarily is removing support for allocation tracking of GC types while we're optimizing our allocation performance. We'll need to add a dynamic fallback to support allocation tracking for GC types.

The severity field is not set for this bug.
:rhunt, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(rhunt)
Type: defect → task
Flags: needinfo?(rhunt)

Did your struct/array allocation perf patches address this? I think they do a fallback to C++ if their is a AllocationMetadataBuilder on the JSContext, but do we then actually call it?

Flags: needinfo?(bvisness)

Our MacroAssembler code for wasm structs/arrays increments AllocSite::nurseryAllocCount (see all), and the C++ paths (e.g. here) call site->incAllocCount(). I'm not sure if there is more tracking that needs to be done; I'm not familiar with the whole metadata system.

Flags: needinfo?(bvisness)
Flags: needinfo?(rhunt)

The code I was thinking of is the AllocationMetadataBuilder [1] which is a hook that external code (like devtools) can install to add metadata per-object allocated in the system. This was removed to get us a short term perf win, but now that we have better JIT support we should be able to add it back in as a slow path.

So essentially in our JIT code we'd add another check here [2] that sees if cx->allocationMetadataBuilder is enabled, and if so falls back to C++ code. Then in the C++ code we'd wrap our allocation like this [3], and that would set metadata correctly.

[1] https://searchfox.org/mozilla-central/rev/a06d5a8871b1796f2dbd588ab518eaa98507e018/js/src/vm/Realm.h#915
[2] https://searchfox.org/mozilla-central/rev/a06d5a8871b1796f2dbd588ab518eaa98507e018/js/src/jit/MacroAssembler.cpp#6830
[3] https://searchfox.org/mozilla-central/rev/a06d5a8871b1796f2dbd588ab518eaa98507e018/js/src/builtin/MapObject.cpp#741

Flags: needinfo?(rhunt)
You need to log in before you can comment on or make changes to this bug.