]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
GH-98831: Typed stack effects, and more instructions converted (#99764)
authorGuido van Rossum <guido@python.org>
Thu, 8 Dec 2022 21:31:27 +0000 (13:31 -0800)
committerGitHub <noreply@github.com>
Thu, 8 Dec 2022 21:31:27 +0000 (13:31 -0800)
commitc85be734d1823f02a3600d7cd9195cecbf51afe8
tree676c83c4c423c817c554228d1badf20110f47d32
parent35cc0ea736a323119157117d93e5d68d8247e89f
GH-98831: Typed stack effects, and more instructions converted (#99764)

Stack effects can now have a type, e.g. `inst(X, (left, right -- jump/uint64_t)) { ... }`.

Instructions converted to the non-legacy format:

* COMPARE_OP
* COMPARE_OP_FLOAT_JUMP
* COMPARE_OP_INT_JUMP
* COMPARE_OP_STR_JUMP
* STORE_ATTR
* DELETE_ATTR
* STORE_GLOBAL
* STORE_ATTR_INSTANCE_VALUE
* STORE_ATTR_WITH_HINT
* STORE_ATTR_SLOT, and complete the store_attr family
* Complete the store_subscr family: STORE_SUBSCR{,DICT,LIST_INT}
  (STORE_SUBSCR was alread half converted,
  but wasn't using cache effects yet.)
* DELETE_SUBSCR
* PRINT_EXPR
* INTERPRETER_EXIT (a bit weird, ends in return)
* RETURN_VALUE
* GET_AITER (had to restructure it some)
  The original had mysterious `SET_TOP(NULL)` before `goto error`.
  I assume those just account for `obj` having been decref'ed,
  so I got rid of them in favor of the cleanup implied by `ERROR_IF()`.
* LIST_APPEND (a bit unhappy with it)
* SET_ADD (also a bit unhappy with it)

Various other improvements/refactorings as well.
Python/bytecodes.c
Python/generated_cases.c.h
Tools/cases_generator/generate_cases.py
Tools/cases_generator/parser.py