summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrandt Bucher <brandtbucher@microsoft.com>2024-01-02 22:09:57 (GMT)
committerGitHub <noreply@github.com>2024-01-02 22:09:57 (GMT)
commitb0fb074d5983f07517cec76a37268f13c986d314 (patch)
treea102f6aa052f40d22eb9650f218b6610596ad554
parentbab0758ea4a1d4666a973ae2d65f21a09e4478ba (diff)
downloadcpython-b0fb074d5983f07517cec76a37268f13c986d314.zip
cpython-b0fb074d5983f07517cec76a37268f13c986d314.tar.gz
cpython-b0fb074d5983f07517cec76a37268f13c986d314.tar.bz2
GH-113657: Add back missing _SET_IP uops in tier two (GH-113662)
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2024-01-02-11-14-29.gh-issue-113657.CQo9vF.rst2
-rw-r--r--Python/optimizer_analysis.c5
2 files changed, 5 insertions, 2 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2024-01-02-11-14-29.gh-issue-113657.CQo9vF.rst b/Misc/NEWS.d/next/Core and Builtins/2024-01-02-11-14-29.gh-issue-113657.CQo9vF.rst
new file mode 100644
index 0000000..b520b5c
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2024-01-02-11-14-29.gh-issue-113657.CQo9vF.rst
@@ -0,0 +1,2 @@
+Fix an issue that caused important instruction pointer updates to be
+optimized out of tier two traces.
diff --git a/Python/optimizer_analysis.c b/Python/optimizer_analysis.c
index 8b471d7..4eb2d97 100644
--- a/Python/optimizer_analysis.c
+++ b/Python/optimizer_analysis.c
@@ -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"
@@ -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;
}