]> Nishi Git Mirror - gwion.git/commitdiff
:bomb: Re-add release in the VM
authorJérémie Astor <fennecdjay@gmail.com>
Thu, 2 Sep 2021 19:12:27 +0000 (21:12 +0200)
committerJérémie Astor <fennecdjay@gmail.com>
Thu, 2 Sep 2021 19:12:27 +0000 (21:12 +0200)
src/vm/vm.c

index 4019d2b5fe06d9d0417b2e78081d6a8ee6a1be44..6e1a0daec26dad7d1aa0b49294afdaf677e7fd5f 100644 (file)
@@ -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;