Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert "Fix a bug with CALL_STAT_INC"
Let's try a different fix instead.
  • Loading branch information
gvanrossum committed Apr 16, 2024
commit 779f7f4ee59ebde0b4f24984c99ecb1a41def44e
7 changes: 2 additions & 5 deletions Include/internal/pycore_code.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ extern int _PyStaticCode_Init(PyCodeObject *co);
#define STAT_INC(opname, name) do { if (_Py_stats) _Py_stats->opcode_stats[opname].specialization.name++; } while (0)
#define STAT_DEC(opname, name) do { if (_Py_stats) _Py_stats->opcode_stats[opname].specialization.name--; } while (0)
#define OPCODE_EXE_INC(opname) do { if (_Py_stats) _Py_stats->opcode_stats[opname].execution_count++; } while (0)
#define REAL_CALL_STAT_INC(name) do { if (_Py_stats) _Py_stats->call_stats.name++; } while (0)
#define CALL_STAT_INC(name) do { if (_Py_stats) _Py_stats->call_stats.name++; } while (0)
#define OBJECT_STAT_INC(name) do { if (_Py_stats) _Py_stats->object_stats.name++; } while (0)
#define OBJECT_STAT_INC_COND(name, cond) \
do { if (_Py_stats && cond) _Py_stats->object_stats.name++; } while (0)
Expand Down Expand Up @@ -336,7 +336,7 @@ PyAPI_FUNC(PyObject*) _Py_GetSpecializationStats(void);
#define STAT_INC(opname, name) ((void)0)
#define STAT_DEC(opname, name) ((void)0)
#define OPCODE_EXE_INC(opname) ((void)0)
#define REAL_CALL_STAT_INC(name) ((void)0)
#define CALL_STAT_INC(name) ((void)0)
#define OBJECT_STAT_INC(name) ((void)0)
#define OBJECT_STAT_INC_COND(name, cond) ((void)0)
#define EVAL_CALL_STAT_INC(name) ((void)0)
Expand All @@ -351,9 +351,6 @@ PyAPI_FUNC(PyObject*) _Py_GetSpecializationStats(void);
#define RARE_EVENT_STAT_INC(name) ((void)0)
#endif // !Py_STATS

// We do a little dance here so we can redefine and restore CALL_STAT_INC
#define CALL_STAT_INC(name) REAL_CALL_STAT_INC(name)

// Utility functions for reading/writing 32/64-bit values in the inline caches.
// Great care should be taken to ensure that these functions remain correct and
// performant! They should compile to just "move" instructions on all supported
Expand Down
11 changes: 0 additions & 11 deletions Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -1110,17 +1110,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int

#endif // _Py_JIT

// Undefine the macros we redefined, to avoid using the wrong ones below
#undef LOAD_IP
#undef GOTO_ERROR
#undef ENABLE_SPECIALIZATION
#undef STAT_INC
#undef STAT_DEC
#undef CALL_STAT_INC

// Restore this one
#define CALL_STAT_INC(name) REAL_CALL_STAT_INC(name)

}

#if defined(__GNUC__)
Expand Down