Index: dist/src/Doc/lib/libdis.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdis.tex,v retrieving revision 1.41 diff -u -r1.41 libdis.tex --- dist/src/Doc/lib/libdis.tex 10 May 2003 08:51:26 -0000 1.41 +++ dist/src/Doc/lib/libdis.tex 5 Apr 2004 01:21:27 -0000 @@ -135,11 +135,6 @@ to position three. \end{opcodedesc} -\begin{opcodedesc}{ROT_FOUR}{} -Lifts second, third and forth stack item one position up, moves top down to -position four. -\end{opcodedesc} - \begin{opcodedesc}{DUP_TOP}{} Duplicates the reference on top of the stack. \end{opcodedesc} @@ -498,7 +493,8 @@ \begin{opcodedesc}{BUILD_TUPLE}{count} Creates a tuple consuming \var{count} items from the stack, and pushes -the resulting tuple onto the stack. +the resulting tuple onto the stack. The top item on the stack will +become the last item in the tuple. \end{opcodedesc} \begin{opcodedesc}{BUILD_LIST}{count} Index: dist/src/Include/opcode.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/opcode.h,v retrieving revision 2.44 diff -u -r2.44 opcode.h --- dist/src/Include/opcode.h 7 Mar 2004 07:31:05 -0000 2.44 +++ dist/src/Include/opcode.h 5 Apr 2004 01:21:31 -0000 @@ -12,7 +12,6 @@ #define ROT_TWO 2 #define ROT_THREE 3 #define DUP_TOP 4 -#define ROT_FOUR 5 #define UNARY_POSITIVE 10 #define UNARY_NEGATIVE 11 Index: dist/src/Lib/opcode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/opcode.py,v retrieving revision 1.5 diff -u -r1.5 opcode.py --- dist/src/Lib/opcode.py 7 Mar 2004 07:31:05 -0000 1.5 +++ dist/src/Lib/opcode.py 5 Apr 2004 01:21:32 -0000 @@ -47,7 +47,6 @@ def_op('ROT_TWO', 2) def_op('ROT_THREE', 3) def_op('DUP_TOP', 4) -def_op('ROT_FOUR', 5) def_op('UNARY_POSITIVE', 10) def_op('UNARY_NEGATIVE', 11) Index: dist/src/Lib/compiler/pycodegen.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/compiler/pycodegen.py,v retrieving revision 1.66 diff -u -r1.66 pycodegen.py --- dist/src/Lib/compiler/pycodegen.py 21 Mar 2004 15:18:50 -0000 1.66 +++ dist/src/Lib/compiler/pycodegen.py 5 Apr 2004 01:21:37 -0000 @@ -898,7 +898,17 @@ if slice == 0: self.emit('ROT_TWO') elif slice == 3: - self.emit('ROT_FOUR') + # NOTE: This tricky bit of swapping is equivalent + # to a single ROT_FOUR. It is used here only + # because there is no ROT_FOUR opcode. + self.emit('ROT_THREE') + self.emit('BUILD_TUPLE', 2) + self.emit('ROT_THREE') + self.emit('ROT_THREE') + self.emit('ROT_TWO') + self.emit('UNPACK_SEQUENCE', 2) + self.emit('ROT_TWO') + # END of a ROT_FOUR else: self.emit('ROT_THREE') self.emit('STORE_SLICE+%d' % slice) Index: dist/src/Misc/NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.964 diff -u -r1.964 NEWS --- dist/src/Misc/NEWS 4 Apr 2004 08:51:41 -0000 1.964 +++ dist/src/Misc/NEWS 5 Apr 2004 01:22:00 -0000 @@ -12,6 +12,9 @@ Core and builtins ----------------- +- Removed ROT_FOUR opcode. It was previously used only for augmented + assignments to a slice. + - Enabled the profiling of C extension functions (and builtins) - check new documentation and modified profiler and bdb modules for more details Index: dist/src/Python/ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.388 diff -u -r2.388 ceval.c --- dist/src/Python/ceval.c 24 Mar 2004 22:22:11 -0000 2.388 +++ dist/src/Python/ceval.c 5 Apr 2004 01:22:08 -0000 @@ -944,17 +944,6 @@ SET_THIRD(v); goto fast_next_opcode; - case ROT_FOUR: - u = TOP(); - v = SECOND(); - w = THIRD(); - x = FOURTH(); - SET_TOP(v); - SET_SECOND(w); - SET_THIRD(x); - SET_FOURTH(u); - goto fast_next_opcode; - case DUP_TOP: v = TOP(); Py_INCREF(v); Index: dist/src/Python/compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.301 diff -u -r2.301 compile.c --- dist/src/Python/compile.c 22 Mar 2004 17:52:53 -0000 2.301 +++ dist/src/Python/compile.c 5 Apr 2004 01:22:16 -0000 @@ -1847,7 +1847,19 @@ com_node(c, augn); com_addbyte(c, opcode); com_pop(c, 1); - com_addbyte(c, ROT_FOUR); + /* We want a ROT_FOUR, but since this is the ONLY place + where one is needed there's no such opcode. So we fake it + by stuffing two items temporarily into a tuple while we + juggle. */ + /* Begin a ROT_FOUR... */ + com_addbyte(c, ROT_THREE); /*ROT_THREE*/ + com_addoparg(c, BUILD_TUPLE, 2); /*Pack 2-tuple*/ + com_addbyte(c, ROT_THREE); /*ROT_THREE*/ + com_addbyte(c, ROT_THREE); /*ROT_THREE*/ + com_addbyte(c, ROT_TWO); /*ROT_TWO*/ + com_addoparg(c, UNPACK_SEQUENCE, 2); /*Unpack 2-tuple*/ + com_addbyte(c, ROT_TWO); /*ROT_TWO*/ + /* ...End a ROT_FOUR */ com_addbyte(c, STORE_SLICE+3); com_pop(c, 4); }