]> Nishi Git Mirror - gwion.git/commitdiff
:art: TestPushStaticCode
authorfennecdjay <astor.jeremie@wanadoo.fr>
Thu, 10 Oct 2019 12:24:02 +0000 (14:24 +0200)
committerfennecdjay <astor.jeremie@wanadoo.fr>
Thu, 10 Oct 2019 12:24:02 +0000 (14:24 +0200)
src/vm/vm.c
tests/tree/push_staticcode.gw [new file with mode: 0644]

index 1322f6159d289f74fa3f280e6c98c4e1dbfaaabc..55e9c921f87d5ab195028ae39cd7f67bab32efd6 100644 (file)
@@ -798,9 +798,9 @@ PRAGMA_PUSH()
 PRAGMA_POP()
   DISPATCH()
 pushstaticcode:
-  *(m_bit*)byte = eRegPushImm;
-  VAL = (*(m_uint*)(reg) = (m_uint)((Func)VAL)->code);
-  reg += SZ_INT;
+  *(m_bit*)byte = eRegSetImm;
+  VAL = (*(m_uint*)(reg-SZ_INT) = (m_uint)((Func)VAL)->code);
+  VAL2 = -SZ_INT;
   DISPATCH()
 gcini:
   vector_add(&shred->gc, 0);
diff --git a/tests/tree/push_staticcode.gw b/tests/tree/push_staticcode.gw
new file mode 100644 (file)
index 0000000..c9f6172
--- /dev/null
@@ -0,0 +1,11 @@
+fun void test() {
+  test(2);
+}
+fun void test(int i) {
+  <<< i >>>;
+}
+test();
+test();
+
+
+