py: Add MICROPY_PERSISTENT_CODE so code can persist beyond the runtime.
Main changes when MICROPY_PERSISTENT_CODE is enabled are:
- qstrs are encoded as 2-byte fixed width in the bytecode
- all pointers are removed from bytecode and put in const_table (this
includes const objects and raw code pointers)
Ultimately this option will enable persistence for not just bytecode but
also native code.
diff --git a/py/mpconfig.h b/py/mpconfig.h
index 4f02393..8019771 100644
--- a/py/mpconfig.h
+++ b/py/mpconfig.h
@@ -192,6 +192,11 @@
/*****************************************************************************/
/* Micro Python emitters */
+// Whether generated code can persist independently of the VM/runtime instance
+#ifndef MICROPY_PERSISTENT_CODE
+#define MICROPY_PERSISTENT_CODE (0)
+#endif
+
// Whether to emit x64 native code
#ifndef MICROPY_EMIT_X64
#define MICROPY_EMIT_X64 (0)