[Python-checkins] CVS: python/dist/src/Lib dis.py,1.24,1.25

Fred L. Drake python-dev@python.org
Wed, 23 Aug 2000 17:32:12 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory slayer.i.sourceforge.net:/tmp/cvs-serv19656/Lib

Modified Files:
	dis.py 
Log Message:

Charles G. Waldman <cgw@fnal.gov>:
Add the EXTENDED_ARG opcode to the virtual machine, allowing 32-bit
arguments to opcodes instead of being forced to stick to the 16-bit
limit.  This is especially useful for machine-generated code, which
can be too long for the SET_LINENO parameter to fit into 16 bits.

This closes the implementation portion of SourceForge patch #100893.


Index: dis.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/dis.py,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -r1.24 -r1.25
*** dis.py	2000/08/21 17:18:40	1.24
--- dis.py	2000/08/24 00:32:09	1.25
***************
*** 57,60 ****
--- 57,61 ----
  	n = len(code)
  	i = 0
+ 	extended_arg = 0
  	while i < n:
  		c = code[i]
***************
*** 69,74 ****
  		i = i+1
  		if op >= HAVE_ARGUMENT:
! 			oparg = ord(code[i]) + ord(code[i+1])*256
  			i = i+2
  			print string.rjust(`oparg`, 5),
  			if op in hasconst:
--- 70,78 ----
  		i = i+1
  		if op >= HAVE_ARGUMENT:
! 			oparg = ord(code[i]) + ord(code[i+1])*256 + extended_arg
! 			extended_arg = 0
  			i = i+2
+ 			if op == EXTENDED_ARG:
+ 				extended_arg = oparg*65536L
  			print string.rjust(`oparg`, 5),
  			if op in hasconst:
***************
*** 259,262 ****
--- 263,268 ----
  def_op('CALL_FUNCTION_VAR_KW', 142)  # #args + (#kwargs << 8)
  
+ def_op('EXTENDED_ARG', 143) 
+ EXTENDED_ARG = 143
  
  def _test():