[Python-checkins] python/dist/src/Python compile.c,2.277,2.278

rhettinger@users.sourceforge.net rhettinger@users.sourceforge.net
Fri, 28 Mar 2003 04:05:05 -0800


Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1:/tmp/cvs-serv7004

Modified Files:
	compile.c 
Log Message:
Factored out test for absolute jumps.

Index: compile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v
retrieving revision 2.277
retrieving revision 2.278
diff -C2 -d -r2.277 -r2.278
*** compile.c	26 Mar 2003 01:07:54 -0000	2.277
--- compile.c	28 Mar 2003 12:05:00 -0000	2.278
***************
*** 326,330 ****
  #define GETARG(arr, i) ((int)((arr[i+2]<<8) + arr[i+1]))
  #define UNCONDITIONAL_JUMP(op)  (op==JUMP_ABSOLUTE || op==JUMP_FORWARD)
! #define GETJUMPTGT(arr, i) (GETARG(arr,i) + (arr[i]==JUMP_ABSOLUTE ? 0 : i+3))
  #define SETARG(arr, i, val) arr[i+2] = val>>8; arr[i+1] = val & 255
  
--- 326,331 ----
  #define GETARG(arr, i) ((int)((arr[i+2]<<8) + arr[i+1]))
  #define UNCONDITIONAL_JUMP(op)  (op==JUMP_ABSOLUTE || op==JUMP_FORWARD)
! #define ABSOLUTE_JUMP(op) (op==JUMP_ABSOLUTE || op==CONTINUE_LOOP)
! #define GETJUMPTGT(arr, i) (GETARG(arr,i) + (ABSOLUTE_JUMP(arr[i]) ? 0 : i+3))
  #define SETARG(arr, i, val) arr[i+2] = val>>8; arr[i+1] = val & 255
  
***************
*** 395,399 ****
  			if (opcode == JUMP_FORWARD) /* JMP_ABS can go backwards */
  				opcode = JUMP_ABSOLUTE;
! 			if (opcode != JUMP_ABSOLUTE && opcode != CONTINUE_LOOP)
  				tgttgt -= i + 3;     /* Calc relative jump addr */
  			if (tgttgt < 0)           /* No backward relative jumps */
--- 396,400 ----
  			if (opcode == JUMP_FORWARD) /* JMP_ABS can go backwards */
  				opcode = JUMP_ABSOLUTE;
! 			if (!ABSOLUTE_JUMP(opcode))
  				tgttgt -= i + 3;     /* Calc relative jump addr */
  			if (tgttgt < 0)           /* No backward relative jumps */