From d567612fd6344204c6c8438b8fe7fe7dbd54d924 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Fri, 19 Sep 2025 16:56:32 +0300 Subject: fix multiple labels at same instruction --- src/compile/compile.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/compile') diff --git a/src/compile/compile.c b/src/compile/compile.c index 2c72b91..f6bf144 100644 --- a/src/compile/compile.c +++ b/src/compile/compile.c @@ -2070,12 +2070,11 @@ static size_t compile_fn_body(struct ejit_func *f, jit_state_t *j, void *arena, size_t label = 0; for (size_t ii = 0; ii < insns_len(&f->insns); ++ii) { /* if we've hit a label, add it to our vector of label addresses */ - if (label < labels_len(&f->labels)) { - if (*labels_at(&f->labels, label) == ii) { - compile_label(j, ii, &addrs); - resolve_relocs(j, &relocs, &addrs, ii); - label++; - } + while (label < labels_len(&f->labels) + && *labels_at(&f->labels, label) == ii) { + compile_label(j, ii, &addrs); + resolve_relocs(j, &relocs, &addrs, ii); + label++; } struct ejit_insn i = *insns_at(&f->insns, ii); -- cgit v1.2.3