mirror of
https://github.com/python/cpython.git
synced 2025-07-19 01:05:26 +00:00
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%.
This commit is contained in:
parent
b32c8e9795
commit
adcd220556
30 changed files with 6614 additions and 5687 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue