From: Jérémie Astor Date: Thu, 2 Sep 2021 19:12:27 +0000 (+0200) Subject: :bomb: Re-add release in the VM X-Git-Tag: nightly~470^2~23 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=9791ab0fe7b0c25f870d008d496efd2198f38042;p=gwion.git :bomb: Re-add release in the VM --- diff --git a/src/vm/vm.c b/src/vm/vm.c index 4019d2b5..6e1a0dae 100644 --- a/src/vm/vm.c +++ b/src/vm/vm.c @@ -480,7 +480,7 @@ vm_run(const VM *vm) { // lgtm [cpp/use-of-goto] &&sporkini, &&forkini, &&sporkfunc, &&sporkmemberfptr, &&sporkexp, &&sporkend, &&brancheqint, &&branchneint, &&brancheqfloat, &&branchnefloat, &&unroll, &&arrayappend, &&autounrollinit, &&autoloop, - &&arraytop, &&arrayaccess, &&arrayget, &&arrayaddr, &&newobj, &&addref, + &&arraytop, &&arrayaccess, &&arrayget, &&arrayaddr, &&arraygetobj, &&newobj, &&addref, &&addrefaddr, &&structaddref, &&structaddrefaddr, &&objassign, &&assign, &&remref, &&except, &&allocmemberaddr, &&dotmember, &&dotfloat, &&dotother, &&dotaddr, &&unioncheck, &&unionint, &&unionfloat, @@ -1065,6 +1065,15 @@ vm_run(const VM *vm) { // lgtm [cpp/use-of-goto] m_vector_addr(ARRAY(a.obj), *(m_int *)(reg + VAL)); PRAGMA_POP() DISPATCH() + arraygetobj: + PRAGMA_PUSH() + m_vector_get(ARRAY(a.obj), *(m_int *)(reg + VAL), (reg + IVAL2)); + if(!*(M_Object*)(reg + IVAL2)) { + handle(shred, "EmptyArrayAccess"); + continue; + } + PRAGMA_POP() + DISPATCH() newobj: *(M_Object *)reg = new_object(vm->gwion->mp, NULL, (Type)VAL2); reg += SZ_INT; @@ -1088,7 +1097,7 @@ vm_run(const VM *vm) { // lgtm [cpp/use-of-goto] DISPATCH() objassign : { const M_Object o = **(M_Object **)(reg - SZ_INT); -// release(o, shred); + release(o, shred); } assign: reg -= SZ_INT;