From: fennecdjay Date: Sun, 10 Mar 2019 23:45:13 +0000 (+0100) Subject: :art: Split PutArgsInMem X-Git-Tag: nightly~2753^2~2 X-Git-Url: http://10.11.0.4:5575/?a=commitdiff_plain;h=bba12e38b95be3be4ad5be2fa00949864e537daf;p=gwion.git :art: Split PutArgsInMem --- 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);