summaryrefslogtreecommitdiffstats
path: root/Python/ceval.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/ceval.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/ceval.c')
-rw-r--r--Python/ceval.c47
1 files changed, 9 insertions, 38 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 4d583a5..1f78f95 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -1420,50 +1420,21 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
SET_THIRD(v);
FAST_DISPATCH();
- TARGET(ROT_FOUR)
- u = TOP();
- v = SECOND();
- w = THIRD();
- x = FOURTH();
- SET_TOP(v);
- SET_SECOND(w);
- SET_THIRD(x);
- SET_FOURTH(u);
- FAST_DISPATCH();
-
TARGET(DUP_TOP)
v = TOP();
Py_INCREF(v);
PUSH(v);
FAST_DISPATCH();
- TARGET(DUP_TOPX)
- if (oparg == 2) {
- x = TOP();
- Py_INCREF(x);
- w = SECOND();
- Py_INCREF(w);
- STACKADJ(2);
- SET_TOP(x);
- SET_SECOND(w);
- FAST_DISPATCH();
- } else if (oparg == 3) {
- x = TOP();
- Py_INCREF(x);
- w = SECOND();
- Py_INCREF(w);
- v = THIRD();
- Py_INCREF(v);
- STACKADJ(3);
- SET_TOP(x);
- SET_SECOND(w);
- SET_THIRD(v);
- FAST_DISPATCH();
- }
- Py_FatalError("invalid argument to DUP_TOPX"
- " (bytecode corruption?)");
- /* Never returns, so don't bother to set why. */
- break;
+ TARGET(DUP_TOP_TWO)
+ x = TOP();
+ Py_INCREF(x);
+ w = SECOND();
+ Py_INCREF(w);
+ STACKADJ(2);
+ SET_TOP(x);
+ SET_SECOND(w);
+ FAST_DISPATCH();
TARGET(UNARY_POSITIVE)
v = TOP();