gh-106290: Fix edge cases around uops#106319
Conversation
- Longer traces - Explain reason for ending a trace - Support STORE_FAST_LOAD_FAST, STORE_FAST_STORE_FAST - Add deps on pycore_uops.h
This gives us LOAD_FAST_CHECK, LOAD_CLOSURE, and DELETE_FAST.
This doesn't work right yet, alas. If an error occurs in the first uop, the lineno is -1.
The trick is that EXIT_TRACE must decrement prev_instr.
|
While we're cleaning up uops, maybe we should change "trace" to "superblock"? There are already several other things using the name "trace", e.g. |
|
This (with uops on by default) benchmarks 2% slower than main (with uops off by default). I will now revert the final (temporary) commit that turns on uops by default and mark it as ready for review. |
(I just did that to be able to benchmark it and run the tests.) This reverts commit 5b85a49.
|
Maybe the leak is the optimizer created and installed initially. |
brandtbucher
left a comment
There was a problem hiding this comment.
The code itself looks good, haven't tried running it myself or anything. Just one note:
Python/optimizer.c
Outdated
| return 0; | ||
|
|
||
| #undef ADD_TO_TRACE | ||
| #undef ADD_TO_TRACE_BASIC |
There was a problem hiding this comment.
I don't see where this is defined...
There was a problem hiding this comment.
Turd from the last cleanup. I'll get rid of it, then land it.
Use it to `#undef DPRINTF` instead (which also depends on a variable in this scope).
|
A bit of an omnibus PR, alas (let me know if you want it split up). This does roughly the following (though not in that order):
SET_IPtoSAVE_IP(per Creation of superblocks faster-cpython/ideas#558)SAVE_IPuop at the start of the trace (ditto)unbound_local_error; this gives us uops forLOAD_FAST_CHECK,LOAD_CLOSURE, andDELETE_FASTSTORE_FAST_LOAD_FAST,STORE_FAST_STORE_FAST