diff options
| author | Damien George <damien.p.george@gmail.com> | 2019-08-22 12:39:07 +1000 |
|---|---|---|
| committer | Damien George <damien.p.george@gmail.com> | 2019-09-26 15:39:50 +1000 |
| commit | 02db91a7a311a96dd82a497cf513137e04191b29 (patch) | |
| tree | 781991a3b87530077bef6199aea8ff0ede034643 /py/vmentrytable.h | |
| parent | 870e900d02937918187a4e4ef75a1e38880bae62 (diff) | |
py: Split RAISE_VARARGS opcode into 3 separate ones.
From the beginning of this project the RAISE_VARARGS opcode was named and
implemented following CPython, where it has an argument (to the opcode)
counting how many args the raise takes:
raise # 0 args (re-raise previous exception)
raise exc # 1 arg
raise exc from exc2 # 2 args (chained raise)
In the bytecode this operation therefore takes 2 bytes, one for
RAISE_VARARGS and one for the number of args.
This patch splits this opcode into 3, where each is now a single byte.
This reduces bytecode size by 1 byte for each use of raise. Every byte
counts! It also has the benefit of reducing code size (on all ports except
nanbox).
Diffstat (limited to 'py/vmentrytable.h')
| -rw-r--r-- | py/vmentrytable.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/py/vmentrytable.h b/py/vmentrytable.h index 32196c19f..7f55a4806 100644 --- a/py/vmentrytable.h +++ b/py/vmentrytable.h @@ -99,7 +99,9 @@ static const void *const entry_table[256] = { [MP_BC_CALL_METHOD] = &&entry_MP_BC_CALL_METHOD, [MP_BC_CALL_METHOD_VAR_KW] = &&entry_MP_BC_CALL_METHOD_VAR_KW, [MP_BC_RETURN_VALUE] = &&entry_MP_BC_RETURN_VALUE, - [MP_BC_RAISE_VARARGS] = &&entry_MP_BC_RAISE_VARARGS, + [MP_BC_RAISE_LAST] = &&entry_MP_BC_RAISE_LAST, + [MP_BC_RAISE_OBJ] = &&entry_MP_BC_RAISE_OBJ, + [MP_BC_RAISE_FROM] = &&entry_MP_BC_RAISE_FROM, [MP_BC_YIELD_VALUE] = &&entry_MP_BC_YIELD_VALUE, [MP_BC_YIELD_FROM] = &&entry_MP_BC_YIELD_FROM, [MP_BC_IMPORT_NAME] = &&entry_MP_BC_IMPORT_NAME, |
