Skip to content

Commit 197e9f4

Browse files
reduce diff
1 parent e0890ff commit 197e9f4

File tree

4 files changed

+3
-25
lines changed

4 files changed

+3
-25
lines changed

Include/internal/pycore_optimizer.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,7 @@ typedef struct _PyExecutorLinkListNode {
2424
typedef struct {
2525
uint8_t opcode;
2626
uint8_t oparg;
27-
#ifdef Py_GIL_DISABLED
28-
uint8_t valid;
29-
#else
3027
uint8_t valid:1;
31-
#endif
3228
uint8_t linked:1;
3329
uint8_t chain_depth:6; // Must be big enough for MAX_CHAIN_DEPTH - 1.
3430
bool warm;

Include/internal/pycore_tstate.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ typedef struct _PyJitTracerPreviousState {
4848
} _PyJitTracerPreviousState;
4949

5050
typedef struct _PyJitTracerState {
51-
PyMutex lock;
5251
_PyUOpInstruction *code_buffer;
5352
_PyJitTracerInitialState initial_state;
5453
_PyJitTracerPreviousState prev_state;

Python/bytecodes.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3020,19 +3020,9 @@ dummy_func(
30203020
PyCodeObject *code = _PyFrame_GetCode(frame);
30213021

30223022
_PyExecutorObject *executor = code->co_executors->executors[oparg & 255];
3023-
// We are responsible for cleaning up after ourselves.
3024-
if (!executor->vm_data.valid) {
3025-
opcode = executor->vm_data.opcode;
3026-
oparg = (oparg & ~255) | executor->vm_data.oparg;
3027-
next_instr = this_instr;
3028-
Py_BEGIN_CRITICAL_SECTION(code);
3029-
_Py_ExecutorDetach(executor);
3030-
Py_END_CRITICAL_SECTION();
3031-
DISPATCH_GOTO();
3032-
}
3033-
assert(tstate->current_executor == NULL);
30343023
assert(executor->vm_data.index == INSTR_OFFSET() - 1);
30353024
assert(executor->vm_data.code == code);
3025+
assert(tstate->current_executor == NULL);
30363026
/* If the eval breaker is set then stay in tier 1.
30373027
* This avoids any potentially infinite loops
30383028
* involving _RESUME_CHECK */
@@ -3045,7 +3035,7 @@ dummy_func(
30453035
}
30463036
DISPATCH_GOTO();
30473037
}
3048-
assert(executor != ((_PyThreadStateImpl *)tstate)->jit_executor_state.cold_executor);
3038+
assert(executor != tstate->interp->cold_executor);
30493039
tstate->jit_exit = NULL;
30503040
TIER1_TO_TIER2(executor);
30513041
#else

Python/optimizer.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -941,15 +941,11 @@ _PyJit_TryInitializeTracing(
941941
return 0;
942942
}
943943

944-
if (!PyMutex_LockFast(&_tstate->jit_tracer_state.lock)) {
945-
return 0;
946-
}
947944

948945
if (_tstate->jit_tracer_state.code_buffer == NULL) {
949946
_tstate->jit_tracer_state.code_buffer = (_PyUOpInstruction *)_PyObject_VirtualAlloc(UOP_BUFFER_SIZE);
950947
if (_tstate->jit_tracer_state.code_buffer == NULL) {
951948
// Don't error, just go to next instruction.
952-
PyMutex_Unlock(&_tstate->jit_tracer_state.lock);
953949
return 0;
954950
}
955951
}
@@ -997,7 +993,6 @@ _PyJit_TryInitializeTracing(
997993
FT_ATOMIC_STORE_UINT16_RELAXED(close_loop_instr[1].counter.value_and_backoff, zero.value_and_backoff);
998994
}
999995
_Py_BloomFilter_Init(&_tstate->jit_tracer_state.prev_state.dependencies);
1000-
PyMutex_Unlock(&_tstate->jit_tracer_state.lock);
1001996
return 1;
1002997
}
1003998

@@ -1655,12 +1650,10 @@ jit_tracer_invalidate_dependency(PyThreadState *tstate, void *obj)
16551650
_Py_BloomFilter_Init(&obj_filter);
16561651
_Py_BloomFilter_Add(&obj_filter, obj);
16571652
_PyThreadStateImpl *_tstate = (_PyThreadStateImpl *)tstate;
1658-
FT_MUTEX_LOCK(&_tstate->jit_tracer_state.lock);
16591653
if (bloom_filter_may_contain(&_tstate->jit_tracer_state.prev_state.dependencies, &obj_filter))
16601654
{
16611655
FT_ATOMIC_STORE_UINT8(_tstate->jit_tracer_state.prev_state.dependencies_still_valid, 0);
1662-
}
1663-
FT_MUTEX_UNLOCK(&_tstate->jit_tracer_state.lock);
1656+
};
16641657
}
16651658

16661659
void

0 commit comments

Comments
 (0)