diff options
author | Ken Jin <kenjin@python.org> | 2024-02-13 21:24:48 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-13 21:24:48 +0800 |
commit | 7cce8576226249461baa91c4a89770a1823b44a4 (patch) | |
tree | c9df9d9fa2fa090706b11982d014b07c2221fcce /Python/optimizer.c | |
parent | ccc76c3e88647e416184bb1f5210b4e8946ae358 (diff) | |
download | cpython-7cce8576226249461baa91c4a89770a1823b44a4.tar.gz cpython-7cce8576226249461baa91c4a89770a1823b44a4.zip |
gh-114058: Foundations of the Tier2 redundancy eliminator (GH-115085)
---------
Co-authored-by: Mark Shannon <9448417+markshannon@users.noreply.github.com>
Co-authored-by: Jules <57632293+JuliaPoo@users.noreply.github.com>
Co-authored-by: Guido van Rossum <gvanrossum@users.noreply.github.com>
Diffstat (limited to 'Python/optimizer.c')
-rw-r--r-- | Python/optimizer.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/Python/optimizer.c b/Python/optimizer.c index ad9ac382d30..f31f83113d3 100644 --- a/Python/optimizer.c +++ b/Python/optimizer.c @@ -17,8 +17,6 @@ #include "pycore_uop_metadata.h" // Uop tables #undef NEED_OPCODE_METADATA -#define UOP_MAX_TRACE_LENGTH 512 - #define MAX_EXECUTORS_SIZE 256 @@ -308,8 +306,6 @@ BRANCH_TO_GUARD[4][2] = { [POP_JUMP_IF_NOT_NONE - POP_JUMP_IF_FALSE][1] = _GUARD_IS_NOT_NONE_POP, }; -#define TRACE_STACK_SIZE 5 - #define CONFIDENCE_RANGE 1000 #define CONFIDENCE_CUTOFF 333 @@ -323,10 +319,11 @@ BRANCH_TO_GUARD[4][2] = { #define ADD_TO_TRACE(OPCODE, OPARG, OPERAND, TARGET) \ DPRINTF(2, \ - " ADD_TO_TRACE(%s, %d, %" PRIu64 ")\n", \ + " ADD_TO_TRACE(%s, %d, %" PRIu64 ", %d)\n", \ _PyUOpName(OPCODE), \ (OPARG), \ - (uint64_t)(OPERAND)); \ + (uint64_t)(OPERAND), \ + TARGET); \ assert(trace_length < max_length); \ trace[trace_length].opcode = (OPCODE); \ trace[trace_length].oparg = (OPARG); \ @@ -825,11 +822,13 @@ uop_optimize( char *uop_optimize = Py_GETENV("PYTHONUOPSOPTIMIZE"); if (uop_optimize == NULL || *uop_optimize > '0') { err = _Py_uop_analyze_and_optimize(frame, buffer, - UOP_MAX_TRACE_LENGTH, curr_stackentries, &dependencies); + UOP_MAX_TRACE_LENGTH, + curr_stackentries, &dependencies); if (err <= 0) { return err; } } + assert(err == 1); _PyExecutorObject *executor = make_executor_from_uops(buffer, &dependencies); if (executor == NULL) { return -1; |