From patchwork Thu Oct 20 11:52:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 616773 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp306424pvb; Thu, 20 Oct 2022 07:37:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5iV98IU1VaKlVs1FbITNkn1HwYi3L55zqXzrWyN4mj+bm/RanpnYpqcdc6FSNSmTbyhj1i X-Received: by 2002:a05:620a:244e:b0:6ee:d8f2:6d56 with SMTP id h14-20020a05620a244e00b006eed8f26d56mr9447561qkn.380.1666276675323; Thu, 20 Oct 2022 07:37:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666276675; cv=none; d=google.com; s=arc-20160816; b=NaMKx8zk+qqx/Vxw9p6xq8vnMGQ/6j0t/2AutAnoF5KJ7s7Dn1Lgc4z+XRF/1SJEmL 1Ghwc966z0rqCxGeNDa83HXrZ35rOuIvZ0+/KuAbWLOEkuQ21c+lfBfSGGEA/Eh1ekkq Q/Eu1h+pr+Vq20EF7UrZ2z+BH9GpYumpQJU/VZZT3TCjqv+FYilEYgEVLerMPPlgPyJn lQzypPRAPCVDquZiQip4O2a7yQl77WNEBA6aDcormEjZ+XY+mhWpmse625F578d8Lj0S +0pNyYrxEyn9G/8LWpBGl+TKMzYKuhb1rXTxN6sPVCenEOcUadzO5DgtffthGrCZTOJY 2cUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=/GWofEQojLLXXLRwojNJiYI+Du4LjIcNNqXdtRzxkFU=; b=wX3lEisuo6krFphRu6I9Byyxmk8a4EiTKPpssgmsglP1T24FEAnIu018oaRVfl+kJw OOeR6IM5DDhngkT5DV+4ARt7lkZWktS4395vlPfaaFscUkb5hEkWKEgaYgYnvbn/BMb1 Lk6fV5zN6TFWG2N/dPuqT5tLRm+0OXjk8jRP6Odyi9RdsZkKk//rqrTNh8EiUsLJ0CO9 1lHCBKvN9JAjoKnEjr4iw4zTKFJoL0PekupNzU9DRX9HttOmIYFBbsD33ExkQMOO5+tC uL5luniGJi8QADyjc0Ncsz1Gg2X6Qo07GqIZ5TgE1TukBtCSMWN8CBCjW1tLOd9a7nVO w17w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="XopguzG/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s21-20020a05620a29d500b006ec5c7264a5si11699963qkp.689.2022.10.20.07.37.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Oct 2022 07:37:55 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="XopguzG/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:55360 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olWgD-0002pQ-Hr for patch@linaro.org; Thu, 20 Oct 2022 10:37:53 -0400 Received: from [::1] (helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olWfT-0006go-6Q for patch@linaro.org; Thu, 20 Oct 2022 10:37:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42014) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1olU81-0005TW-Mz for qemu-devel@nongnu.org; Thu, 20 Oct 2022 07:54:33 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]:42628) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1olU7z-00016L-MM for qemu-devel@nongnu.org; Thu, 20 Oct 2022 07:54:25 -0400 Received: by mail-pf1-x431.google.com with SMTP id i3so20024689pfk.9 for ; Thu, 20 Oct 2022 04:54:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=/GWofEQojLLXXLRwojNJiYI+Du4LjIcNNqXdtRzxkFU=; b=XopguzG/bXd7huBvfqVcTd+Qnz9q6N1c2asOd3fVT7kNjvdtgAtg68Aq/HveliH3+b j20Ts/I2LcoFLNm+m/tCmPqrOeDoWdwPo3yu7ZvXDvZwPHvo3lgIM/boEt+h5Dl6Wadd 7D2B2ZafxvOOm6ScqhLumX8WOpj78sXLb3Qi4QEnZlip5Uw6DHZVI/oOTO3YIIzn+uSb +cTTJ2xtBVkSPcF7j8PDsJ7JrqtgqlC1/KUICSC+t3GSxZNY+0pz9VNzzJrxXXM5uD9G yN0Bo5kqBhty3Ids5kKZoFDK343TL7Tf12L99r3e/+mL3+2/s/thy1CED8hBXvV+fPCi b2Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/GWofEQojLLXXLRwojNJiYI+Du4LjIcNNqXdtRzxkFU=; b=u2NHNyWLNjfR5CV4kCxv5wRYr0c96g7aDL+wxX5+Mzj1w0i2i0eCJStcgc0pZUw/ZW +pIKKBhdTgqwxtmIoqoJoapegmG5Ns2I82tChKedbn+pWb9eXP/BHJ7qcEi187uFD6ln 4y6KZmT6potoF187eyC7pfn0i3mt4AV/IP9fSY/jsazek6wT4ACScErNudR4ZnXoNoR1 J2rJyqeEM2UM68wDfIEMD1RrAPVj2Sed0AbE4Xul0nHE5QMuHEbwg6JN4n0PWrEQafCM r/MA4AFpPLzTCvzNystGHgsad3Sul31d9jfbApav6eOZPeCwGP8LJ571YQ2b/FS3PTQe nFnQ== X-Gm-Message-State: ACrzQf1/tpq5H9k8CED82qFJMFw71UlOiM93PwdrWySK27sAirpadVV4 bJLfQnudRGkRnvEzCJZZGSgPriByaWaRlh1+ X-Received: by 2002:a05:6a00:843:b0:563:fd4:d73 with SMTP id q3-20020a056a00084300b005630fd40d73mr13619242pfk.47.1666266862175; Thu, 20 Oct 2022 04:54:22 -0700 (PDT) Received: from localhost.localdomain ([149.135.10.35]) by smtp.gmail.com with ESMTPSA id w206-20020a627bd7000000b0056109e15638sm13065464pfc.54.2022.10.20.04.54.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Oct 2022 04:54:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH 23/31] tcg: Allocate objects contiguously in temp_allocate_frame Date: Thu, 20 Oct 2022 21:52:34 +1000 Message-Id: <20221020115242.2301066-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221020115242.2301066-1-richard.henderson@linaro.org> References: <20221020115242.2301066-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" When allocating a temp to the stack frame, consider the base type and allocate all parts at once. Signed-off-by: Richard Henderson --- tcg/tcg.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index 5b17892058..3a0cbe8ac6 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3318,11 +3318,12 @@ static void check_regs(TCGContext *s) static void temp_allocate_frame(TCGContext *s, TCGTemp *ts) { - int size = tcg_type_size(ts->type); - int align; intptr_t off; + int size, align; - switch (ts->type) { + /* When allocating an object, look at the full type. */ + size = tcg_type_size(ts->base_type); + switch (ts->base_type) { case TCG_TYPE_I32: align = 4; break; @@ -3353,13 +3354,26 @@ static void temp_allocate_frame(TCGContext *s, TCGTemp *ts) tcg_raise_tb_overflow(s); } s->current_frame_offset = off + size; - - ts->mem_offset = off; #if defined(__sparc__) - ts->mem_offset += TCG_TARGET_STACK_BIAS; + off += TCG_TARGET_STACK_BIAS; #endif - ts->mem_base = s->frame_temp; - ts->mem_allocated = 1; + + /* If the object was subdivided, assign memory to all the parts. */ + if (ts->base_type != ts->type) { + int part_size = tcg_type_size(ts->type); + int part_count = size / part_size; + + ts -= ts->temp_subindex; + for (int i = 0; i < part_count; ++i) { + ts[i].mem_offset = off + i * part_size; + ts[i].mem_base = s->frame_temp; + ts[i].mem_allocated = 1; + } + } else { + ts->mem_offset = off; + ts->mem_base = s->frame_temp; + ts->mem_allocated = 1; + } } static void temp_load(TCGContext *, TCGTemp *, TCGRegSet, TCGRegSet, TCGRegSet);