]> Nishi Git Mirror - gwion.git/commitdiff
:art: Honor stack offset in usr gack
authorJérémie Astor <astor.jeremie@wanadoo.fr>
Tue, 25 Feb 2020 00:39:13 +0000 (01:39 +0100)
committerJérémie Astor <astor.jeremie@wanadoo.fr>
Tue, 25 Feb 2020 00:39:13 +0000 (01:39 +0100)
src/lib/gack.c
src/vm/vm.c

index 7148ff969a55a3685f26067e0befc9c75a8df328..a72059ae947e1e347348001e9769765e217b336e 100644 (file)
@@ -68,7 +68,9 @@ ANN void gack(const VM_Shred shred, const Instr instr) {
     ((f_gack)code->native_func)(t, (shred->reg - t->size), shred);
     POP_REG(shred, t->size);
   } else {
-    prepare_call(shred, instr->m_val2);
+    const m_uint offset = ((m_uint)shred->mem - SIZEOF_REG) != ((m_uint)shred + sizeof(struct VM_Shred_)) ?
+      instr->m_val2 : 0;
+    prepare_call(shred, offset);
     shred->code = code;
     POP_REG(shred, SZ_INT*2);
   }
index 404fa3cecb80ee57d56c2c2a8e487f86603718f4..66378e44875dd7ff8b2cf4ddda79ce09afd1f82f 100644 (file)
@@ -682,7 +682,7 @@ PRAGMA_POP()
 sporkmemberfptr:
   for(m_uint i = 0; i < VAL; i+= SZ_INT)
     *(m_uint*)(child->reg + i) = *(m_uint*)(reg - VAL + i);
-  *(m_uint*)(child->reg + VAL) = a.obj;
+  *(M_Object*)(child->reg + VAL) = a.obj;
   *(m_uint*)(child->reg + VAL + SZ_INT) = *(m_uint*)(reg + VAL - SZ_INT*2);
   child->reg += VAL + SZ_INT*2;
   DISPATCH()