[Python-checkins] python/dist/src/Python ceval.c,2.373,2.374

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Fri Feb 6 13:32:38 EST 2004


Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8122

Modified Files:
	ceval.c 
Log Message:
SF patch #864059:  optimize eval_frame

Simplified version of Neal Norwitz's patch which adds gotos for 
opcodes that set "why".  This skips a number of tests where the 
outcome of the tests are known in advance.



Index: ceval.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v
retrieving revision 2.373
retrieving revision 2.374
diff -C2 -d -r2.373 -r2.374
*** ceval.c	20 Nov 2003 01:44:58 -0000	2.373
--- ceval.c	6 Feb 2004 18:32:33 -0000	2.374
***************
*** 1579,1588 ****
  		case BREAK_LOOP:
  			why = WHY_BREAK;
! 			break;
  
  		case CONTINUE_LOOP:
  			retval = PyInt_FromLong(oparg);
  			why = WHY_CONTINUE;
! 			break;
  
  		case RAISE_VARARGS:
--- 1579,1588 ----
  		case BREAK_LOOP:
  			why = WHY_BREAK;
! 			goto fast_block_end;
  
  		case CONTINUE_LOOP:
  			retval = PyInt_FromLong(oparg);
  			why = WHY_CONTINUE;
! 			goto fast_block_end;
  
  		case RAISE_VARARGS:
***************
*** 1621,1625 ****
  			retval = POP();
  			why = WHY_RETURN;
! 			break;
  
  		case YIELD_VALUE:
--- 1621,1625 ----
  			retval = POP();
  			why = WHY_RETURN;
! 			goto fast_block_end;
  
  		case YIELD_VALUE:
***************
*** 1627,1632 ****
  			f->f_stacktop = stack_pointer;
  			why = WHY_YIELD;
! 			break;
! 
  
  		case EXEC_STMT:
--- 1627,1631 ----
  			f->f_stacktop = stack_pointer;
  			why = WHY_YIELD;
! 			goto fast_yield;
  
  		case EXEC_STMT:
***************
*** 2328,2331 ****
--- 2327,2331 ----
  		/* Unwind stacks if a (pseudo) exception occurred */
  
+ fast_block_end:
  		while (why != WHY_NOT && why != WHY_YIELD && f->f_iblock > 0) {
  			PyTryBlock *b = PyFrame_BlockPop(f);
***************
*** 2411,2414 ****
--- 2411,2415 ----
  		retval = NULL;
  
+ fast_yield:
  	if (tstate->use_tracing) {
  		if (tstate->c_tracefunc




More information about the Python-checkins mailing list