mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	GH-90081: Run python tracers at full speed (GH-95328)
This commit is contained in:
		
							parent
							
								
									ea269b9a38
								
							
						
					
					
						commit
						b8b2990fb3
					
				
					 3 changed files with 12 additions and 6 deletions
				
			
		|  | @ -5631,7 +5631,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int | |||
|             assert(oparg); | ||||
|             oparg <<= 8; | ||||
|             oparg |= _Py_OPARG(*next_instr); | ||||
|             // We might be tracing. To avoid breaking tracing guarantees in 
 | ||||
|             // We might be tracing. To avoid breaking tracing guarantees in
 | ||||
|             // quickened instructions, always deoptimize the next opcode:
 | ||||
|             opcode = _PyOpcode_Deopt[_Py_OPCODE(*next_instr)]; | ||||
|             PRE_DISPATCH_GOTO(); | ||||
|  | @ -5661,9 +5661,9 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, _PyInterpreterFrame *frame, int | |||
|         case DO_TRACING: | ||||
| #endif | ||||
|     { | ||||
|         if (tstate->tracing == 0 && | ||||
|             INSTR_OFFSET() >= frame->f_code->_co_firsttraceable | ||||
|         ) { | ||||
|         assert(cframe.use_tracing); | ||||
|         assert(tstate->tracing == 0); | ||||
|         if (INSTR_OFFSET() >= frame->f_code->_co_firsttraceable) { | ||||
|             int instr_prev = _PyInterpreterFrame_LASTI(frame); | ||||
|             frame->prev_instr = next_instr; | ||||
|             TRACING_NEXTOPARG(); | ||||
|  | @ -6875,12 +6875,15 @@ void | |||
| PyThreadState_EnterTracing(PyThreadState *tstate) | ||||
| { | ||||
|     tstate->tracing++; | ||||
|     tstate->cframe->use_tracing = 0; | ||||
| } | ||||
| 
 | ||||
| void | ||||
| PyThreadState_LeaveTracing(PyThreadState *tstate) | ||||
| { | ||||
|     assert(tstate->tracing > 0 && tstate->cframe->use_tracing == 0); | ||||
|     tstate->tracing--; | ||||
|     _PyThreadState_UpdateTracingState(tstate); | ||||
| } | ||||
| 
 | ||||
| static int | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Mark Shannon
						Mark Shannon