From: fennecdjay Date: Wed, 10 May 2023 10:42:20 +0000 (+0200) Subject: :art: update VM X-Git-Tag: nightly~161 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=629a308405b2d7d7ffaf48266ff7c0d3b3a68aa5;p=gwion.git :art: update VM --- 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: