mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	bpo-45256: Don't track the exact depth of each InterpreterFrame (GH-30372)
				
					
				
			This commit is contained in:
		
							parent
							
								
									cae55542d2
								
							
						
					
					
						commit
						332e6b9725
					
				
					 4 changed files with 16 additions and 17 deletions
				
			
		|  | @ -1683,7 +1683,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr | |||
|     cframe.previous = prev_cframe; | ||||
|     tstate->cframe = &cframe; | ||||
| 
 | ||||
|     assert(frame->depth == 0); | ||||
|     frame->is_entry = true; | ||||
|     /* Push frame */ | ||||
|     frame->previous = prev_cframe->current_frame; | ||||
|     cframe.current_frame = frame; | ||||
|  | @ -2310,7 +2310,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr | |||
|             _PyFrame_SetStackPointer(frame, stack_pointer); | ||||
|             new_frame->previous = frame; | ||||
|             frame = cframe.current_frame = new_frame; | ||||
|             new_frame->depth = frame->depth + 1; | ||||
|             goto start_frame; | ||||
|         } | ||||
| 
 | ||||
|  | @ -2475,7 +2474,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr | |||
|             TRACE_FUNCTION_EXIT(); | ||||
|             DTRACE_FUNCTION_EXIT(); | ||||
|             _Py_LeaveRecursiveCall(tstate); | ||||
|             if (frame->depth) { | ||||
|             if (!frame->is_entry) { | ||||
|                 frame = cframe.current_frame = pop_frame(tstate, frame); | ||||
|                 _PyFrame_StackPush(frame, retval); | ||||
|                 goto resume_frame; | ||||
|  | @ -2625,7 +2624,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr | |||
|         } | ||||
| 
 | ||||
|         TARGET(SEND) { | ||||
|             assert(frame->depth == 0); | ||||
|             assert(frame->is_entry); | ||||
|             assert(STACK_LEVEL() >= 2); | ||||
|             PyObject *v = POP(); | ||||
|             PyObject *receiver = TOP(); | ||||
|  | @ -2684,7 +2683,7 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr | |||
|         } | ||||
| 
 | ||||
|         TARGET(YIELD_VALUE) { | ||||
|             assert(frame->depth == 0); | ||||
|             assert(frame->is_entry); | ||||
|             PyObject *retval = POP(); | ||||
| 
 | ||||
|             if (frame->f_code->co_flags & CO_ASYNC_GENERATOR) { | ||||
|  | @ -4612,7 +4611,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr | |||
|                     _PyFrame_SetStackPointer(frame, stack_pointer); | ||||
|                     new_frame->previous = frame; | ||||
|                     cframe.current_frame = frame = new_frame; | ||||
|                     new_frame->depth = frame->depth + 1; | ||||
|                     goto start_frame; | ||||
|                 } | ||||
|             } | ||||
|  | @ -4706,7 +4704,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr | |||
|             _PyFrame_SetStackPointer(frame, stack_pointer); | ||||
|             new_frame->previous = frame; | ||||
|             frame = cframe.current_frame = new_frame; | ||||
|             new_frame->depth = frame->depth + 1; | ||||
|             goto start_frame; | ||||
|         } | ||||
| 
 | ||||
|  | @ -5382,7 +5379,7 @@ MISS_WITH_OPARG_COUNTER(STORE_SUBSCR) | |||
| exit_unwind: | ||||
|     assert(_PyErr_Occurred(tstate)); | ||||
|     _Py_LeaveRecursiveCall(tstate); | ||||
|     if (frame->depth == 0) { | ||||
|     if (frame->is_entry) { | ||||
|         /* Restore previous cframe and exit */ | ||||
|         tstate->cframe = cframe.previous; | ||||
|         tstate->cframe->use_tracing = cframe.use_tracing; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Brandt Bucher
						Brandt Bucher