-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generators and Async functions are not jitted #5877
Comments
That's right. Jitting generators is a large work item, much larger than support for async generators, and one that we haven't had a chance to take on. |
I’m kind of curious myself what the concrete challenge for jitting here is - I suppose a big source of difficulty would be that the JIT in general assumes it can store local state on the stack but coroutines violate that assumption... |
Basic JIT isn't trivial, but shouldn't be too hard. Optimizing well in the presence of generators is much harder, much like it is for optimizing within a try block. |
I assume this is a point that is known internally - but it wasn't in the issue log on Github. Currently Generator functions and async functions are always run only in the interpreter.
There is a flag -Jites6Generators to enable jitting them - but using this always results in a crash in the Jit - it encounters an unallocated register the first time it tries to Jit a ResumeYield op. src10pnd is set to a nullptr by this and it goes wrong from there: https://github.com/Microsoft/ChakraCore/blob/8527dc23954bdf77b17d25e472857f58a3b03f8a/lib/Backend/IRBuilder.cpp#L1875
I stumbled upon this whilst working on #5834 there are a few TODOs and equivalent notes in comments about this all dating back to the initial GitHub commit 3 years ago.
I've tried to investigate how to fix this but I'm a bit out of my depth in the Jit code.
The text was updated successfully, but these errors were encountered: