|
144 | 144 | DISPATCH_TABLE_VAR = TRACING_DISPATCH_TABLE; |
145 | 145 | # define LEAVE_TRACING() \ |
146 | 146 | DISPATCH_TABLE_VAR = DISPATCH_TABLE; |
147 | | -# define BAIL_TRACING_NO_DISPATCH() \ |
148 | | - do { \ |
149 | | - LEAVE_TRACING(); \ |
150 | | - if (!_PyErr_Occurred(tstate) && !_is_sys_tracing) { \ |
151 | | - _PyFrame_SetStackPointer(frame, stack_pointer); \ |
152 | | - int _err = _PyOptimizer_Optimize(frame, tstate); \ |
153 | | - _PyJit_FinalizeTracing(tstate); \ |
154 | | - stack_pointer = _PyFrame_GetStackPointer(frame); \ |
155 | | - if (_err < 0) { \ |
156 | | - JUMP_TO_LABEL(error); \ |
157 | | - } \ |
158 | | - } \ |
159 | | - else { \ |
160 | | - _PyFrame_SetStackPointer(frame, stack_pointer); \ |
161 | | - _PyJit_FinalizeTracing(tstate); \ |
162 | | - stack_pointer = _PyFrame_GetStackPointer(frame); \ |
163 | | - } \ |
164 | | - } while (0); |
165 | 147 | # define RECORD_TRACE_NO_DISPATCH() do { \ |
166 | | - int _is_sys_tracing = (tstate->c_tracefunc != NULL) || (tstate->c_profilefunc != NULL); \ |
167 | | - if (_is_sys_tracing) { \ |
168 | | - LEAVE_TRACING(); \ |
169 | | - } \ |
170 | | - else if ((IS_JIT_TRACING() && add_to_code_trace(tstate, frame, old_code, old_func, _old_stack_level, this_instr, next_instr, opcode, oparg, _jump_taken))) { \ |
171 | | - BAIL_TRACING_NO_DISPATCH(); \ |
| 148 | + int err = 0; \ |
| 149 | + _PyFrame_SetStackPointer(frame, stack_pointer); \ |
| 150 | + /* We need to check once more here in case it swapped out halfway. */ \ |
| 151 | + if (IS_JIT_TRACING()) { \ |
| 152 | + int full = add_to_code_trace(tstate, frame, old_code, old_func, _old_stack_level, this_instr, next_instr, opcode, oparg, _jump_taken); \ |
| 153 | + if (full) { \ |
| 154 | + LEAVE_TRACING(); \ |
| 155 | + err = bail_tracing_and_jit(tstate, frame); \ |
| 156 | + } \ |
172 | 157 | } \ |
| 158 | + stack_pointer = _PyFrame_GetStackPointer(frame); \ |
| 159 | + if (err < 0) { JUMP_TO_LABEL(error); } \ |
173 | 160 | } while (0); |
174 | 161 | #endif |
175 | 162 |
|
|
0 commit comments