diff Python/compile.c @ 64439:725231211273

Issue #9225: Remove the ROT_FOUR and DUP_TOPX opcode, the latter replaced by the new (and simpler) DUP_TOP_TWO. Performance isn't changed, but our bytecode is a bit simplified. Patch by Demur Rumed.
author Antoine Pitrou <solipsis@pitrou.net>
date Sat, 04 Sep 2010 18:43:52 +0000
parents 9057ea014461
children 25cc226dc9bd
line wrap: on
line diff
--- a/Python/compile.c	Sat Sep 04 18:24:04 2010 +0000
+++ b/Python/compile.c	Sat Sep 04 18:43:52 2010 +0000
@@ -680,8 +680,8 @@
             return 0;
         case DUP_TOP:
             return 1;
-        case ROT_FOUR:
-            return 0;
+        case DUP_TOP_TWO:
+            return 2;
 
         case UNARY_POSITIVE:
         case UNARY_NEGATIVE:
@@ -782,8 +782,6 @@
             return -1;
         case DELETE_GLOBAL:
             return 0;
-        case DUP_TOPX:
-            return oparg;
         case LOAD_CONST:
             return 1;
         case LOAD_NAME:
@@ -3404,7 +3402,7 @@
             return 0;
     }
     if (ctx == AugLoad) {
-        ADDOP_I(c, DUP_TOPX, 2);
+        ADDOP(c, DUP_TOP_TWO);
     }
     else if (ctx == AugStore) {
         ADDOP(c, ROT_THREE);