mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-98831: rewrite COPY and SWAP in the instruction definition DSL (#101620)
This commit is contained in:
parent
949c58f945
commit
38752760c9
3 changed files with 21 additions and 22 deletions
|
@ -3098,11 +3098,9 @@ dummy_func(
|
|||
PUSH(result);
|
||||
}
|
||||
|
||||
// stack effect: ( -- __0)
|
||||
inst(COPY) {
|
||||
assert(oparg != 0);
|
||||
PyObject *peek = PEEK(oparg);
|
||||
PUSH(Py_NewRef(peek));
|
||||
inst(COPY, (bottom, unused[oparg-1] -- bottom, unused[oparg-1], top)) {
|
||||
assert(oparg > 0);
|
||||
top = Py_NewRef(bottom);
|
||||
}
|
||||
|
||||
inst(BINARY_OP, (unused/1, lhs, rhs -- res)) {
|
||||
|
@ -3126,12 +3124,9 @@ dummy_func(
|
|||
ERROR_IF(res == NULL, error);
|
||||
}
|
||||
|
||||
// stack effect: ( -- )
|
||||
inst(SWAP) {
|
||||
assert(oparg != 0);
|
||||
PyObject *top = TOP();
|
||||
SET_TOP(PEEK(oparg));
|
||||
PEEK(oparg) = top;
|
||||
inst(SWAP, (bottom, unused[oparg-2], top --
|
||||
top, unused[oparg-2], bottom)) {
|
||||
assert(oparg >= 2);
|
||||
}
|
||||
|
||||
inst(EXTENDED_ARG, (--)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue