diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2023-02-06 22:45:18 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-06 22:45:18 (GMT) |
commit | 38752760c91c87dd67af16d2cee611a22e647567 (patch) | |
tree | 824cac44876b08b47e878044d215357581d74343 /Python/generated_cases.c.h | |
parent | 949c58f945b93af5b7bb70c6448e940da669065d (diff) | |
download | cpython-38752760c91c87dd67af16d2cee611a22e647567.zip cpython-38752760c91c87dd67af16d2cee611a22e647567.tar.gz cpython-38752760c91c87dd67af16d2cee611a22e647567.tar.bz2 |
gh-98831: rewrite COPY and SWAP in the instruction definition DSL (#101620)
Diffstat (limited to 'Python/generated_cases.c.h')
-rw-r--r-- | Python/generated_cases.c.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index e524bfc..f0f314a 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -3723,9 +3723,12 @@ } TARGET(COPY) { - assert(oparg != 0); - PyObject *peek = PEEK(oparg); - PUSH(Py_NewRef(peek)); + PyObject *bottom = PEEK(1 + (oparg-1)); + PyObject *top; + assert(oparg > 0); + top = Py_NewRef(bottom); + STACK_GROW(1); + POKE(1, top); DISPATCH(); } @@ -3760,10 +3763,11 @@ } TARGET(SWAP) { - assert(oparg != 0); - PyObject *top = TOP(); - SET_TOP(PEEK(oparg)); - PEEK(oparg) = top; + PyObject *top = PEEK(1); + PyObject *bottom = PEEK(2 + (oparg-2)); + assert(oparg >= 2); + POKE(1, bottom); + POKE(2 + (oparg-2), top); DISPATCH(); } |