Support Resuming in Warp compiled Async Functions and Generators
Categories
(Core :: JavaScript Engine: JIT, enhancement, P3)
Tracking
()
People
(Reporter: mgaudet, Unassigned)
References
Details
(Whiteboard: [sp3])
(Opening this bug without committing to implementing it. We'll need some empirical evidence this would be valuable to implement)
The implementation of Warp-compiled async
functions being developed in Bug 1680602 (and generators in Bug 1681336) is not total support.
The only way to re-enter a Warp compiled generator or async function is to OSR in. This means that after the first yield, we'll run in Baseline until our next opportunity to OSR. This simplification made it substantially easier to implement generators and async functions in Warp, but does mean that a hypothetical function like
function* foo() {
var result;
for ( ... ) {
// compute expensive result
}
yield result;
for (...) {
// compute expensive second result
}
yield result;
}
We will only execute one of the bodies in warp at best, as we only support one OSR entry.
The way to solve this once and for all would be to allow JSOp::Resume to materialize a warp frame and start execution after a yield, in parallel to how Resume is able to do that for Baseline.
Updated•4 years ago
|
Reporter | ||
Comment 1•4 years ago
|
||
Some data points about this:
I patched a copy of SM to keep track of a count of how many times we execute AfterYield when the script has an associated Warp script.
- JetStream2: Basic has 2,437,181 missed opportunities for entering a warp script.
- JetStream2 async-fs has 72,299 missed opportunities for entering a warp script.
These are the only two benchmarks where the Warp Generators / Warp Async code is really in effect. Despite the big headline numbers, I suspect that we'd -only- be improving benchmarks in the short term.
My current preference is to leave this until we see some real world desire for it. Implementing resume in Warp is potentially fraught and time intensive, and I know we have other things we can work on in the short term.
Reporter | ||
Updated•3 years ago
|
Updated•1 year ago
|
Updated•8 months ago
|
Description
•