summaryrefslogtreecommitdiff
path: root/py/asmbase.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-12-08 18:23:23 +1100
committerDamien George <damien.p.george@gmail.com>2017-12-08 18:23:23 +1100
commitf935bce3c52e8eb8f48f7f4947b1210074c359a6 (patch)
tree01cc843bf07a2955d204804727c372929f29d1eb /py/asmbase.c
parent9ef4be8b41c7d256908ba319918c0f7d54346bf4 (diff)
py/{emitbc,asmbase}: Only clear emit labels to -1 when in debug mode.
Clearing the labels to -1 is purely a debugging measure. For release builds there is no need to do it as the label offset table should always have the correct value assigned.
Diffstat (limited to 'py/asmbase.c')
-rw-r--r--py/asmbase.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/py/asmbase.c b/py/asmbase.c
index c941e917b..83a699cd4 100644
--- a/py/asmbase.c
+++ b/py/asmbase.c
@@ -47,8 +47,10 @@ void mp_asm_base_deinit(mp_asm_base_t *as, bool free_code) {
void mp_asm_base_start_pass(mp_asm_base_t *as, int pass) {
if (pass == MP_ASM_PASS_COMPUTE) {
- // reset all labels
+ #ifndef NDEBUG
+ // With debugging enabled labels are checked for unique assignment
memset(as->label_offsets, -1, as->max_num_labels * sizeof(size_t));
+ #endif
} else if (pass == MP_ASM_PASS_EMIT) {
// allocating executable RAM is platform specific
MP_PLAT_ALLOC_EXEC(as->code_offset, (void**)&as->code_base, &as->code_size);