aboutsummaryrefslogtreecommitdiff
path: root/src/compile/compile.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/compile/compile.c')
-rw-r--r--src/compile/compile.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/compile/compile.c b/src/compile/compile.c
index 5aab67e..7965f93 100644
--- a/src/compile/compile.c
+++ b/src/compile/compile.c
@@ -47,7 +47,7 @@ static void *alloc_arena(size_t size, bool im_scawed)
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
}
-static void assert_helper(const char *msg)
+static inline void assert_helper(const char *msg)
{
assert(false && msg);
}
@@ -1974,6 +1974,10 @@ static void resolve_top_reloc(jit_state_t *j, struct relocs *relocs, struct addr
assert(a);
jit_patch_there(j, r, a);
relocs_pop(relocs);
+
+ /* hope this turns into a tailcall */
+ if (relocs_len(relocs))
+ resolve_top_reloc(j, relocs, addrs, ii);
}
static void resolve_relocs(jit_state_t *j, struct relocs *relocs, struct addrs *addrs, size_t ii)
@@ -2066,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);