| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
@savannahostrowski, I'd love to get your review of this if you have a few cycles. |
Sorry, something went wrong.
There was a problem hiding this comment.
A couple of comments and questions but after sitting and reading through this code a bunch over the last week or two, I'm excited about how much more readable this will get with this change! 💆♀️
Sorry, something went wrong.
| """Yield a JIT compiler line-by-line as a C header file.""" | ||
| yield from _dump_header() | ||
| for opname, group in groups.items(): | ||
| for opname, group in sorted(groups.items()): |
There was a problem hiding this comment.
Is there a reason that this needs to be sorted?
Sorry, something went wrong.
There was a problem hiding this comment.
Nope, I just like it that way (if you couldn't tell by now). ;)
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks for adding in the comment about the naming conventions - I think that helps! Otherwise, this looks pretty solid to me (barring some Windows CI failures). Lots of moving things into function but it's a whole lot more readable! 🎉
Sorry, something went wrong.
|
Windows JIT CI fixed in GH-118564. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This breaks up the JIT into smaller functions, reduces a lot of branching in hot inner loops, and generally makes the C code cleaner (and probably faster).
Currently, we generate declarative structures at build time that we then loop over in order to emit the desired machine code at runtime. For example, the _STORE_FAST stencil looks like this:
DetailsThis very general approach means that we have a lot of complex logic in our hot inner loop to decode instructions and set up values for patching that may not even be needed. It's also very branchy, since we're essentially "interpreting" the array of holes for each instruction.
With this PR, jit_stencils.h instead contains the following function:
DetailsThis function is called directly to emit the machine code for every _STORE_FAST instruction, and hardcodes the logic for all of the necessary copies and patches. The result is one indirect call, no unnecessary branching, and (in my opinion) cleaner code, since a lot of the tricky logic is now hidden away in generated files.
I know this is right before feature freeze, but I'd really like to get this in 3.13 since it will make backporting any fixes much easier. It doesn't change the actual jitted code in any way.
Note to reviewers: the diff is a bit messy, so it may make more sense to compare the before-vs-after files side-by-side instead.