From 796b2b6286cb1aca99cbdbbd36c793daa7c6f21c Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Sat, 12 Jun 2021 19:29:34 +0200 Subject: [PATCH] :art: Imprve Gack a bit --- src/vm/gack.c | 7 ++++--- src/vm/vm.c | 8 +++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/vm/gack.c b/src/vm/gack.c index dd49b76c..9bcae7ff 100644 --- a/src/vm/gack.c +++ b/src/vm/gack.c @@ -47,9 +47,10 @@ ANN2(2) int gw_asprintf(MemPool mp, char **str, const char *fmt, ...) { } ANN static void prepare_call(const VM_Shred shred, const m_uint offset) { - shred->mem += offset + SZ_INT + sizeof(struct frame_t); - register struct frame_t *frame = (struct frame_t*)(shred->mem - sizeof(struct frame_t)); - frame->push = offset + SZ_INT + sizeof(struct frame_t); + const m_uint push = offset + SZ_INT + sizeof(struct frame_t); + shred->mem += push; + struct frame_t *frame = (struct frame_t*)(shred->mem - sizeof(struct frame_t)); + frame->push = push; frame->code = shred->code; frame->pc = shred->pc; shred->pc = 0; diff --git a/src/vm/vm.c b/src/vm/vm.c index ce3710bb..37fb33e7 100644 --- a/src/vm/vm.c +++ b/src/vm/vm.c @@ -352,9 +352,11 @@ _Pragma(STRINGIFY(COMPILER diagnostic ignored UNINITIALIZED) #define VMSZ (SZ_INT > SZ_FLOAT ? SZ_INT : SZ_FLOAT) -#define VAL (*(m_uint*)(byte + VMSZ)) -#define FVAL (*(m_float*)(byte + VMSZ)) -#define VAL2 (*(m_uint*)(byte + SZ_INT + SZ_INT)) +#define VAL (*(m_uint*)(byte + VMSZ)) +#define FVAL (*(m_float*)(byte + VMSZ)) +#define VAL2 (*(m_uint*)(byte + SZ_INT + SZ_INT)) +#define UVAL (*(uint16_t*)(byte + SZ_INT + SZ_INT)) +#define UVAL2 (*(uint16_t*)(byte + SZ_INT + SZ_INT + sizeof(uint16_t))) #define BRANCH_DISPATCH(check) \ if(check) SET_BYTE(VAL);\ -- 2.43.0