2009-10-30 Aleksey Demakov <ademakov@gmail.com>
+ * jit/jit-reg-alloc.h, jit/jit-reg-alloc.c
+ (_jit_regs_clear_all_outgoing): add function.
+ * jit/jit-compile.c (compile_block): use _jit_regs_clear_all_outgoing
+ after each function call.
+
* include/jit/jit-except.h (JIT_RESULT_CACHE_FULL): add result code.
* jit/jit-cache.h, jit/jit-cache.c (_jit_cache_check_space): add
function to check the available cache space.
}
break;
+#ifndef JIT_BACKEND_INTERP
case JIT_OP_CALL:
case JIT_OP_CALL_TAIL:
case JIT_OP_CALL_INDIRECT:
case JIT_OP_CALL_EXTERNAL_TAIL:
/* Spill all caller-saved registers before a call */
_jit_regs_spill_all(gen);
+ /* Generate code for the instruction with the back end */
_jit_gen_insn(gen, func, block, insn);
+ /* Free outgoing registers if any */
+ _jit_regs_clear_all_outgoing(gen);
break;
+#endif
#ifndef JIT_BACKEND_INTERP
case JIT_OP_INCOMING_REG:
_jit_regs_set_incoming(gen,
(int)jit_value_get_nint_constant(insn->value2),
insn->value1);
+ /* Generate code for the instruction with the back end */
_jit_gen_insn(gen, func, block, insn);
break;
#endif
_jit_regs_set_incoming(gen,
(int)jit_value_get_nint_constant(insn->value2),
insn->value1);
+ /* Generate code for the instruction with the back end */
_jit_gen_insn(gen, func, block, insn);
break;
#endif
* Initialize the register allocation state for a new block.
* @end deftypefun
@*/
-void _jit_regs_init_for_block(jit_gencode_t gen)
+void
+_jit_regs_init_for_block(jit_gencode_t gen)
{
int reg;
gen->current_age = 1;
}
}
+/*@
+ * @deftypefun void _jit_regs_clear_all_outgoing (jit_gencode_t gen)
+ * Free registers used fot outgoing parameters. This is used to
+ * clean up after a function call.
+ * @end deftypefun
+@*/
+void
+_jit_regs_clear_all_outgoing(jit_gencode_t gen)
+{
+ gen->inhibit = jit_regused_init;
+}
+
/* TODO: remove this function */
/*@
* @deftypefun void _jit_regs_force_out (jit_gencode_t gen, jit_value_t value, int is_dest)
void _jit_regs_spill_all(jit_gencode_t gen);
void _jit_regs_set_incoming(jit_gencode_t gen, int reg, jit_value_t value);
void _jit_regs_set_outgoing(jit_gencode_t gen, int reg, jit_value_t value);
+void _jit_regs_clear_all_outgoing(jit_gencode_t gen);
void _jit_regs_force_out(jit_gencode_t gen, jit_value_t value, int is_dest);
int _jit_regs_load_value(jit_gencode_t gen, jit_value_t value, int destroy, int used_again);