diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2017-09-25 16:35:19 -0700 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2017-09-25 16:35:19 -0700 |
commit | 9d836fedbdb1d28bdfc4ba475bbdfc1adb3f007a (patch) | |
tree | 363d265437890613bbe29e514d7666bd2f61d085 /py/runtime0.h | |
parent | f008263022f794c056d8d102deaa62760822761a (diff) | |
download | micropython-9d836fedbdb1d28bdfc4ba475bbdfc1adb3f007a.tar.gz micropython-9d836fedbdb1d28bdfc4ba475bbdfc1adb3f007a.zip |
py: Clarify which mp_unary_op_t's may appear in the bytecode.
Not all can, so we don't need to reserve bytecodes for them, and can
use free slots for something else later.
Diffstat (limited to 'py/runtime0.h')
-rw-r--r-- | py/runtime0.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/py/runtime0.h b/py/runtime0.h index 6d77cce68e..f54f62d2c6 100644 --- a/py/runtime0.h +++ b/py/runtime0.h @@ -42,16 +42,20 @@ #define MP_NATIVE_TYPE_PTR16 (0x06) #define MP_NATIVE_TYPE_PTR32 (0x07) -// Note: the first 7 of these are used in bytecode and changing -// them requires changing the bytecode version. typedef enum { - MP_UNARY_OP_BOOL, // __bool__ - MP_UNARY_OP_LEN, // __len__ - MP_UNARY_OP_HASH, // __hash__; must return a small int + // These ops may appear in the bytecode. Changing this group + // in any way requires changing the bytecode version. MP_UNARY_OP_POSITIVE, MP_UNARY_OP_NEGATIVE, MP_UNARY_OP_INVERT, MP_UNARY_OP_NOT, + + // Following ops cannot appear in the bytecode + MP_UNARY_OP_NON_BYTECODE, + + MP_UNARY_OP_BOOL = MP_UNARY_OP_NON_BYTECODE, // __bool__ + MP_UNARY_OP_LEN, // __len__ + MP_UNARY_OP_HASH, // __hash__; must return a small int MP_UNARY_OP_ABS, // __abs__ MP_UNARY_OP_SIZEOF, // for sys.getsizeof() } mp_unary_op_t; |