Skip to content

Commit 7240b15

Browse files
Remove heavywieght locking--not needed
1 parent 92f3dbf commit 7240b15

File tree

3 files changed

+4
-18
lines changed

3 files changed

+4
-18
lines changed

Python/bytecodes.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3019,15 +3019,15 @@ dummy_func(
30193019
}
30203020
PyCodeObject *code = _PyFrame_GetCode(frame);
30213021

3022-
LOCK_OBJECT_SLOW(code);
30233022
_PyExecutorObject *executor = code->co_executors->executors[oparg & 255];
30243023
// We are responsible for cleaning up after ourselves.
30253024
if (!FT_ATOMIC_LOAD_UINT8_RELAXED(executor->vm_data.valid)) {
30263025
opcode = executor->vm_data.opcode;
30273026
oparg = (oparg & ~255) | executor->vm_data.oparg;
30283027
next_instr = this_instr;
3028+
Py_BEGIN_CRITICAL_SECTION(code);
30293029
_Py_ExecutorDetach(executor);
3030-
UNLOCK_OBJECT_SLOW(code);
3030+
Py_END_CRITICAL_SECTION();
30313031
DISPATCH_GOTO();
30323032
}
30333033
assert(tstate->current_executor == NULL);
@@ -3043,15 +3043,10 @@ dummy_func(
30433043
if (_PyOpcode_Caches[_PyOpcode_Deopt[opcode]]) {
30443044
PAUSE_ADAPTIVE_COUNTER(this_instr[1].counter);
30453045
}
3046-
#ifdef Py_GIL_DISABLED
3047-
UNLOCK_OBJECT_SLOW(code);
3048-
#endif
30493046
DISPATCH_GOTO();
30503047
}
30513048
assert(executor != ((_PyThreadStateImpl *)tstate)->jit_executor_state.cold_executor);
30523049
tstate->jit_exit = NULL;
3053-
Py_INCREF(executor);
3054-
UNLOCK_OBJECT_SLOW(code);
30553050
TIER1_TO_TIER2(executor);
30563051
#else
30573052
Py_FatalError("ENTER_EXECUTOR is not supported in this build");

Python/ceval_macros.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,13 +294,9 @@ GETITEM(PyObject *v, Py_ssize_t i) {
294294
#ifdef Py_GIL_DISABLED
295295
# define LOCK_OBJECT(op) PyMutex_LockFast(&(_PyObject_CAST(op))->ob_mutex)
296296
# define UNLOCK_OBJECT(op) PyMutex_Unlock(&(_PyObject_CAST(op))->ob_mutex)
297-
# define LOCK_OBJECT_SLOW(op) PyMutex_LockFast(&(_PyObject_CAST(op))->ob_mutex)
298-
# define UNLOCK_OBJECT_SLOW(op) PyMutex_Unlock(&(_PyObject_CAST(op))->ob_mutex)
299297
#else
300298
# define LOCK_OBJECT(op) (1)
301299
# define UNLOCK_OBJECT(op) ((void)0)
302-
# define LOCK_OBJECT_SLOW(op) ((void)0)
303-
# define UNLOCK_OBJECT_SLOW(op) ((void)0)
304300
#endif
305301

306302
#define GLOBALS() frame->f_globals

Python/generated_cases.c.h

Lines changed: 2 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)