From: Jérémie Astor Date: Sat, 12 Jun 2021 17:29:34 +0000 (+0200) Subject: :art: Imprve Gack a bit X-Git-Tag: nightly~600 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=796b2b6286cb1aca99cbdbbd36c793daa7c6f21c;p=gwion.git :art: Imprve Gack a bit --- 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);\