diff options
author | Mark Shannon <mark@hotpy.org> | 2021-05-07 15:19:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-07 15:19:19 +0100 |
commit | adcd2205565f91c6719f4141ab4e1da6d7086126 (patch) | |
tree | 0953b285944eccde57b05b8f3c7e30fb501a3d64 /Tools/scripts/generate_opcode_h.py | |
parent | b32c8e97951db46484ba3b646b988bcdc4062199 (diff) | |
download | cpython-adcd2205565f91c6719f4141ab4e1da6d7086126.tar.gz cpython-adcd2205565f91c6719f4141ab4e1da6d7086126.zip |
bpo-40222: "Zero cost" exception handling (GH-25729)
"Zero cost" exception handling.
* Uses a lookup table to determine how to handle exceptions.
* Removes SETUP_FINALLY and POP_TOP block instructions, eliminating (most of) the runtime overhead of try statements.
* Reduces the size of the frame object by about 60%.
Diffstat (limited to 'Tools/scripts/generate_opcode_h.py')
-rw-r--r-- | Tools/scripts/generate_opcode_h.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Tools/scripts/generate_opcode_h.py b/Tools/scripts/generate_opcode_h.py index cba13b24213..290f6251af1 100644 --- a/Tools/scripts/generate_opcode_h.py +++ b/Tools/scripts/generate_opcode_h.py @@ -16,14 +16,12 @@ extern "C" { """.lstrip() footer = """ -/* EXCEPT_HANDLER is a special, implicit block type which is created when - entering an except handler. It is not an opcode but we define it here - as we want it to be available to both frameobject.c and ceval.c, while - remaining private.*/ -#define EXCEPT_HANDLER 257 - #define HAS_ARG(op) ((op) >= HAVE_ARGUMENT) +/* Reserve some bytecodes for internal use in the compiler. + * The value of 240 is arbitrary. */ +#define IS_ARTIFICIAL(op) ((op) > 240) + #ifdef __cplusplus } #endif |