Skip to content

Commit

Permalink
pythonGH-113657: Add back missing _SET_IP uops in tier two (pythonGH-…
Browse files Browse the repository at this point in the history
  • Loading branch information
brandtbucher authored Jan 2, 2024
1 parent bab0758 commit b0fb074
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix an issue that caused important instruction pointer updates to be
optimized out of tier two traces.
5 changes: 3 additions & 2 deletions Python/optimizer_analysis.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "pycore_opcode_metadata.h"
#include "pycore_opcode_utils.h"
#include "pycore_pystate.h" // _PyInterpreterState_GET()
#include "pycore_uop_metadata.h"
#include "pycore_uops.h"
#include "pycore_long.h"
#include "cpython/optimizer.h"
Expand Down Expand Up @@ -35,13 +36,13 @@ remove_unneeded_uops(_PyUOpInstruction *buffer, int buffer_size)
break;
}
else {
if (OPCODE_HAS_ESCAPES(opcode)) {
if (_PyUop_Flags[opcode] & HAS_ESCAPES_FLAG) {
maybe_invalid = true;
if (last_set_ip >= 0) {
buffer[last_set_ip].opcode = _SET_IP;
}
}
if (OPCODE_HAS_ERROR(opcode) || opcode == _PUSH_FRAME) {
if ((_PyUop_Flags[opcode] & HAS_ERROR_FLAG) || opcode == _PUSH_FRAME) {
if (last_set_ip >= 0) {
buffer[last_set_ip].opcode = _SET_IP;
}
Expand Down

0 comments on commit b0fb074

Please sign in to comment.