8000 py/asmbase: Revert removal of clearing of label offsets for native emit. · lvgl/lv_micropython@53e1118 · GitHub
[go: up one dir, main page]

Skip to content

Commit 53e1118

Browse files
committed
py/asmbase: Revert removal of clearing of label offsets for native emit.
The assembler back-end for most architectures needs to know if a jump is backwards in order to emit optimised machine code, and they do this by checking if the destination label has been set or not. So always reset label offsets to -1 (this reverts partially the previous commit, with some minor optimisation for the if-logic with the pass variable).
1 parent f935bce commit 53e1118

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

py/asmbase.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,10 @@ void mp_asm_base_deinit(mp_asm_base_t *as, bool free_code) {
4646
}
4747

4848
void mp_asm_base_start_pass(mp_asm_base_t *as, int pass) {
49-
if (pass == MP_ASM_PASS_COMPUTE) {
50-
#ifndef NDEBUG
51-
// With debugging enabled labels are checked for unique assignment
49+
if (pass < MP_ASM_PASS_EMIT) {
50+
// Reset labels so we can detect backwards jumps (and verify unique assignment)
5251
memset(as->label_offsets, -1, as->max_num_labels * sizeof(size_t));
53-
#endif
54-
} else if (pass == MP_ASM_PASS_EMIT) {
52+
} else {
5553
// allocating executable RAM is platform specific
5654
MP_PLAT_ALLOC_EXEC(as->code_offset, (void**)&as->code_base, &as->code_size);
5755
assert(as->code_base != NULL);

0 commit comments

Comments
 (0)
0