Open Bug 1894940 Opened 6 months ago Updated 3 hours ago

Improve heuristics around discarding JIT code

Categories

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

enhancement

Tracking

()

People

(Reporter: jonco, Assigned: mgaudet)

References

(Depends on 1 open bug, Blocks 2 open bugs)

Details

(Whiteboard: [sp3])

Currently we have a bunch of heuristics about when to throw away JIT code (see GCRuntime::shouldPreserveJITCode) but this ultimately operates at the granularity of a zone. So either all JIT code in a zone is preserved or it's all thrown away. This has the problem that we can both throw away JIT code too eagerly causing performance issues, and we can throw it away too lazily causing increased memory use and GC time.

One approach is to track which JIT code has been executed since some previous point in time. This could be implemented using trampolines to set a flag the next time a piece of JIT code is executed. This could give us much better information about what we can throw away.

Trampoline are a good idea, but they only report which function is being called directly not which function might be called from any other JIT-ed function.
Similarly, monitoring functions which are calling into the VM would be one way, but they might hide some functions which are not relying on any VM calls, such as tiny functions or function using self-hosted code only.

I think the trampoline idea would be interesting if combined with an approximation of the call graph. In which case we could "protect" the closure of the call-graph when the JIT preserve mode is enabled.

Severity: -- → N/A
Priority: -- → P3
Whiteboard: [sp3]
See Also: → 1717917
Depends on: 1841244
Assignee: nobody → mgaudet
You need to log in before you can comment on or make changes to this bug.