summaryrefslogtreecommitdiff
path: root/py/emitbc.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/emitbc.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/emitbc.c')
-rw-r--r--py/emitbc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/py/emitbc.c b/py/emitbc.c
index 3f4dfc178..5e7fa623a 100644
--- a/py/emitbc.c
+++ b/py/emitbc.c
@@ -313,9 +313,12 @@ void mp_emit_bc_start_pass(emit_t *emit, pass_kind_t pass, scope_t *scope) {
emit->scope = scope;
emit->last_source_line_offset = 0;
emit->last_source_line = 1;
+ #ifndef NDEBUG
+ // With debugging enabled labels are checked for unique assignment
if (pass < MP_PASS_EMIT) {
memset(emit->label_offsets, -1, emit->max_num_labels * sizeof(mp_uint_t));
}
+ #endif
emit->bytecode_offset = 0;
emit->code_info_offset = 0;
@@ -495,7 +498,6 @@ void mp_emit_bc_label_assign(emit_t *emit, mp_uint_t l) {
emit->label_offsets[l] = emit->bytecode_offset;
} else {
// ensure label offset has not changed from MP_PASS_CODE_SIZE to MP_PASS_EMIT
- //printf("l%d: (at %d vs %d)\n", l, emit->bytecode_offset, emit->label_offsets[l]);
assert(emit->label_offsets[l] == emit->bytecode_offset);
}
}