From bb656627631b860d2ba79c3cc3ab772fe7ed4336 Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Thu, 10 Oct 2019 14:24:02 +0200 Subject: [PATCH] :art: TestPushStaticCode --- src/vm/vm.c | 6 +++--- tests/tree/push_staticcode.gw | 11 +++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 tests/tree/push_staticcode.gw diff --git a/src/vm/vm.c b/src/vm/vm.c index 1322f615..55e9c921 100644 --- a/src/vm/vm.c +++ b/src/vm/vm.c @@ -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 index 00000000..c9f61720 --- /dev/null +++ b/tests/tree/push_staticcode.gw @@ -0,0 +1,11 @@ +fun void test() { + test(2); +} +fun void test(int i) { + <<< i >>>; +} +test(); +test(); + + + -- 2.43.0