Skip to content

Commit 7e6fa5f

Browse files
authored
GH-116202: Incorporate invalidation check into _START_EXECUTOR. (GH-118044)
1 parent d3bd6b5 commit 7e6fa5f

File tree

5 files changed

+10
-4
lines changed

5 files changed

+10
-4
lines changed

Include/internal/pycore_uop_metadata.h

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/bytecodes.c

+1
Original file line numberDiff line numberDiff line change
@@ -4181,6 +4181,7 @@ dummy_func(
41814181
#ifndef _Py_JIT
41824182
current_executor = (_PyExecutorObject*)executor;
41834183
#endif
4184+
DEOPT_IF(!((_PyExecutorObject *)executor)->vm_data.valid);
41844185
}
41854186

41864187
tier2 op(_FATAL_ERROR, (--)) {

Python/executor_cases.c.h

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/optimizer.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -1109,8 +1109,6 @@ make_executor_from_uops(_PyUOpInstruction *buffer, int length, const _PyBloomFil
11091109
assert(next_exit == -1);
11101110
assert(dest == executor->trace);
11111111
assert(dest->opcode == _START_EXECUTOR);
1112-
dest->oparg = 0;
1113-
dest->target = 0;
11141112
_Py_ExecutorInit(executor, dependencies);
11151113
#ifdef Py_DEBUG
11161114
char *python_lltrace = Py_GETENV("PYTHON_LLTRACE");
@@ -1314,7 +1312,7 @@ counter_optimize(
13141312
}
13151313
_Py_CODEUNIT *target = instr + 1 + _PyOpcode_Caches[JUMP_BACKWARD] - oparg;
13161314
_PyUOpInstruction buffer[5] = {
1317-
{ .opcode = _START_EXECUTOR },
1315+
{ .opcode = _START_EXECUTOR, .jump_target = 4, .format=UOP_FORMAT_JUMP },
13181316
{ .opcode = _LOAD_CONST_INLINE_BORROW, .operand = (uintptr_t)self },
13191317
{ .opcode = _INTERNAL_INCREMENT_OPT_COUNTER },
13201318
{ .opcode = _EXIT_TRACE, .jump_target = 4, .format=UOP_FORMAT_JUMP },

Python/optimizer_analysis.c

+3
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,9 @@ remove_unneeded_uops(_PyUOpInstruction *buffer, int buffer_size)
497497
for (int pc = 0; pc < buffer_size; pc++) {
498498
int opcode = buffer[pc].opcode;
499499
switch (opcode) {
500+
case _START_EXECUTOR:
501+
may_have_escaped = false;
502+
break;
500503
case _SET_IP:
501504
buffer[pc].opcode = _NOP;
502505
last_set_ip = pc;

0 commit comments

Comments
 (0)