From 629a308405b2d7d7ffaf48266ff7c0d3b3a68aa5 Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Wed, 10 May 2023 12:42:20 +0200 Subject: [PATCH] :art: update VM --- src/vm/vm.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/vm/vm.c b/src/vm/vm.c index 61e93d3f..07f8fc5f 100644 --- a/src/vm/vm.c +++ b/src/vm/vm.c @@ -499,7 +499,6 @@ vm_prepare(const VM *vm, m_bit *prepare_code) { // lgtm [cpp/use-of-goto] #define SDISPATCH() goto **(void***)byte; union { - M_Object obj; VM_Code code; } a; VM_Shred child; @@ -1052,19 +1051,20 @@ DISPATCH(); goto _goto; arrayaccess : { register const m_int idx = *(m_int *)(reg + VAL); - a.obj = *(M_Object *)(reg - SVAL); - if (idx < 0 || (m_uint)idx >= m_vector_size(ARRAY(a.obj))) { - gw_err(_("{-} ... at index {W}[{Y}%" INT_F "{W}]{2}\n"), idx); + const M_Object obj = *(M_Object *)(reg - SVAL); + const M_Vector array = ARRAY(obj); + if (idx < 0 || (m_uint)idx >= m_vector_size(array)) { + gw_err(_("{-} .. . at index {W}[{Y}%" INT_F "{W}]{2}\n"), idx); // gw_err(_(" ... at dimension [%" INT_F "]\n"), VAL); // VM_OUT handle(shred, "ArrayOutofBounds"); continue; // or break ? } if (likely(!SVAL2)) - m_vector_get(ARRAY(a.obj), *(m_int *)(reg + VAL), (reg - SVAL)); + m_vector_get(array, *(m_int *)(reg + VAL), (reg - SVAL)); else *(m_bit **)(reg - SVAL) = - m_vector_addr(ARRAY(a.obj), *(m_int *)(reg + VAL)); + m_vector_addr(array, *(m_int *)(reg + VAL)); DISPATCH() } newobj: -- 2.43.0