From patchwork Mon Jan 30 21:48:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 648637 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp1396208pva; Mon, 30 Jan 2023 13:53:46 -0800 (PST) X-Google-Smtp-Source: AK7set/mx+OfK42vyY2CN9XukkkG1mLth4hAF/HSX8IHZAaf2eRZSV6LLnse72qnye80dpBHvGQO X-Received: by 2002:ad4:5ca5:0:b0:538:3f5e:e7e4 with SMTP id q5-20020ad45ca5000000b005383f5ee7e4mr27857133qvh.11.1675115625730; Mon, 30 Jan 2023 13:53:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675115625; cv=none; d=google.com; s=arc-20160816; b=sDu6RJnF4E9HFyUTZNvmFDd2289et3EhEVUf//D9+jVnLug/3vYxLw+w4HigXky4+D TRrhQ8S9+SQltlekCpLz97rUmYcWvi8mUSpMdf24DQHnO0SJDFJ4Zquv8Jo7u+nxwVrZ hcWckfBe/arEfr8HWWDmrCA0Eg5/JxFY8K2w/E0HgIK1CDYx5ViJaK3KXv/m/JPNso8q 55P9u1EM8ZlFpbnlKxk1JgYTXPi3yk5AdudupXzsVtAZ+Gbq7En/yPfDDEhoSpvW3Tps EeQy8b9f/hpIQzmZDM7gT/Z5PQTMpzv6CwmM6BHlx5AdWo+KxBHpa0gS+JN/I4hpVYR5 6tTQ== 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:cc:to :from:dkim-signature; bh=tk5ThUejyy0sfkaXylh35ElIxwLbKgRuWHGH5cw50Nk=; b=MiqrsOAoJHWLRIBVLagMqMCN01HEZOvfXYinJQ5fsBhnjUJf5Acbp+iyYTXatUwYFO 0bq+s2Mu2SNdjsmsc7EljHHXvXygNs153dmS+ZOe84BsS33d6BHICdG7rT2I8ZBnTBoc FrGK/EijZeqz3p+a5+Q1iOa2ydPDAwYqQmeRSOXXoI+pYCmEbtDOFFkh4ORcpGYolKAH Pozr6vUIOzbxjnIsyR0knzpuy47+3Hh7eIP/rW8U+E5AcpinDj5u3cOsi1AsQXi+fOzc 0ve59bY4TX8KWUcRZIfE/BrYh3quYllRNLXkpK4kyi9dF3Y3EgjMfLzVEvb1WfB4uWXK MpaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="u9OLRC/J"; 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 p1-20020ad452c1000000b00531d0b89d34si6370310qvs.431.2023.01.30.13.53.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Jan 2023 13:53:45 -0800 (PST) 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="u9OLRC/J"; 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=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pMc1L-0001sU-Ax; Mon, 30 Jan 2023 16:48:59 -0500 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 1pMc1J-0001rg-8T for qemu-devel@nongnu.org; Mon, 30 Jan 2023 16:48:57 -0500 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pMc1H-0005aI-OE for qemu-devel@nongnu.org; Mon, 30 Jan 2023 16:48:57 -0500 Received: by mail-pl1-x635.google.com with SMTP id be8so13091482plb.7 for ; Mon, 30 Jan 2023 13:48:55 -0800 (PST) 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:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tk5ThUejyy0sfkaXylh35ElIxwLbKgRuWHGH5cw50Nk=; b=u9OLRC/JmmArh/zf4zkx8bPuUMTF7T5QocQDWCMd7DdsvxQ+OftwgrI/XvPE50+elW ud+EKcih1Yaz9VAct3B+iCPHtDHuwaTyzw/cJfSxSyAq6kfLEujYAYkigwqhx6Q/PJsN 5qSn5G5fOORRMyj1lXrGWPCbw5otaWyEyfqaCKDr8WwsQL4U8fxA6hDb2krRLqndMkrc aLQmLp6QIe2CV7+tf3lBLPeKtxda+ZKGy5TpzueT/QS5a3dNmADfnoKHfDWIISnm60dY Wrf5yvwbPlPp0yxpD79OHGup+zCqEtyojfnPp3P0PhkJwVV9DESv2Lpr33ql/GJwvBNC f/eg== 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:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tk5ThUejyy0sfkaXylh35ElIxwLbKgRuWHGH5cw50Nk=; b=h9TezddgWh6fkxmznRCnrkr2D2nG8HSOWMgrP+Zb2RJ+hQ5synstAObwDrnCfWtVy6 DyjBjOduRqNNcbrUO/zfs4EZh3QKXYEHq940nIB7sAdPw7LSHU4HajZqlWH27O5XAisY ynn2jd+m/66co73f8+DfkxVGeNjXqb/TTr2HA98CwuAOVyZgr0PF1w/WlbioQXAFTShh opq1ds7HJxIdeONXBN9ocSJGDVWqi2G5PIpjnts+6Pt18ikfLVHTx6bP0XlbfZiprLnn j+8kirj+PTEUOh9CbjQgr5N05tL5SekvR3Pnn6ykj9K3buhFUBWh37jvf0piuTAcLDkD qQOg== X-Gm-Message-State: AFqh2kppNNXgeZ1TnS/0A12ud1C0iMonR4zpQis2PSxBIWSzlYO7GHG8 Mqfryu+dc3Ve3t2Ya6eEaxsQMs5a0nV29+Mf X-Received: by 2002:a17:90a:428c:b0:223:b920:28df with SMTP id p12-20020a17090a428c00b00223b92028dfmr53256724pjg.29.1675115334156; Mon, 30 Jan 2023 13:48:54 -0800 (PST) Received: from stoup.. (rrcs-173-197-98-118.west.biz.rr.com. [173.197.98.118]) by smtp.gmail.com with ESMTPSA id t4-20020a17090ad14400b00219220edf0dsm7451215pjw.48.2023.01.30.13.48.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Jan 2023 13:48:53 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, philmd@linaro.org Subject: [PATCH v6 03/36] tcg: Allocate objects contiguously in temp_allocate_frame Date: Mon, 30 Jan 2023 11:48:11 -1000 Message-Id: <20230130214844.1158612-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230130214844.1158612-1-richard.henderson@linaro.org> References: <20230130214844.1158612-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::635; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x635.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-bounces+patch=linaro.org@nongnu.org When allocating a temp to the stack frame, consider the base type and allocate all parts at once. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- tcg/tcg.c | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index ffddda96ed..25e92ef5d6 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -3264,11 +3264,12 @@ static bool liveness_pass_2(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; @@ -3299,13 +3300,30 @@ 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; + + /* + * Each part is allocated sequentially in tcg_temp_new_internal. + * Jump back to the first part by subtracting the current index. + */ + 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; + } } /* Assign @reg to @ts, and update reg_to_temp[]. */