mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-112287: Speed up Tier 2 (uop) interpreter a little (#112286)
This makes the Tier 2 interpreter a little faster. I calculated by about 3%, though I hesitate to claim an exact number. This starts by doubling the trace size limit (to 512), making it more likely that loops fit in a trace. The rest of the approach is to only load `oparg` and `operand` in cases that use them. The code generator know when these are used. For `oparg`, it will conditionally emit ``` oparg = CURRENT_OPARG(); ``` at the top of the case block. (The `oparg` variable may be referenced multiple times by the instructions code block, so it must be in a variable.) For `operand`, it will use `CURRENT_OPERAND()` directly instead of referencing the `operand` variable, which no longer exists. (There is only one place where this will be used.)
This commit is contained in:
parent
c4c63211e8
commit
8deb8bc2e5
7 changed files with 131 additions and 33 deletions
|
@ -397,3 +397,7 @@ stack_pointer = _PyFrame_GetStackPointer(frame);
|
|||
#define GOTO_TIER_TWO() goto enter_tier_two;
|
||||
|
||||
#define GOTO_TIER_ONE() goto exit_trace;
|
||||
|
||||
#define CURRENT_OPARG() (next_uop[-1].oparg)
|
||||
|
||||
#define CURRENT_OPERAND() (next_uop[-1].operand)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue