summaryrefslogtreecommitdiff
path: root/py/bc.h
diff options
context:
space:
mode:
Diffstat (limited to 'py/bc.h')
-rw-r--r--py/bc.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/py/bc.h b/py/bc.h
index dafd74376..1d28dcc4f 100644
--- a/py/bc.h
+++ b/py/bc.h
@@ -60,6 +60,13 @@
// const0 : obj
// constN : obj
+// Sentinel value for mp_code_state_t.exc_sp_idx
+#define MP_CODE_STATE_EXC_SP_IDX_SENTINEL ((uint16_t)-1)
+
+// To convert mp_code_state_t.exc_sp_idx to/from a pointer to mp_exc_stack_t
+#define MP_CODE_STATE_EXC_SP_IDX_FROM_PTR(exc_stack, exc_sp) ((exc_sp) + 1 - (exc_stack))
+#define MP_CODE_STATE_EXC_SP_IDX_TO_PTR(exc_stack, exc_sp_idx) ((exc_stack) + (exc_sp_idx) - 1)
+
typedef struct _mp_bytecode_prelude_t {
uint n_state;
uint n_exc_stack;
@@ -92,7 +99,7 @@ typedef struct _mp_code_state_t {
mp_obj_fun_bc_t *fun_bc;
const byte *ip;
mp_obj_t *sp;
- mp_exc_stack_t *exc_sp;
+ uint16_t exc_sp_idx;
mp_obj_dict_t *old_globals;
#if MICROPY_STACKLESS
struct _mp_code_state_t *prev;