[Python-checkins] python/dist/src/Python ceval.c,2.383,2.384

arigo at users.sourceforge.net arigo at users.sourceforge.net
Sat Mar 20 15:03:20 EST 2004


Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18748
Modified Files:
	ceval.c 
Log Message:
A 2% speed improvement with gcc on low-endian machines. My guess is that this
new pattern for NEXTARG() is detected and optimized as a single (*short)
loading.
Index: ceval.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v
retrieving revision 2.383
retrieving revision 2.384
diff -C2 -d -r2.383 -r2.384
*** ceval.c	12 Mar 2004 16:33:17 -0000	2.383
--- ceval.c	20 Mar 2004 20:03:17 -0000	2.384
***************
*** 628,632 ****
 #define INSTR_OFFSET()	(next_instr - first_instr)
 #define NEXTOP()	(*next_instr++)
! #define NEXTARG()	(next_instr += 2, (next_instr[-1]<<8) + next_instr[-2])
 #define JUMPTO(x)	(next_instr = first_instr + (x))
 #define JUMPBY(x)	(next_instr += (x))
--- 628,633 ----
 #define INSTR_OFFSET()	(next_instr - first_instr)
 #define NEXTOP()	(*next_instr++)
! #define OPARG()		(next_instr[0] + (next_instr[1]<<8))
! #define OPARG_SIZE	2
 #define JUMPTO(x)	(next_instr = first_instr + (x))
 #define JUMPBY(x)	(next_instr += (x))
***************
*** 659,664 ****
 
 #define PREDICTED(op)		PRED_##op: next_instr++
! #define PREDICTED_WITH_ARG(op)	PRED_##op: oparg = (next_instr[2]<<8) + \
! 				next_instr[1]; next_instr += 3
 
 /* Stack manipulation macros */
--- 660,664 ----
 
 #define PREDICTED(op)		PRED_##op: next_instr++
! #define PREDICTED_WITH_ARG(op)	PRED_##op: next_instr++; oparg = OPARG(); next_instr += OPARG_SIZE
 
 /* Stack manipulation macros */
***************
*** 863,868 ****
 
 		opcode = NEXTOP();
! 		if (HAS_ARG(opcode))
! 			oparg = NEXTARG();
 	 dispatch_opcode:
 #ifdef DYNAMIC_EXECUTION_PROFILE
--- 863,871 ----
 
 		opcode = NEXTOP();
! 		if (HAS_ARG(opcode)) {
! 			oparg = OPARG();
! 			next_instr += OPARG_SIZE;
! 		}
! 
 	 dispatch_opcode:
 #ifdef DYNAMIC_EXECUTION_PROFILE
***************
*** 2250,2254 ****
 		case EXTENDED_ARG:
 			opcode = NEXTOP();
! 			oparg = oparg<<16 | NEXTARG();
 			goto dispatch_opcode;
 
--- 2253,2258 ----
 		case EXTENDED_ARG:
 			opcode = NEXTOP();
! 			oparg = oparg<<16 | OPARG();
! 			next_instr += OPARG_SIZE;
 			goto dispatch_opcode;
 


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /