From patchwork Fri Dec 30 00:02:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 637856 Delivered-To: patch@linaro.org Received: by 2002:a17:906:1189:b0:7d5:1b03:224a with SMTP id n9csp4174279eja; Thu, 29 Dec 2022 16:22:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXuRoHlbOvdwXrwThnZ7o9mc91P6dKSa7VJ9rJscH3HfRqhnZ+6bS7xjz4FRSovolxKjQrCe X-Received: by 2002:ac8:74c3:0:b0:3a8:19a4:4004 with SMTP id j3-20020ac874c3000000b003a819a44004mr38805470qtr.33.1672359760303; Thu, 29 Dec 2022 16:22:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672359760; cv=none; d=google.com; s=arc-20160816; b=ZNve417xwjlJdANMvGsTOJn0G4BMA/xpV93kLS6Utc7uPCKPI7SQ0RirnLzgHgybbH K4PNSl/uzhMGaWM3PSHru35su6dXOM6byxQm0UMMYg2T2SAclHuIcw3dp3+K2ofZgNhV 0F6jHPSUp48Uk7qKEmqRjWf/bocl8Kf5YwJNYQlI3XD9HFvQOCphOicUtH4C4FeG0v4/ PYdMlmxvC9/xgwlTWE8dqV6fMmkZlPJkONyrCQTBFz16WEQ//88DDiPEr0wocII9RomJ GasqcnfuJUj7V9A5gO+dwb4IsCwxkAEMSLafKRZJLIMwUapKACRkHC83rr58elxEpmXs CjRg== 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=qmknChCT1BuzZEHCmViTBYnc57/Tlc2QwxNuPPER9qk=; b=klXLp7rdNfLCuZJN8o68m/dQOpLO98CM6Rn35msWuU5HEdTg74MVTcPxKedlRITNQ7 B7HtTKqPvScSsgeFoH0LRrhiy/JhhIY5f4VMMS0W4X02fgJSnpAs3Eb6SA/jz1NHt4Yw yo3fymU79LBW6sxbJQ3iLfDFC2m+20EzQ8jKObEk3M8Ci+xtq1D2mZl0d+jZQNChsTr/ 74p3+dUgne/ftfb6rLvthFKTcqNzIS/xgaxS82aAOFZpKmB04rURSK0w5C58IUml2x5n 5zbwHfxVEsK5ccdmfsjuVS6u+chrSlHzOIHvajKFlBpvk2yZeS30TzOveNcDus8JEYTZ aSsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eLO5hR9S; 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 v5-20020a05620a440500b007051c4de18asi3139978qkp.106.2022.12.29.16.22.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 29 Dec 2022 16:22:40 -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=eLO5hR9S; 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 1pB2sQ-0003uu-Da; Thu, 29 Dec 2022 19:03:58 -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 1pB2rW-00039G-Vr for qemu-devel@nongnu.org; Thu, 29 Dec 2022 19:03:05 -0500 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pB2rQ-0002fT-7H for qemu-devel@nongnu.org; Thu, 29 Dec 2022 19:03:00 -0500 Received: by mail-pj1-x1032.google.com with SMTP id i12-20020a17090a4b8c00b0022632104a6eso2926867pjh.1 for ; Thu, 29 Dec 2022 16:02:52 -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=qmknChCT1BuzZEHCmViTBYnc57/Tlc2QwxNuPPER9qk=; b=eLO5hR9SBeXisYZtsyBZe7aR9QD2YLfKd1/NGEEMiE8XpCKaA6MhrT+23oO7Or/3GW sB7otR+RNpPefXpqOfy6f6mKMNBmNN0X0F8jEqqqYvS19bC7x61RBGsGo9nFaUyZ3ako KFa5c/V60jViEPS8rQI5OPFzLk7EzkIuhhaTE6WELiK744hI9yE8GVeVKKURS3cmNbc0 Hj70j6OLZKKGuE3bQXQTKix1A1XCyNKrMFr+gjrYEzQfr/+JTaX+PtZvN8ESq1/kkjRt urVqTzPII68dJjZpPY2B3BceyFrDIzTkXKwRPM9Sm89liE7zjiJFthOfJjTC3DP/Uv5E gzzA== 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=qmknChCT1BuzZEHCmViTBYnc57/Tlc2QwxNuPPER9qk=; b=pL+Aw9d/3DvEF+POONjOZighqrpBBWkcy7VH/kRDu0LD17uMlDldiOpUMnCX8Bmw/4 6CCnPZmWGHsNQ7LBAU3EOkaQrhcKi3gd/kJye+vcvNqZvMilh+iaEtxF96sMWNW4bg3+ qASxWlXeAocbF7inCa0pl1EqpZafxvdq3fdb6uiF+ivZomrWWuVjPedYoJ5nGNybeEVC TPVf3psYJL9RIFHDM22jWuvFjBy3n+g6iKL1nyhcbhSPp1kHK2xLTCOa3wGHBMoNH8mm a3/PP/OvakZnisfsa3h/kIOJ5R1mrmXDgguehb5SsAuZjl9TODzBNTGHFemUx+FeuQxS Qv+w== X-Gm-Message-State: AFqh2kqn+yixnkppVkqygJdNBbQxxu5GxvZU46kVqRnG2s36yZjf0XHY kAw+I2ziK3oppOOW17Oz2WNTZOvL821QycyN X-Received: by 2002:a17:902:848d:b0:189:76ef:a1b9 with SMTP id c13-20020a170902848d00b0018976efa1b9mr29280273plo.5.1672358572241; Thu, 29 Dec 2022 16:02:52 -0800 (PST) Received: from stoup.. (76-14-210-194.or.wavecable.com. [76.14.210.194]) by smtp.gmail.com with ESMTPSA id j14-20020a170903028e00b00192849e1d0asm7343953plr.116.2022.12.29.16.02.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Dec 2022 16:02:51 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PULL 32/47] accel/tcg/plugin: Don't search for the function pointer index Date: Thu, 29 Dec 2022 16:02:06 -0800 Message-Id: <20221230000221.2764875-33-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221230000221.2764875-1-richard.henderson@linaro.org> References: <20221230000221.2764875-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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 The function pointer is immediately after the output and input operands; no need to search. Reviewed-by: Philippe Mathieu-Daudé 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; }