From patchwork Fri Oct 21 07:15:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 617135 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp814864pvb; Fri, 21 Oct 2022 01:19:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5kJJrzSvGGmD77Tri6SQE7EJhR44GXe+/oeTqdbM5zURS14/2s9ezaFttl0TNgub9PxG51 X-Received: by 2002:a05:620a:450c:b0:6ee:af91:60b2 with SMTP id t12-20020a05620a450c00b006eeaf9160b2mr13527048qkp.480.1666340363797; Fri, 21 Oct 2022 01:19:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666340363; cv=none; d=google.com; s=arc-20160816; b=yZ+N9ebw2wzjPmpCFJKpV+HQZPihsikDFQJwCff4ALFBm+YVuIvouRQ5WfANY2MVxb zj5N30M+MJZCx82XSO8Z6yAJROquqtlh1P9wrAB/uLSJ/1hPocqhsBt7wA1poetXZZ5U Zk/tf2/DVv3DYd/onOH7JqcFsqJ3y7jpLJa4t/bbgYNYWjYAHfjpjKqV3GYfZLFBjFAW Nr7bm6/NUbZM+0dH96587A5ejAls34iCt2pEaw7aHJJ/5ksqjaX7AIHpSzvWoxJ69SxB 2BENwVDWDevRV8Pu12Mk+tyELUHryEk03aFxLmYb4bF3zPLqrflzaInQyA71LoLAwolw OEeA== 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=OjjeRZqVgFS5dG8LiFwvWFyG3e2GWcohg60z62TsQR8=; b=bojisPdFQRdaJYRHS/6MuFr5g1GG4uh6kskMUWMm2Gjpe0DVZISVKlMomDl8PXn1Oi JE50CjQjJ3CBadlBC1Dc4VhSxZFmCU5el5HLIvaVuqI8kufFFrMBMuANHpnf47JmogND XzwFFjNY922WFEpIjqRb7yWUZlgF5DjZWtM8GqUlyaQL+u5bAw+FCXez2jXQOHETFKWX 55ef5cB89Ti0YqXx3FrFMizcuILwlX7G1jOdrpJD0sl8mX3O9Oe3dNGCcFy89J0TVtJQ 6nB2PNPHD09EQUqTOebnpZWvd5p8uxJLf2q2kBa0zsH2TNM6eYuRqVdRBilp8eQjIjrH gJ+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vc3SisG5; 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 j2-20020a05621419c200b004b1881a7fb0si12726707qvc.348.2022.10.21.01.19.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 21 Oct 2022 01:19:23 -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=vc3SisG5; 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] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olnFS-0007R5-B5 for patch@linaro.org; Fri, 21 Oct 2022 04:19:22 -0400 Received: from [::1] (helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olmHt-0003Nx-9Q for patch@linaro.org; Fri, 21 Oct 2022 03:17:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1olmHi-0003JZ-Pd for qemu-devel@nongnu.org; Fri, 21 Oct 2022 03:17:39 -0400 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1olmHg-0005ql-HA for qemu-devel@nongnu.org; Fri, 21 Oct 2022 03:17:37 -0400 Received: by mail-pj1-x1035.google.com with SMTP id pq16so1688573pjb.2 for ; Fri, 21 Oct 2022 00:17:34 -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=OjjeRZqVgFS5dG8LiFwvWFyG3e2GWcohg60z62TsQR8=; b=vc3SisG52ZoENCc5L2xvztXdwByJKUyB6W7xey56r5xJ7HDHv86p9lwcUwrQctSn+G TiRvzQg66llEi0Km5X2ZgHEhxRa3sntQgWaaFQ2XU2+L0FjAeYk87DEjHeJBfl4GAmmu 5+c4azojyEkor8FPF8JoJ9rROFGdBwoNZ//OsbJnLxrzIaGpdE8EbTiF5iHKh1rnhrtJ 7Sz2knr824Qoheb6doET24TxhjCwhYlCilGCShS//e9A0p5K1yDt+g15ET1IdcDnQMhm sYcwFeporECwnhFAQE8YtxwMPAmAjYwv7mL44Pr1BKkJjL8CZoBscFHNma/xj+ij622D zZnA== 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=OjjeRZqVgFS5dG8LiFwvWFyG3e2GWcohg60z62TsQR8=; b=hwzppSy2OCahhUfYB0jMAuWF8VUFcSOyW3Bp+VGQ/ufd2LSA8V+VIn51i4imvq1wek Bg/AJrA6LXkM0qGRLkBNnVPmGb8wEc7+9CQcgZGpzXFqiZqQdTbWBse6iqdqkb5ZthJn 78hea9hdL731kGLbldfmxVTi1Oc/cN0PLBHkPs11LrjeD69MgVCBpid+JZu7prOw2dHF i79NGGx4xX4WJ1w3xVOSoNE2nwZQAr41t4iBlgH8DSVB8RVAOVanwH+RVV4l0CeNNrGu a4m7fOJF6P7ylPgewtoPWqjBzM0ldL74s+9obG9DxhCG7AWg4xeRVp/dtYiJrLDAf7AK U96w== X-Gm-Message-State: ACrzQf0Q12ZUIe/e10oNa8iv5kuZ92sEOc+DBZ/mOjowboKRGnjojFxC gj4dOltiPkZaLC2l4I8rYivXSfajHpzbNZDw X-Received: by 2002:a17:902:c40b:b0:17f:9636:9014 with SMTP id k11-20020a170902c40b00b0017f96369014mr17682451plk.150.1666336653883; Fri, 21 Oct 2022 00:17:33 -0700 (PDT) Received: from localhost.localdomain ([149.135.10.35]) by smtp.gmail.com with ESMTPSA id q9-20020a638c49000000b0041cd5ddde6fsm13003327pgn.76.2022.10.21.00.17.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 00:17:33 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v2 25/36] tcg: Allocate objects contiguously in temp_allocate_frame Date: Fri, 21 Oct 2022 17:15:38 +1000 Message-Id: <20221021071549.2398137-26-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221021071549.2398137-1-richard.henderson@linaro.org> References: <20221021071549.2398137-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1035.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 fdafb30579..a3538edffa 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);