Tier 2 cleanups and tweaks (#115534)

* Rename `_testinternalcapi.get_{uop,counter}_optimizer` to `new_*_optimizer`
* Use `_PyUOpName()` instead of` _PyOpcode_uop_name[]`
* Add `target` to executor iterator items -- `list(ex)` now returns `(opcode, oparg, target, operand)` quadruples
* Add executor methods `get_opcode()` and `get_oparg()` to get `vmdata.opcode`, `vmdata.oparg`
* Define a helper for printing uops, and unify various places where they are printed
* Add a hack to summarize_stats.py to fix legacy uop names (e.g. `POP_TOP` -> `_POP_TOP`)
* Define helpers in `test_opt.py` for accessing the set or list of opnames of an executor
This commit is contained in:
Guido van Rossum 2024-02-20 12:24:35 -08:00 committed by GitHub
parent 520403ed4c
commit 142502ea8d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 206 additions and 124 deletions

View file

@ -44,6 +44,7 @@
#define MAX_ABSTRACT_FRAME_DEPTH (TRACE_STACK_SIZE + 2)
#ifdef Py_DEBUG
extern const char *_PyUOpName(int index);
static const char *const DEBUG_ENV = "PYTHON_OPT_DEBUG";
static inline int get_lltrace(void) {
char *uop_debug = Py_GETENV(DEBUG_ENV);
@ -632,7 +633,7 @@ uop_redundancy_eliminator(
_Py_UOpsSymType **stack_pointer = ctx->frame->stack_pointer;
DPRINTF(3, "Abstract interpreting %s:%d ",
_PyOpcode_uop_name[opcode],
_PyUOpName(opcode),
oparg);
switch (opcode) {
#include "tier2_redundancy_eliminator_cases.c.h"