From patchwork Fri Dec 2 05:39:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 630209 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp716615pvb; Thu, 1 Dec 2022 21:44:58 -0800 (PST) X-Google-Smtp-Source: AA0mqf7ykDqWgEuwX+Kg37RETHBn383OGzm34IS/QzJJM1M1B+2TjEQBm8oIk0gv+mU2e5+BEJnW X-Received: by 2002:a05:6214:5984:b0:4c6:9390:983 with SMTP id ll4-20020a056214598400b004c693900983mr45948678qvb.65.1669959898768; Thu, 01 Dec 2022 21:44:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669959898; cv=none; d=google.com; s=arc-20160816; b=i2IWl3X77AJc1tTJK0ubIi7usbm5tS0ZqmJB+KcOV8wW5uCK++yke/dsW1MwntDlyx MmQWzWSV2CV7CkY4Yf02yzxIsYrkIoZAKGHXqvC2p9tyUs0EZv5n3qdfkvRLZUvc2QEt LBmsQCMWMXgHkYwkyQQ1PkiNEKybLKJkgDbwik2oeWl3YWSDHNfGHuQI/2/uWckOOd2w kA5Q3NiogxTPTslY6wBdd+/wTNn1vxMN5j1iyWuI0Oo+HXaW+MJXYRLjEBr7JNvlI7c2 BxqBXNQnLjVLsW74x6aF6iH/L+usdF7D0DkbyJd08nZw7rkbSEOdH/NfE/w4jJlGVcHE fS/Q== 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=y8WEsTTyeGQR6dZ2OaXpTAI/FZ+2tdaCITo/e1JRHd4=; b=vyFGPo3uH0oxTgYmXM5m56fVXGOhDUniT1PEBAfQ7590GBNfsuLOFiO3sTmLlwns5U eWLW2SkKsCY3qtHPljJuQVbmazc0wKRrLchzO0O18HSfuYyX6/UusmPrcNTkpgxehlrY 4Yp1w6LNmavg18nA8z8XkgDTcA4OrWB3p++lYtWF1fcsmnrFQNi49RTdovrlvtzIvlO8 J5lWJ84+QCgUculyhpijveAtz+3zbO25EmgTqkB46Q0f0BjoCLTpL0xoiD4YQOPNXKo4 Ui8ODetOnKGUMV4ANR8MAfzZcLIQrf0o9/NB6Ekhm1EBDXiBhKwgtPcuWnescYOzyfB0 JE0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="cDEzc/fX"; 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 ib14-20020a0562141c8e00b004c6a1e993aasi3254709qvb.94.2022.12.01.21.44.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Dec 2022 21:44:58 -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="cDEzc/fX"; 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 1p0yml-0002iu-IG; Fri, 02 Dec 2022 00:40:31 -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 1p0ymi-0002i1-UT for qemu-devel@nongnu.org; Fri, 02 Dec 2022 00:40:29 -0500 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p0yme-0003O3-05 for qemu-devel@nongnu.org; Fri, 02 Dec 2022 00:40:28 -0500 Received: by mail-pf1-x42d.google.com with SMTP id 124so4008028pfy.0 for ; Thu, 01 Dec 2022 21:40:23 -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:to:from:from:to:cc:subject:date:message-id :reply-to; bh=y8WEsTTyeGQR6dZ2OaXpTAI/FZ+2tdaCITo/e1JRHd4=; b=cDEzc/fXKMhZoNbg0A+LnBBC3ht43Ale0DD/5KAxv8nPadpFEc+CaHlswOWG5aJIaN KF6zlugJglbE0cdcvH45Z6f/avFMX03VukKjDX4Fm0veljvI2Ow/VlOV0CRMIcz8pp06 bSVCk9snJMBO3kbJaWxqBXuIYlRn6I6vivuU1oIWXkXuhXCxp7I4+oZMJV82qNrKPXzh 08P4fDhqx98u40XWluiM7SN46c6uDcXHUY0Z/WtPJw60sbmdfQsP8nFx6fRXIyUJbz8n sjS2/UScNMi9u9PkU7KKPnNJ9WmeQtYn1ttO1VUQBwoxljueCdjzESVmaZ1A/ji9CnAL OeNQ== 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=y8WEsTTyeGQR6dZ2OaXpTAI/FZ+2tdaCITo/e1JRHd4=; b=flawSaQhP1mX6vJGlIVtcsouWxrKtI/WbWABkTdwTm7r8gaSRAfO5MxldO4uA/INhR d7s9+mTFuN5n5/MDJn3aCXPCZWnxApj+nqKMK88G9fUtCSEOBmwDd3qZ3byeAmPcU4+r 2PqrpixQPxeD8ii2n+woMq7JaaG90XaDhbAyioiSHRxA8m3wqg5NIwduKFbqpPFbhJSo 5G+yl8LfDNaJXdLlNiwvY7nJbyCqzqYDTkqtOswIA5RE5YPIgQiqB2DdMtBZwe8u5M4z XdoNqEX2wqVqKAVPu1/YoMQu8bGVKcOnlbXBsvE1Q5j00gQ9q1Z5bkWqASfuP00rG07C GdYA== X-Gm-Message-State: ANoB5pmQJrM6IrBlFTTfoJmzm1fXJAO6GDWyZmoTQj96t2UQNE2elNtB NsYHucmvEPhc6rON26xzcMJ/t24HgnT/r09F X-Received: by 2002:a63:5a48:0:b0:45f:88b2:1766 with SMTP id k8-20020a635a48000000b0045f88b21766mr43762837pgm.357.1669959622754; Thu, 01 Dec 2022 21:40:22 -0800 (PST) Received: from stoup.. ([2602:47:d48a:1201:e3cc:2e37:17d4:f1d5]) by smtp.gmail.com with ESMTPSA id d12-20020a170903230c00b00186f0f59c85sm4637075plh.235.2022.12.01.21.40.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Dec 2022 21:40:22 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 23/34] accel/tcg/plugin: Don't search for the function pointer index Date: Thu, 1 Dec 2022 21:39:47 -0800 Message-Id: <20221202053958.223890-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221202053958.223890-1-richard.henderson@linaro.org> References: <20221202053958.223890-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42d.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, T_SPF_TEMPERROR=0.01 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 The function pointer is immediately after the output and input operands; no need to search. Signed-off-by: Richard Henderson --- accel/tcg/plugin-gen.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index 80dff68934..9e359c006a 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -381,32 +381,25 @@ static TCGOp *copy_st_ptr(TCGOp **begin_op, TCGOp *op) static TCGOp *copy_call(TCGOp **begin_op, TCGOp *op, void *empty_func, void *func, int *cb_idx) { + TCGOp *old_op; + int func_idx; + /* copy all ops until the call */ do { op = copy_op_nocheck(begin_op, op); } while (op->opc != INDEX_op_call); /* fill in the op call */ - op->param1 = (*begin_op)->param1; - op->param2 = (*begin_op)->param2; + old_op = *begin_op; + TCGOP_CALLI(op) = TCGOP_CALLI(old_op); + TCGOP_CALLO(op) = TCGOP_CALLO(old_op); tcg_debug_assert(op->life == 0); - if (*cb_idx == -1) { - int i; - /* - * Instead of working out the position of the callback in args[], just - * look for @empty_func, since it should be a unique pointer. - */ - for (i = 0; i < MAX_OPC_PARAM_ARGS; i++) { - if ((uintptr_t)(*begin_op)->args[i] == (uintptr_t)empty_func) { - *cb_idx = i; - break; - } - } - tcg_debug_assert(i < MAX_OPC_PARAM_ARGS); - } - op->args[*cb_idx] = (uintptr_t)func; - op->args[*cb_idx + 1] = (*begin_op)->args[*cb_idx + 1]; + func_idx = TCGOP_CALLO(op) + TCGOP_CALLI(op); + *cb_idx = func_idx; + + op->args[func_idx] = (uintptr_t)func; + op->args[func_idx + 1] = old_op->args[func_idx + 1]; return op; }