From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:45691) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QYPBJ-0002u0-0S for qemu-devel@nongnu.org; Sun, 19 Jun 2011 17:05:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QYPBH-0008CP-K5 for qemu-devel@nongnu.org; Sun, 19 Jun 2011 17:05:20 -0400 Received: from mail-qw0-f45.google.com ([209.85.216.45]:43697) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QYPBH-00085I-Aw for qemu-devel@nongnu.org; Sun, 19 Jun 2011 17:05:19 -0400 Received: by mail-qw0-f45.google.com with SMTP id 8so441368qwj.4 for ; Sun, 19 Jun 2011 14:05:19 -0700 (PDT) MIME-Version: 1.0 From: Blue Swirl Date: Mon, 20 Jun 2011 00:04:59 +0300 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: [Qemu-devel] [PATCH 03/18] TCG: remove broken stack allocation for call arguments List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel The code for stack allocation for call arguments is way too simplistic to actually work on targets with non-trivial stack allocation policies, e.g. ppc64. We've also already allocated TCG_STATIC_CALL_ARGS_SIZE worth of stack for calls which should be well more than any helper needs. Remove broken dynamic stack allocation code and replace it with an assert. Should dynamic stack allocation ever be needed again, target specific functions should be added. Thanks to Richard Henderson for the analysis. Signed-off-by: Blue Swirl --- tcg/tcg.c | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index d8bf721..29cd7a2 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1845,13 +1845,14 @@ static int tcg_reg_alloc_call(TCGContext *s, const TCGOpDef *def, nb_regs = nb_params; /* assign stack slots first */ - /* XXX: preallocate call stack */ call_stack_size = (nb_params - nb_regs) * sizeof(tcg_target_long); call_stack_size = (call_stack_size + TCG_TARGET_STACK_ALIGN - 1) & ~(TCG_TARGET_STACK_ALIGN - 1); allocate_args = (call_stack_size > TCG_STATIC_CALL_ARGS_SIZE); if (allocate_args) { - tcg_out_addi(s, TCG_REG_CALL_STACK, -STACK_DIR(call_stack_size)); + /* XXX: if more than TCG_STATIC_CALL_ARGS_SIZE is needed, + preallocate call stack */ + tcg_abort(); } stack_offset = TCG_TARGET_CALL_STACK_OFFSET; @@ -1970,10 +1971,6 @@ static int tcg_reg_alloc_call(TCGContext *s, const TCGOpDef *def, } tcg_out_op(s, opc, &func_arg, &const_func_arg); - - if (allocate_args) { - tcg_out_addi(s, TCG_REG_CALL_STACK, STACK_DIR(call_stack_size)); - } /* assign output registers and emit moves if needed */ for(i = 0; i < nb_oargs; i++) { -- 1.6.2.4