diff options
author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-06-26 22:36:59 +0300 |
---|---|---|
committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-06-26 22:36:59 +0300 |
commit | 892d0f16b2e69bc527b576ee896c39484216338f (patch) | |
tree | 473a4553d0dff32055ff1c22f9a7d44f4e984c02 /src/ejit.c | |
parent | 827dec28e4c0b1c4972f1419e0ac23e4dbd9d916 (diff) | |
download | ejit-892d0f16b2e69bc527b576ee896c39484216338f.tar.gz ejit-892d0f16b2e69bc527b576ee896c39484216338f.zip |
move labels out of the bytecode
+ Speeds up interpreter a little bit since we don't have to execute
what's effectively a no-op
Diffstat (limited to 'src/ejit.c')
-rw-r--r-- | src/ejit.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -37,6 +37,7 @@ struct ejit_func *ejit_create_func(enum ejit_type rtype, size_t argc, const stru f->rtype = rtype; f->insns = vec_create(sizeof(struct ejit_insn)); + f->labels = vec_create(sizeof(size_t)); f->arena = NULL; f->size = 0; @@ -84,13 +85,14 @@ void ejit_destroy_func(struct ejit_func *f) munmap(f->arena, f->size); vec_destroy(&f->insns); + vec_destroy(&f->labels); free(f); } struct ejit_label ejit_label(struct ejit_func *f) { size_t addr = vec_len(&f->insns); - emit_insn_r(f, LABEL, 0, 0, 0); + vec_append(&f->labels, &addr); return (struct ejit_label){.addr = addr}; } |