mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 21:51:50 +00:00 
			
		
		
		
	GH-122616: Simplify LOAD_ATTR_WITH_HINT and STORE_ATTR_WITH_HINT (GH-122620)
This commit is contained in:
		
							parent
							
								
									1bb955a2fe
								
							
						
					
					
						commit
						5bd72912a1
					
				
					 3 changed files with 44 additions and 95 deletions
				
			
		
							
								
								
									
										61
									
								
								Python/executor_cases.c.h
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										61
									
								
								Python/executor_cases.c.h
									
										
									
										generated
									
									
									
								
							|  | @ -2367,22 +2367,16 @@ | |||
|                 JUMP_TO_JUMP_TARGET(); | ||||
|             } | ||||
|             PyObject *name = GETITEM(FRAME_CO_NAMES, oparg>>1); | ||||
|             if (DK_IS_UNICODE(dict->ma_keys)) { | ||||
|                 PyDictUnicodeEntry *ep = DK_UNICODE_ENTRIES(dict->ma_keys) + hint; | ||||
|                 if (ep->me_key != name) { | ||||
|                     UOP_STAT_INC(uopcode, miss); | ||||
|                     JUMP_TO_JUMP_TARGET(); | ||||
|                 } | ||||
|                 attr_o = ep->me_value; | ||||
|             if (!DK_IS_UNICODE(dict->ma_keys)) { | ||||
|                 UOP_STAT_INC(uopcode, miss); | ||||
|                 JUMP_TO_JUMP_TARGET(); | ||||
|             } | ||||
|             else { | ||||
|                 PyDictKeyEntry *ep = DK_ENTRIES(dict->ma_keys) + hint; | ||||
|                 if (ep->me_key != name) { | ||||
|                     UOP_STAT_INC(uopcode, miss); | ||||
|                     JUMP_TO_JUMP_TARGET(); | ||||
|                 } | ||||
|                 attr_o = ep->me_value; | ||||
|             PyDictUnicodeEntry *ep = DK_UNICODE_ENTRIES(dict->ma_keys) + hint; | ||||
|             if (ep->me_key != name) { | ||||
|                 UOP_STAT_INC(uopcode, miss); | ||||
|                 JUMP_TO_JUMP_TARGET(); | ||||
|             } | ||||
|             attr_o = ep->me_value; | ||||
|             if (attr_o == NULL) { | ||||
|                 UOP_STAT_INC(uopcode, miss); | ||||
|                 JUMP_TO_JUMP_TARGET(); | ||||
|  | @ -2601,35 +2595,20 @@ | |||
|             } | ||||
|             PyObject *old_value; | ||||
|             uint64_t new_version; | ||||
|             if (DK_IS_UNICODE(dict->ma_keys)) { | ||||
|                 PyDictUnicodeEntry *ep = DK_UNICODE_ENTRIES(dict->ma_keys) + hint; | ||||
|                 if (ep->me_key != name) { | ||||
|                     UOP_STAT_INC(uopcode, miss); | ||||
|                     JUMP_TO_JUMP_TARGET(); | ||||
|                 } | ||||
|                 old_value = ep->me_value; | ||||
|                 if (old_value == NULL) { | ||||
|                     UOP_STAT_INC(uopcode, miss); | ||||
|                     JUMP_TO_JUMP_TARGET(); | ||||
|                 } | ||||
|                 new_version = _PyDict_NotifyEvent(tstate->interp, PyDict_EVENT_MODIFIED, dict, name, PyStackRef_AsPyObjectBorrow(value)); | ||||
|                 ep->me_value = PyStackRef_AsPyObjectSteal(value); | ||||
|             if (!DK_IS_UNICODE(dict->ma_keys)) { | ||||
|                 UOP_STAT_INC(uopcode, miss); | ||||
|                 JUMP_TO_JUMP_TARGET(); | ||||
|             } | ||||
|             else { | ||||
|                 PyDictKeyEntry *ep = DK_ENTRIES(dict->ma_keys) + hint; | ||||
|                 if (ep->me_key != name) { | ||||
|                     UOP_STAT_INC(uopcode, miss); | ||||
|                     JUMP_TO_JUMP_TARGET(); | ||||
|                 } | ||||
|                 old_value = ep->me_value; | ||||
|                 if (old_value == NULL) { | ||||
|                     UOP_STAT_INC(uopcode, miss); | ||||
|                     JUMP_TO_JUMP_TARGET(); | ||||
|                 } | ||||
|                 new_version = _PyDict_NotifyEvent(tstate->interp, PyDict_EVENT_MODIFIED, dict, name, PyStackRef_AsPyObjectBorrow(value)); | ||||
|                 ep->me_value = PyStackRef_AsPyObjectSteal(value); | ||||
|             PyDictUnicodeEntry *ep = DK_UNICODE_ENTRIES(dict->ma_keys) + hint; | ||||
|             if (ep->me_key != name) { | ||||
|                 UOP_STAT_INC(uopcode, miss); | ||||
|                 JUMP_TO_JUMP_TARGET(); | ||||
|             } | ||||
|             Py_DECREF(old_value); | ||||
|             old_value = ep->me_value; | ||||
|             PyDict_WatchEvent event = old_value == NULL ? PyDict_EVENT_ADDED : PyDict_EVENT_MODIFIED; | ||||
|             new_version = _PyDict_NotifyEvent(tstate->interp, event, dict, name, PyStackRef_AsPyObjectBorrow(value)); | ||||
|             ep->me_value = PyStackRef_AsPyObjectSteal(value); | ||||
|             Py_XDECREF(old_value); | ||||
|             STAT_INC(STORE_ATTR, hit); | ||||
|             /* Ensure dict is GC tracked if it needs to be */ | ||||
|             if (!_PyObject_GC_IS_TRACKED(dict) && _PyObject_GC_MAY_BE_TRACKED(PyStackRef_AsPyObjectBorrow(value))) { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Mark Shannon
						Mark Shannon