summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-09-04 18:43:52 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-09-04 18:43:52 (GMT)
commit74a69fa662fb844ad3c60eb27b09e5fa1e577305 (patch)
tree251ba06cc429ab62a204e28bece4f382e179c7bf /Python/compile.c
parentef0e6c3b0485e83444b15c07f9cb1d905203791a (diff)
downloadcpython-74a69fa662fb844ad3c60eb27b09e5fa1e577305.zip
cpython-74a69fa662fb844ad3c60eb27b09e5fa1e577305.tar.gz
cpython-74a69fa662fb844ad3c60eb27b09e5fa1e577305.tar.bz2
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.
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/Python/compile.c b/Python/compile.c
index aae0339..6963a15 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -680,8 +680,8 @@ opcode_stack_effect(int opcode, int oparg)
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 @@ opcode_stack_effect(int opcode, int oparg)
return -1;
case DELETE_GLOBAL:
return 0;
- case DUP_TOPX:
- return oparg;
case LOAD_CONST:
return 1;
case LOAD_NAME:
@@ -3404,7 +3402,7 @@ compiler_handle_subscr(struct compiler *c, const char *kind,
return 0;
}
if (ctx == AugLoad) {
- ADDOP_I(c, DUP_TOPX, 2);
+ ADDOP(c, DUP_TOP_TWO);
}
else if (ctx == AugStore) {
ADDOP(c, ROT_THREE);