mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	gh-117139: Garbage collector support for deferred refcounting (#122956)
The free-threaded GC now visits interpreter stacks to keep objects that use deferred reference counting alive. Interpreter frames are zero initialized in the free-threaded GC so that the GC doesn't see garbage data. This is a temporary measure until stack spilling around escaping calls is implemented. Co-authored-by: Ken Jin <kenjin@python.org>
This commit is contained in:
		
							parent
							
								
									1dad23edbc
								
							
						
					
					
						commit
						e001027188
					
				
					 6 changed files with 121 additions and 20 deletions
				
			
		|  | @ -15,15 +15,7 @@ _PyFrame_Traverse(_PyInterpreterFrame *frame, visitproc visit, void *arg) | |||
|     Py_VISIT(frame->f_locals); | ||||
|     Py_VISIT(frame->f_funcobj); | ||||
|     Py_VISIT(_PyFrame_GetCode(frame)); | ||||
|    /* locals */ | ||||
|     _PyStackRef *locals = _PyFrame_GetLocalsArray(frame); | ||||
|     _PyStackRef *sp = frame->stackpointer; | ||||
|     /* locals and stack */ | ||||
|     while (sp > locals) { | ||||
|         sp--; | ||||
|         Py_VISIT(PyStackRef_AsPyObjectBorrow(*sp)); | ||||
|     } | ||||
|     return 0; | ||||
|     return _PyGC_VisitFrameStack(frame, visit, arg); | ||||
| } | ||||
| 
 | ||||
| PyFrameObject * | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Sam Gross
						Sam Gross