Skip to content

Commit 637589e

Browse files
Revert "Make deopt more efficient"
This reverts commit 982c51d.
1 parent f5b1c93 commit 637589e

File tree

5 files changed

+460
-461
lines changed

5 files changed

+460
-461
lines changed

Python/bytecodes.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
#include "ceval_macros.h"
4646

4747
/* Flow control macros */
48-
#define GO_TO_INSTRUCTION(instname, SIZE) ((void)0)
48+
#define GO_TO_INSTRUCTION(instname) ((void)0)
4949

5050
#define inst(name, ...) case name:
5151
#define op(name, ...) /* NAME is ignored */
@@ -1942,7 +1942,7 @@ dummy_func(
19421942
// cancel out the decrement that will happen in LOAD_SUPER_ATTR; we
19431943
// don't want to specialize instrumented instructions
19441944
PAUSE_ADAPTIVE_COUNTER(this_instr[1].counter);
1945-
GO_TO_INSTRUCTION(LOAD_SUPER_ATTR, INSTRUCTION_SIZE);
1945+
GO_TO_INSTRUCTION(LOAD_SUPER_ATTR);
19461946
}
19471947

19481948
family(LOAD_SUPER_ATTR, INLINE_CACHE_ENTRIES_LOAD_SUPER_ATTR) = {
@@ -4255,7 +4255,7 @@ dummy_func(
42554255
frame, this_instr, function, arg);
42564256
ERROR_IF(err, error);
42574257
PAUSE_ADAPTIVE_COUNTER(this_instr[1].counter);
4258-
GO_TO_INSTRUCTION(CALL_KW, INSTRUCTION_SIZE);
4258+
GO_TO_INSTRUCTION(CALL_KW);
42594259
}
42604260

42614261
op(_MAYBE_EXPAND_METHOD_KW, (callable[1], self_or_null[1], args[oparg], kwnames_in -- func[1], maybe_self[1], args[oparg], kwnames_out)) {
@@ -4488,7 +4488,7 @@ dummy_func(
44884488
_CHECK_PERIODIC;
44894489

44904490
inst(INSTRUMENTED_CALL_FUNCTION_EX, ( -- )) {
4491-
GO_TO_INSTRUCTION(CALL_FUNCTION_EX, INSTRUCTION_SIZE);
4491+
GO_TO_INSTRUCTION(CALL_FUNCTION_EX);
44924492
}
44934493

44944494
op(_MAKE_CALLARGS_A_TUPLE, (func, unused, callargs, kwargs_in if (oparg & 1) -- func, unused, tuple, kwargs_out if (oparg & 1))) {

Python/ceval_macros.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -329,14 +329,14 @@ GETITEM(PyObject *v, Py_ssize_t i) {
329329
PyStackRef_XCLOSE(tmp); } while (0)
330330
#ifdef Py_TAIL_CALL_INTERP
331331
#ifdef LLTRACE
332-
#define GO_TO_INSTRUCTION(op, SIZE) do { \
332+
#define GO_TO_INSTRUCTION(op) do { \
333333
Py_MUSTTAIL \
334-
return (INSTRUCTION_TABLE[op])(frame, stack_pointer, tstate, next_instr - 1 - SIZE, oparg, entry_frame, lltrace); \
334+
return (INSTRUCTION_TABLE[op])(frame, stack_pointer, tstate, next_instr - 1 - _PyOpcode_Caches[_PyOpcode_Deopt[op]], oparg, entry_frame, lltrace); \
335335
} while (0)
336336
#else
337-
#define GO_TO_INSTRUCTION(op, SIZE) do { \
337+
#define GO_TO_INSTRUCTION(op) do { \
338338
Py_MUSTTAIL \
339-
return (INSTRUCTION_TABLE[op])(frame, stack_pointer, tstate, next_instr - 1 - SIZE, oparg, entry_frame); \
339+
return (INSTRUCTION_TABLE[op])(frame, stack_pointer, tstate, next_instr - 1 - _PyOpcode_Caches[_PyOpcode_Deopt[op]], oparg, entry_frame); \
340340
} while (0)
341341
#endif
342342
#else
@@ -357,12 +357,12 @@ GETITEM(PyObject *v, Py_ssize_t i) {
357357
#define UPDATE_MISS_STATS(INSTNAME) ((void)0)
358358
#endif
359359

360-
#define DEOPT_IF(COND, INSTNAME, SIZE) \
360+
#define DEOPT_IF(COND, INSTNAME) \
361361
if ((COND)) { \
362362
/* This is only a single jump on release builds! */ \
363363
UPDATE_MISS_STATS((INSTNAME)); \
364364
/* assert(_PyOpcode_Deopt[opcode] == (INSTNAME)); */ \
365-
GO_TO_INSTRUCTION(INSTNAME, SIZE); \
365+
GO_TO_INSTRUCTION(INSTNAME); \
366366
}
367367

368368

0 commit comments

Comments
 (0)