mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Reuse identifier of PREDICT macros as PREDICT_ID (GH-17155)
In function `_PyEval_EvalFrameDefault`, macros PREDICT and PREDICTED use the same identifier creation scheme, which may be shared between them, reducing code repetition, and do ensure that the same identifier is generated.
This commit is contained in:
		
							parent
							
								
									d4331c56b4
								
							
						
					
					
						commit
						baf29b2216
					
				
					 1 changed files with 7 additions and 5 deletions
				
			
		|  | @ -921,21 +921,23 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) | |||
| 
 | ||||
| */ | ||||
| 
 | ||||
| #define PREDICT_ID(op)          PRED_##op | ||||
| 
 | ||||
| #if defined(DYNAMIC_EXECUTION_PROFILE) || USE_COMPUTED_GOTOS | ||||
| #define PREDICT(op)             if (0) goto PRED_##op | ||||
| #define PREDICT(op)             if (0) goto PREDICT_ID(op) | ||||
| #else | ||||
| #define PREDICT(op) \ | ||||
|     do{ \ | ||||
|     do { \ | ||||
|         _Py_CODEUNIT word = *next_instr; \ | ||||
|         opcode = _Py_OPCODE(word); \ | ||||
|         if (opcode == op){ \ | ||||
|         if (opcode == op) { \ | ||||
|             oparg = _Py_OPARG(word); \ | ||||
|             next_instr++; \ | ||||
|             goto PRED_##op; \ | ||||
|             goto PREDICT_ID(op); \ | ||||
|         } \ | ||||
|     } while(0) | ||||
| #endif | ||||
| #define PREDICTED(op)           PRED_##op: | ||||
| #define PREDICTED(op)           PREDICT_ID(op): | ||||
| 
 | ||||
| 
 | ||||
| /* Stack manipulation macros */ | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Denis Chernikov
						Denis Chernikov