File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,25 @@ extern const char *_PyUOpName(int index);
24
24
* ./adaptive.md
25
25
*/
26
26
27
+ #ifdef Py_GIL_DISABLED
28
+ #define SET_OPCODE_OR_RETURN (instr , opcode ) \
29
+ do { \
30
+ uint8_t old_op = _Py_atomic_load_uint8_relaxed(&(instr)->op.code); \
31
+ if (old_op >= MIN_INSTRUMENTED_OPCODE) { \
32
+ /* Lost race with instrumentation */ \
33
+ return ; \
34
+ } \
35
+ if (!_Py_atomic_compare_exchange_uint8 (& (instr )-> op .code , & old_op , \
36
+ (opcode ))) { \
37
+ /* Lost race with instrumentation */ \
38
+ assert (old_op >= MIN_INSTRUMENTED_OPCODE ); \
39
+ return ; \
40
+ } \
41
+ } while (0 )
42
+ #else
43
+ #define SET_OPCODE_OR_RETURN (instr , opcode ) (instr)->op.code = (opcode)
44
+ #endif
45
+
27
46
#ifdef Py_STATS
28
47
GCStats _py_gc_stats [NUM_GENERATIONS ] = { 0 };
29
48
static PyStats _Py_stats_struct = { .gc_stats = _py_gc_stats };
You can’t perform that action at this time.
0 commit comments