diff options
author | Damien George <damien.p.george@gmail.com> | 2019-03-08 15:48:20 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2019-03-08 15:53:04 +1100 |
commit | 02cc288edbc47a3b21b88b83f15990cc5a36ed23 (patch) | |
tree | cd32215cbd5e90d1b0e7cde6f0513b8ad53e9be0 /py/emitnative.c | |
parent | f2ebee9cf12d26bf365d3e328a8a915a44802d04 (diff) |
py: Add independent config for debugging sentinel object values.
The new compile-time option is MICROPY_DEBUG_MP_OBJ_SENTINELS, disabled by
default. This is to allow finer control of whether this debugging feature
is enabled or not (because, for example, this setting must be the same for
mpy-cross and the MicroPython main code when using native code generation).
Diffstat (limited to 'py/emitnative.c')
-rw-r--r-- | py/emitnative.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/py/emitnative.c b/py/emitnative.c index c8a1a33d6..0c756f9a5 100644 --- a/py/emitnative.c +++ b/py/emitnative.c @@ -2094,12 +2094,12 @@ STATIC void emit_native_for_iter(emit_t *emit, mp_uint_t label) { emit_get_stack_pointer_to_reg_for_pop(emit, REG_ARG_1, MP_OBJ_ITER_BUF_NSLOTS); adjust_stack(emit, MP_OBJ_ITER_BUF_NSLOTS); emit_call(emit, MP_F_NATIVE_ITERNEXT); - #ifdef NDEBUG - MP_STATIC_ASSERT(MP_OBJ_STOP_ITERATION == 0); - ASM_JUMP_IF_REG_ZERO(emit->as, REG_RET, label, false); - #else + #if MICROPY_DEBUG_MP_OBJ_SENTINELS ASM_MOV_REG_IMM(emit->as, REG_TEMP1, (mp_uint_t)MP_OBJ_STOP_ITERATION); ASM_JUMP_IF_REG_EQ(emit->as, REG_RET, REG_TEMP1, label); + #else + MP_STATIC_ASSERT(MP_OBJ_STOP_ITERATION == 0); + ASM_JUMP_IF_REG_ZERO(emit->as, REG_RET, label, false); #endif emit_post_push_reg(emit, VTYPE_PYOBJ, REG_RET); } |