From patchwork Tue Jan 17 23:10:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 643428 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp1443507pvb; Tue, 17 Jan 2023 15:13:08 -0800 (PST) X-Google-Smtp-Source: AMrXdXuDWCK91wvt+3Rt8OgYkT4/Z/kAKF3JYT5aOZqFs45IfrmyRNZ31oNoH/J2bcmsSKRwIW2e X-Received: by 2002:a05:622a:1e1b:b0:3b4:a6af:a2f2 with SMTP id br27-20020a05622a1e1b00b003b4a6afa2f2mr6205434qtb.34.1673997187955; Tue, 17 Jan 2023 15:13:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673997187; cv=none; d=google.com; s=arc-20160816; b=UpqY98jjqi75Ki4Abc6MEWDay4fyuEIGOACXrXE/7MrV48c49jTVfkBeAg8JTzvAjL YuKPay7TKTUDWhcaLJsw80tgtUVp9emGydcL7ER8IKcVi+EULxb3M6beBBnRpR5tUYG8 Cn8eRQGMf8dgW2j8vScML8SwZQjiTYGIqBZCUUzd9q/vD8zQ+QBRBiwDWaESTqj03+Kh omiluV4UOJk+YJz3pL/x3JcGEhlFQb8pF3XcWsQhLz99LYK5tykvJE88mBT0RHaInm1g Z9cFdzuKlAdtC5UK0WyoHZb90btQ6S11MfF+kcZ/fcgaEje5DJsibEMh30KMnjNGyVz+ FH/w== 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=NO4fzjlEVA7J5t8w4NvQgWpWht1iaiJodr+jf2YhjJI=; b=d3efTWnXiI6Ae7XQzR5E6sEO3sWWE2bu0QU1JHlPj2tM3/5qXhcWoLPwfE16HGb3Cr SpO62i0a3JHfa6VcnPeFLPKbZv6jAF+AWwevFgfrL4D+JAbOT6jROqOskb2+8kJxE2iM S1kaQXwWaZ51nNLH0BiO9RJ6W7Q8YLhmWovl3DrvLnv3tdxH2OQzNGgOw2NpbLpGSkvc K59Ll8U1n5s1RUexEKi3FeBWfDY/crHJ7Ss2mC/0DMQrcGsxlEa6KLAR9RN+EMsz4Jj8 DdgBRMi5jq7r0B3ALJ3+StovsmfzGrCi6rDmwyQl+v+quTYhsY0pDEmO7qmEF47QaV8m wNDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IKC1mC5L; 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 q13-20020a05620a0d8d00b007051669f37esi18358556qkl.257.2023.01.17.15.13.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 17 Jan 2023 15:13:07 -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=IKC1mC5L; 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 1pHv6m-0003TB-Vp; Tue, 17 Jan 2023 18:11:14 -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 1pHv6g-0003OT-Fb for qemu-devel@nongnu.org; Tue, 17 Jan 2023 18:11:08 -0500 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pHv6e-0001IT-4X for qemu-devel@nongnu.org; Tue, 17 Jan 2023 18:11:06 -0500 Received: by mail-pg1-x52b.google.com with SMTP id b12so23195057pgj.6 for ; Tue, 17 Jan 2023 15:11:03 -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=NO4fzjlEVA7J5t8w4NvQgWpWht1iaiJodr+jf2YhjJI=; b=IKC1mC5LZNpf8kCjxDVBBpd3jWkxBtHKqMCrtG4ogslgfwBtcmcFSK/oreexpRtgNm B5pmJ44JrXjbCbQygy6lK/dyKkGiTep2dFVvyTDRrFF4VxPOX2KdcMVIsUOQNuVhqCBx qUpIpkuFXBb3r9IG1T4QfGPEXr1jOp+VNvj2vk3bPdgJRNvD1iqfqOvldDFXLyNMhMcS IzJU9NTM3DrNCB3RwC8zmNVK3Xw+24tedfqS68rtghPTpNDLa1eYb4U4Dfcxlnz73O9u Ox7DC5+Y8440Zmg57CUuZjsZlKFCpiTnkEl2aq4ixZvz50sr9t+OA6Gk/DG3+9KAyX4/ c4kw== 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=NO4fzjlEVA7J5t8w4NvQgWpWht1iaiJodr+jf2YhjJI=; b=1AwK6IoRk4c89S/DzxH0SHXPIFZIE4YQROqbmmq0Ctgl6lmk159hQE3l79xuS9JDon rgV0PQwCUjjZSV6t5fueSem0XZbo6R4tx3FfEiDGCq+PaPyZhTbDkYNcSlqOwp+9ePX7 VgObF02eDEXVpLJxpTOn0rxVy2nymIgRmDEtOd9ssfrGfjz6q7yaCvyTTfdD/YVlTgPC k/egTNHMykKupveuzjMhEKSBrj/tV8n3AhlH6moC9pzAWR4uHJdYfdxrBte4T41quTQw jiHbRler9b85Y91iwRu13mdNVNZ414EEo88eJ2DrH8K7sMWh2Jl+eLwbUuq+1Q0bawwF HTLQ== X-Gm-Message-State: AFqh2krXz9cBjO3R2J9INRmv5zhR7SXOdfxdfWAZCqu5t3uo8iSTl2Ib a/s7+EBloippiiaWzhZ0Sz63+oqckWBuf730 X-Received: by 2002:a05:6a00:181f:b0:58b:d244:b525 with SMTP id y31-20020a056a00181f00b0058bd244b525mr7233576pfa.17.1673997063338; Tue, 17 Jan 2023 15:11:03 -0800 (PST) Received: from stoup.. (rrcs-173-198-77-218.west.biz.rr.com. [173.198.77.218]) by smtp.gmail.com with ESMTPSA id b193-20020a621bca000000b005810c4286d6sm20747070pfb.0.2023.01.17.15.11.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Jan 2023 15:11:02 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= Subject: [PULL 05/22] tcg: Replace asserts on tcg_jmp_insn_offset Date: Tue, 17 Jan 2023 13:10:34 -1000 Message-Id: <20230117231051.354444-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230117231051.354444-1-richard.henderson@linaro.org> References: <20230117231051.354444-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52b.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 Test TCG_TARGET_HAS_direct_jump instead of testing an implementation pointer. Reviewed-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- tcg/aarch64/tcg-target.c.inc | 2 +- tcg/arm/tcg-target.c.inc | 2 +- tcg/loongarch64/tcg-target.c.inc | 2 +- tcg/mips/tcg-target.c.inc | 2 +- tcg/riscv/tcg-target.c.inc | 2 +- tcg/tci/tcg-target.c.inc | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc index 501b77c215..90af096c11 100644 --- a/tcg/aarch64/tcg-target.c.inc +++ b/tcg/aarch64/tcg-target.c.inc @@ -1918,7 +1918,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, switch (opc) { case INDEX_op_goto_tb: - tcg_debug_assert(s->tb_jmp_insn_offset != NULL); + qemu_build_assert(TCG_TARGET_HAS_direct_jump); /* * Ensure that ADRP+ADD are 8-byte aligned so that an atomic * write can be used to patch the target address. diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc index 799cf13536..033ff90daa 100644 --- a/tcg/arm/tcg-target.c.inc +++ b/tcg/arm/tcg-target.c.inc @@ -1953,7 +1953,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, intptr_t ptr, dif, dil; TCGReg base = TCG_REG_PC; - tcg_debug_assert(s->tb_jmp_insn_offset == 0); + qemu_build_assert(!TCG_TARGET_HAS_direct_jump); ptr = (intptr_t)tcg_splitwx_to_rx(s->tb_jmp_target_addr + args[0]); dif = tcg_pcrel_diff(s, (void *)ptr) - 8; dil = sextract32(dif, 0, 12); diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc index 29e4bfcb49..5dd645fd17 100644 --- a/tcg/loongarch64/tcg-target.c.inc +++ b/tcg/loongarch64/tcg-target.c.inc @@ -1090,7 +1090,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, switch (opc) { case INDEX_op_goto_tb: - tcg_debug_assert(s->tb_jmp_insn_offset != NULL); + qemu_build_assert(TCG_TARGET_HAS_direct_jump); /* * Ensure that patch area is 8-byte aligned so that an * atomic write can be used to patch the target address. diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc index 52881abd35..02887d7cb1 100644 --- a/tcg/mips/tcg-target.c.inc +++ b/tcg/mips/tcg-target.c.inc @@ -1987,7 +1987,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, switch (opc) { case INDEX_op_goto_tb: /* indirect jump method */ - tcg_debug_assert(s->tb_jmp_insn_offset == 0); + qemu_build_assert(!TCG_TARGET_HAS_direct_jump); tcg_out_ld(s, TCG_TYPE_PTR, TCG_TMP0, TCG_REG_ZERO, (uintptr_t)(s->tb_jmp_target_addr + a0)); tcg_out_opc_reg(s, OPC_JR, 0, TCG_TMP0, 0); diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc index 9b42cb4b2e..b977c8025d 100644 --- a/tcg/riscv/tcg-target.c.inc +++ b/tcg/riscv/tcg-target.c.inc @@ -1311,7 +1311,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, switch (opc) { case INDEX_op_goto_tb: - assert(s->tb_jmp_insn_offset == 0); + qemu_build_assert(!TCG_TARGET_HAS_direct_jump); /* indirect jump method */ tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_TMP0, TCG_REG_ZERO, (uintptr_t)(s->tb_jmp_target_addr + a0)); diff --git a/tcg/tci/tcg-target.c.inc b/tcg/tci/tcg-target.c.inc index 2f3bcce3a7..ad356f1875 100644 --- a/tcg/tci/tcg-target.c.inc +++ b/tcg/tci/tcg-target.c.inc @@ -603,7 +603,7 @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, switch (opc) { case INDEX_op_goto_tb: - tcg_debug_assert(s->tb_jmp_insn_offset == 0); + qemu_build_assert(!TCG_TARGET_HAS_direct_jump); /* indirect jump method. */ tcg_out_op_p(s, opc, s->tb_jmp_target_addr + args[0]); set_jmp_reset_offset(s, args[0]);