From bba12e38b95be3be4ad5be2fa00949864e537daf Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Mon, 11 Mar 2019 00:45:13 +0100 Subject: [PATCH] :art: Split PutArgsInMem --- include/instr.h | 4 ---- src/emit/emit.c | 8 ++++++-- src/lib/instr.c | 8 -------- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/include/instr.h b/include/instr.h index ec5baff3..6a39d7ac 100644 --- a/include/instr.h +++ b/include/instr.h @@ -77,9 +77,5 @@ struct dottmpl_ { }; ANN void free_dottmpl(struct dottmpl_*); ANN m_bool traverse_dot_tmpl(const Emitter emit, const struct dottmpl_ *dt); -// optimizations -#ifdef OPTIMIZE -INSTR(PutArgsInMem); -#endif #include "opcode.h" #endif diff --git a/src/emit/emit.c b/src/emit/emit.c index 420e2b90..0a66b706 100644 --- a/src/emit/emit.c +++ b/src/emit/emit.c @@ -1022,11 +1022,15 @@ ANN static m_bool optimize_taill_call(const Emitter emit, const Exp_Call* e) { Exp arg = e->args; if(arg) CHECK_BB(emit_exp(emit, e->args, 0)) - const Instr instr = emit_add_instr(emit, PutArgsInMem); + const Instr pop = emit_add_instr(emit, RegPop); while(arg) { - instr->m_val += arg->type->size; + pop->m_val += arg->type->size; arg = arg->next; } + for(m_uint i = 0; i < pop->m_val; i += SZ_INT) { + const Instr cpy = emit_add_instr(emit, Reg2Mem); + cpy->m_val = cpy->m_val2 = i; + } emit_add_instr(emit, Goto); return GW_OK; } diff --git a/src/lib/instr.c b/src/lib/instr.c index 81cf6e99..a1f0a8c0 100644 --- a/src/lib/instr.c +++ b/src/lib/instr.c @@ -68,14 +68,6 @@ INSTR(AutoLoopEnd) { GWDEBUG_EXE } } -#ifdef OPTIMIZE -INSTR(PutArgsInMem) { GWDEBUG_EXE - POP_REG(shred, instr->m_val) - for(m_uint i = 0; i < instr->m_val; i += SZ_INT) - *(m_uint*)(shred->mem + i) = *(m_uint*)(shred->reg + i); -} -#endif - INSTR(PopArrayClass) { GWDEBUG_EXE POP_REG(shred, SZ_INT); const M_Object obj = *(M_Object*)REG(-SZ_INT); -- 2.43.0