mirror of
https://github.com/python/cpython.git
synced 2025-08-29 21:25:01 +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
|
@ -86,11 +86,15 @@ def_op('MATCH_MAPPING', 31)
|
|||
def_op('MATCH_SEQUENCE', 32)
|
||||
def_op('MATCH_KEYS', 33)
|
||||
def_op('COPY_DICT_WITHOUT_KEYS', 34)
|
||||
def_op('PUSH_EXC_INFO', 35)
|
||||
|
||||
def_op('POP_EXCEPT_AND_RERAISE', 37)
|
||||
|
||||
def_op('WITH_EXCEPT_START', 49)
|
||||
def_op('GET_AITER', 50)
|
||||
def_op('GET_ANEXT', 51)
|
||||
def_op('BEFORE_ASYNC_WITH', 52)
|
||||
def_op('BEFORE_WITH', 53)
|
||||
|
||||
def_op('END_ASYNC_FOR', 54)
|
||||
def_op('INPLACE_ADD', 55)
|
||||
|
@ -124,7 +128,6 @@ def_op('RETURN_VALUE', 83)
|
|||
def_op('IMPORT_STAR', 84)
|
||||
def_op('SETUP_ANNOTATIONS', 85)
|
||||
def_op('YIELD_VALUE', 86)
|
||||
def_op('POP_BLOCK', 87)
|
||||
|
||||
def_op('POP_EXCEPT', 89)
|
||||
|
||||
|
@ -164,7 +167,6 @@ def_op('CONTAINS_OP', 118)
|
|||
def_op('RERAISE', 119)
|
||||
|
||||
jabs_op('JUMP_IF_NOT_EXC_MATCH', 121)
|
||||
jrel_op('SETUP_FINALLY', 122) # Distance to target address
|
||||
|
||||
def_op('LOAD_FAST', 124) # Local variable number
|
||||
haslocal.append(124)
|
||||
|
@ -190,7 +192,7 @@ hasfree.append(138)
|
|||
|
||||
def_op('CALL_FUNCTION_KW', 141) # #args + #kwargs
|
||||
def_op('CALL_FUNCTION_EX', 142) # Flags
|
||||
jrel_op('SETUP_WITH', 143)
|
||||
|
||||
def_op('EXTENDED_ARG', 144)
|
||||
EXTENDED_ARG = 144
|
||||
def_op('LIST_APPEND', 145)
|
||||
|
@ -201,7 +203,6 @@ hasfree.append(148)
|
|||
|
||||
def_op('MATCH_CLASS', 152)
|
||||
|
||||
jrel_op('SETUP_ASYNC_WITH', 154)
|
||||
def_op('FORMAT_VALUE', 155)
|
||||
def_op('BUILD_CONST_KEY_MAP', 156)
|
||||
def_op('BUILD_STRING', 157)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue