diff options
author | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-06-28 01:23:48 +0300 |
---|---|---|
committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2024-06-28 01:23:48 +0300 |
commit | d65c2461d26bf485b88276984bbc33054d5bce20 (patch) | |
tree | 3565b172adbc8fb84b1227a3f62dd9d610f564a4 | |
parent | 8766bb1709e300011752fd1fa73f185f8331bee8 (diff) | |
download | ejit-d65c2461d26bf485b88276984bbc33054d5bce20.tar.gz ejit-d65c2461d26bf485b88276984bbc33054d5bce20.zip |
some posthaste fixes
+ Interesting that the comparison thing only failed when compiled with RELEASE=1
-rw-r--r-- | src/compile/compile.c | 4 | ||||
-rw-r--r-- | src/interp.c | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/compile/compile.c b/src/compile/compile.c index d2fd3dc..ef3efcd 100644 --- a/src/compile/compile.c +++ b/src/compile/compile.c @@ -16,12 +16,12 @@ static void free_arena(void *arena, size_t size) static size_t grploc_count(struct ejit_func *f) { - return f->gpr >= jit_v_num() ? 0 : f->gpr - jit_v_num(); + return f->gpr < jit_v_num() ? 0 : f->gpr - jit_v_num(); } static size_t frploc_count(struct ejit_func *f) { - return f->fpr >= jit_vf_num() ? 0 : f->fpr - jit_vf_num(); + return f->fpr < jit_vf_num() ? 0 : f->fpr - jit_vf_num(); } static size_t stack_size(struct ejit_func *f) diff --git a/src/interp.c b/src/interp.c index 4f034f7..9c3aea3 100644 --- a/src/interp.c +++ b/src/interp.c @@ -34,6 +34,8 @@ union interp_ret ejit_interp(struct ejit_func *f, size_t argc, struct ejit_arg a [RET_F] = &&RET_F, [RET_FI] = &&RET_FI, + [RETVAL] = &&RETVAL, + [ARG] = &&ARG, [ARG_I] = &&ARG_I, [ARG_F] = &&ARG_F, @@ -158,6 +160,10 @@ union interp_ret ejit_interp(struct ejit_func *f, size_t argc, struct ejit_arg a JUMP(i.r0); DISPATCH(); + DO(RETVAL); + gpr[i.r0] = retval; + DISPATCH(); + DO(PARAM); gpr[i.r2] = args[i.r0].l; DISPATCH(); |