]> Nishi Git Mirror - gwion.git/commitdiff
:art: Split PutArgsInMem
authorfennecdjay <astor.jeremie@wanadoo.fr>
Sun, 10 Mar 2019 23:45:13 +0000 (00:45 +0100)
committerfennecdjay <astor.jeremie@wanadoo.fr>
Sun, 10 Mar 2019 23:45:13 +0000 (00:45 +0100)
include/instr.h
src/emit/emit.c
src/lib/instr.c

index ec5baff37ff0295a1df7b9f623cf43dd74051adf..6a39d7acc72b939d188a40dca64a628dc23b7c85 100644 (file)
@@ -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
index 420e2b90a65d7a87eb08bbaface2959145e4df75..0a66b706303c76d1e5a5f7e9916a3a907ef1a5ff 100644 (file)
@@ -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;
 }
index 81cf6e992b1d3eb52a5468366c93a25791200e62..a1f0a8c0bec6e5eab7455873c4ac48f5f6fbf1d1 100644 (file)
@@ -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);