diff options
author | Damien George <damien.p.george@gmail.com> | 2015-11-02 21:55:42 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-11-13 12:49:18 +0000 |
commit | d8c834c95d506db979ec871417de90b7951edc30 (patch) | |
tree | 929cb08dde61d960d18f47bd80f56114ff10bb4f /py/bc.h | |
parent | c8e9c0d89afa90694790fd48e1bf527487a5beb7 (diff) |
py: Add MICROPY_PERSISTENT_CODE_LOAD/SAVE to load/save bytecode.
MICROPY_PERSISTENT_CODE must be enabled, and then enabling
MICROPY_PERSISTENT_CODE_LOAD/SAVE (either or both) will allow loading
and/or saving of code (at the moment just bytecode) from/to a .mpy file.
Diffstat (limited to 'py/bc.h')
-rw-r--r-- | py/bc.h | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -103,4 +103,15 @@ const byte *mp_bytecode_print_str(const byte *ip); #define MP_TAGPTR_TAG1(x) ((mp_uint_t)(x) & 2) #define MP_TAGPTR_MAKE(ptr, tag) ((void*)((mp_uint_t)(ptr) | (tag))) +#if MICROPY_PERSISTENT_CODE_LOAD || MICROPY_PERSISTENT_CODE_SAVE + +#define MP_OPCODE_BYTE (0) +#define MP_OPCODE_QSTR (1) +#define MP_OPCODE_VAR_UINT (2) +#define MP_OPCODE_OFFSET (3) + +uint mp_opcode_format(const byte *ip, size_t *opcode_size); + +#endif + #endif // __MICROPY_INCLUDED_PY_BC_H__ |