From: fennecdjay Date: Fri, 7 Jun 2019 22:12:20 +0000 (+0200) Subject: :art: Improve vm. Yet again X-Git-Tag: nightly~2443^2~16 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=e6dffcae62f50b9977cb35513b2f6e888b1348d9;p=gwion.git :art: Improve vm. Yet again --- diff --git a/include/opcode.h b/include/opcode.h index 7405cd8a..17c3343f 100644 --- a/include/opcode.h +++ b/include/opcode.h @@ -25,7 +25,6 @@ enum { eAllocWord, eAllocWord2, eAllocWord3, - eAllocWord4, eint_plus, eint_minus, eint_mul, @@ -199,7 +198,6 @@ enum { #define AllocWord (f_instr)eAllocWord #define AllocWord2 (f_instr)eAllocWord2 #define AllocWord3 (f_instr)eAllocWord3 -#define AllocWord4 (f_instr)eAllocWord4 #define int_plus (f_instr)eint_plus #define int_minus (f_instr)eint_minus #define int_mul (f_instr)eint_mul diff --git a/opcode.txt b/opcode.txt index 0318bd4b..2ce93136 100644 --- a/opcode.txt +++ b/opcode.txt @@ -22,7 +22,6 @@ Goto AllocWord AllocWord2 AllocWord3 -AllocWord4 int_plus int_minus int_mul diff --git a/src/emit/emit.c b/src/emit/emit.c index db82326f..6683d9e7 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -279,7 +279,7 @@ static const f_instr regpushbase[] = { RegPushBase, RegPushBase2, RegPushBase3, static const f_instr dotstatic[] = { DotStatic, DotStatic2, DotStatic3, RegPushImm }; static const f_instr dotmember[] = { DotMember, DotMember2, DotMember3, DotMember4 }; static const f_instr allocmember[] = { RegPushImm, RegPushImm2, RegPushImm3, AllocMember4 }; -static const f_instr allocword[] = { AllocWord, AllocWord2, AllocWord3, AllocWord4 }; +static const f_instr allocword[] = { AllocWord, AllocWord2, AllocWord3, RegPushMem4 }; ANN static inline Exp this_exp(const Emitter emit, const Type t, const loc_t pos) { const Exp exp = new_exp_prim_id(emit->gwion->mp, insert_symbol("this"), diff --git a/src/vm/vm.c b/src/vm/vm.c index 7a801182..7e9d13cc 100644 --- a/src/vm/vm.c +++ b/src/vm/vm.c @@ -245,7 +245,7 @@ ANN void vm_run(const VM* vm) { // lgtm [cpp/use-of-goto] &®pushme, &®pushmaybe, &&funcreturn, &&_goto, - &&allocint, &&allocfloat, &&allocother, &&allocaddr, + &&allocint, &&allocfloat, &&allocother, &&intplus, &&intminus, && intmul, &&intdiv, &&intmod, // int relationnal &&inteq, &&intne, &&intand, &&intor, @@ -401,10 +401,7 @@ allocother: *(m_uint*)(reg+i) = (*(m_uint*)(mem+instr->m_val+i) = 0); reg += instr->m_val2; DISPATCH() -allocaddr: - *(m_bit**)reg = mem + instr->m_val; - reg += SZ_INT; - DISPATCH() + intplus: INT_OP(+) intminus: INT_OP(-) intmul: INT_OP(*) @@ -539,7 +536,6 @@ ftoi: reg -= SZ_FLOAT - SZ_INT; *(m_int*)(reg-SZ_INT) = (m_int)*(m_float*)(reg-SZ_INT); DISPATCH() - timeadv: reg -= SZ_FLOAT; shredule(s, shred, *(m_float*)(reg-SZ_FLOAT));