mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	GH-109214: _SET_IP before _PUSH_FRAME (but not _POP_FRAME) (GH-111001)
This commit is contained in:
		
							parent
							
								
									c0ea67dd0d
								
							
						
					
					
						commit
						e5168ff3f8
					
				
					 5 changed files with 28 additions and 44 deletions
				
			
		
							
								
								
									
										51
									
								
								Python/generated_cases.c.h
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										51
									
								
								Python/generated_cases.c.h
									
										
									
										generated
									
									
									
								
							|  | @ -987,36 +987,28 @@ | |||
| 
 | ||||
|         TARGET(RETURN_VALUE) { | ||||
|             PyObject *retval; | ||||
|             // _SAVE_CURRENT_IP
 | ||||
|             { | ||||
|                 TIER_ONE_ONLY | ||||
|                 frame->prev_instr = next_instr - 1; | ||||
|             } | ||||
|             // _POP_FRAME
 | ||||
|             retval = stack_pointer[-1]; | ||||
|             STACK_SHRINK(1); | ||||
|             { | ||||
|                 assert(EMPTY()); | ||||
|                 #if TIER_ONE | ||||
|                 assert(frame != &entry_frame); | ||||
|                 #endif | ||||
|                 STORE_SP(); | ||||
|                 _Py_LeaveRecursiveCallPy(tstate); | ||||
|                 // GH-99729: We need to unlink the frame *before* clearing it:
 | ||||
|                 _PyInterpreterFrame *dying = frame; | ||||
|                 frame = tstate->current_frame = dying->previous; | ||||
|                 _PyEval_FrameClearAndPop(tstate, dying); | ||||
|                 frame->prev_instr += frame->return_offset; | ||||
|                 _PyFrame_StackPush(frame, retval); | ||||
|                 LOAD_SP(); | ||||
|                 LOAD_IP(); | ||||
|     #if LLTRACE && TIER_ONE | ||||
|                 lltrace = maybe_lltrace_resume_frame(frame, &entry_frame, GLOBALS()); | ||||
|                 if (lltrace < 0) { | ||||
|                     goto exit_unwind; | ||||
|                 } | ||||
|     #endif | ||||
|             assert(EMPTY()); | ||||
|             #if TIER_ONE | ||||
|             assert(frame != &entry_frame); | ||||
|             #endif | ||||
|             STORE_SP(); | ||||
|             _Py_LeaveRecursiveCallPy(tstate); | ||||
|             // GH-99729: We need to unlink the frame *before* clearing it:
 | ||||
|             _PyInterpreterFrame *dying = frame; | ||||
|             frame = tstate->current_frame = dying->previous; | ||||
|             _PyEval_FrameClearAndPop(tstate, dying); | ||||
|             frame->prev_instr += frame->return_offset; | ||||
|             _PyFrame_StackPush(frame, retval); | ||||
|             LOAD_SP(); | ||||
|             LOAD_IP(); | ||||
| #if LLTRACE && TIER_ONE | ||||
|             lltrace = maybe_lltrace_resume_frame(frame, &entry_frame, GLOBALS()); | ||||
|             if (lltrace < 0) { | ||||
|                 goto exit_unwind; | ||||
|             } | ||||
| #endif | ||||
|             DISPATCH(); | ||||
|         } | ||||
| 
 | ||||
|  | @ -1049,11 +1041,6 @@ | |||
|                 value = GETITEM(FRAME_CO_CONSTS, oparg); | ||||
|                 Py_INCREF(value); | ||||
|             } | ||||
|             // _SAVE_CURRENT_IP
 | ||||
|             { | ||||
|                 TIER_ONE_ONLY | ||||
|                 frame->prev_instr = next_instr - 1; | ||||
|             } | ||||
|             // _POP_FRAME
 | ||||
|             retval = value; | ||||
|             { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Brandt Bucher
						Brandt Bucher