mirror of
https://github.com/python/cpython.git
synced 2025-08-24 02:35:59 +00:00
gh-106529: Generate uops for POP_JUMP_IF_[NOT_]NONE (#106796)
These aren't automatically translated because (ironically) they are macros deferring to POP_JUMP_IF_{TRUE,FALSE}, which are not viable uops (being manually translated). The hack is that we emit IS_NONE and then set opcode and jump to the POP_JUMP_IF_{TRUE,FALSE} translation code.
This commit is contained in:
parent
ad95c7253a
commit
b2b261ab2a
2 changed files with 47 additions and 0 deletions
|
@ -464,9 +464,26 @@ translate_bytecode_to_trace(
|
|||
|
||||
switch (opcode) {
|
||||
|
||||
case POP_JUMP_IF_NONE:
|
||||
{
|
||||
RESERVE(2, 2);
|
||||
ADD_TO_TRACE(IS_NONE, 0);
|
||||
opcode = POP_JUMP_IF_TRUE;
|
||||
goto pop_jump_if_bool;
|
||||
}
|
||||
|
||||
case POP_JUMP_IF_NOT_NONE:
|
||||
{
|
||||
RESERVE(2, 2);
|
||||
ADD_TO_TRACE(IS_NONE, 0);
|
||||
opcode = POP_JUMP_IF_FALSE;
|
||||
goto pop_jump_if_bool;
|
||||
}
|
||||
|
||||
case POP_JUMP_IF_FALSE:
|
||||
case POP_JUMP_IF_TRUE:
|
||||
{
|
||||
pop_jump_if_bool:
|
||||
// Assume jump unlikely (TODO: handle jump likely case)
|
||||
RESERVE(1, 2);
|
||||
_Py_CODEUNIT *target_instr =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue