From nobody Sat Oct 25 21:46:06 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15211418326275.797649353307861; Thu, 15 Mar 2018 12:23:52 -0700 (PDT) Received: from localhost ([::1]:53026 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ewYTf-0002lG-RD for importer@patchew.org; Thu, 15 Mar 2018 15:23:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54508) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ewYQP-0000bO-11 for qemu-devel@nongnu.org; Thu, 15 Mar 2018 15:20:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ewYQL-00061B-Tn for qemu-devel@nongnu.org; Thu, 15 Mar 2018 15:20:29 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:55691) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ewYQL-0005zJ-Cn for qemu-devel@nongnu.org; Thu, 15 Mar 2018 15:20:25 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue007 [212.227.15.167]) with ESMTPSA (Nemesis) id 0La6Uk-1eCo403ZHS-00m4pa; Thu, 15 Mar 2018 20:20:15 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Thu, 15 Mar 2018 20:19:58 +0100 Message-Id: <20180315191958.28937-4-laurent@vivier.eu> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180315191958.28937-1-laurent@vivier.eu> References: <20180315191958.28937-1-laurent@vivier.eu> X-Provags-ID: V03:K0:Gvc6o58w8vrQgSTitC39H51nRqPkLVFxsUQP6uDyLjjOOg6TzJ8 uDleMb8Rgqgxv38HCskZZS6g5zhOsXqXmjpf+tIY9jzfjzVF+xUW3oCP8w8BnvyqvzBnXcW xPFPgpPwrdHQvtPVAZawKZdQs5ckY4QyEWDbsQ1MO5SPFpdu295viojhCrsTkN7Tq/IXR0B 3XW2BbrbflIIm9FrAmKdA== X-UI-Out-Filterresults: notjunk:1;V01:K0:/xX+4m4fZig=:Cdzxx9YE1DqX4atoVsTOQR MlbY7f2vHh6UhCMz7LuedCDSXeHRSUiSCaMOclEsgGe7feTAenv5/WlDrBIyIQSedPiNBnUxn b+nwgw4EZn1nzu22CrwfFtDlQqMOaBnkLkzAZUw5vPNdlhcnjc8ZlGKSGHyYW+v4quSrOb2SE 40YR3GW9N44ZALE9LD5UCAkpTrhqa0+XKW9zW1JAZcHPVlit0ZnsFV5TzMz6/jx7N7u77fP+b ex+MzRnDtIJHVW1qif3P6PPLjwFT/HIQJZVVRoYp7qb9Zc+57yr95uIJf4cg+o/w81DIN3CjE MXVjigteb6mmywS4Z68HhinW3Rb3rJ978fWL+1SOardOOnmOZvXGgdlDsMrOjmbKdPedIKruY tNmaLhQoN+5JeedVcXK+rRXYyBydB+yEE/P/9fCpLLx2tfEXDQEom2GQJtPjyFrA641eBY4O9 WeXT5g4W+JzucQokGHCbUJagXZH2P4/hFN90SH9qcGvweGq+LA+5/uoGlbAqkiClm7WulP+mG TM6PQ62mksuOpQLrjsO6CREsxwfibE4B81Q6cfOtrhapUCOOU76W+TkI+xpk64e+c2tRaOBnM DarLhyiUbR6DkEUMyM4LcOLxmtO5M30yxpP3wlDTglCNjCt68K4Ai6ArJzMMfcmGiaxg1LOQ0 sfLcn4LhzlvOuj7uSKV3BMQXU2J9NizDNCimj1IvVCCFnPS9imOHpd6o/w7UfMNjq3QQsaJOd TdnnB87ci/ljoFks2lp+67+I48LOpft12y3+AQ== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.126.131 Subject: [Qemu-devel] [RFC 3/3] m68k: Test if we overflow the temp variable array X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Since commit 15fa08f845 ("tcg: Dynamically allocate TCGOps") we have no limit to fill the TCGOps cache and we can fill the entire TCG variables array and overflow it. To avoid that, we stop the translation when the array is close to be full. Signed-off-by: Laurent Vivier --- target/m68k/translate.c | 2 +- tcg/tcg.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/target/m68k/translate.c b/target/m68k/translate.c index 03aa701dde..e235be46ba 100644 --- a/target/m68k/translate.c +++ b/target/m68k/translate.c @@ -6155,7 +6155,7 @@ void gen_intermediate_code(CPUState *cs, TranslationB= lock *tb) =20 dc->insn_pc =3D dc->pc; disas_m68k_insn(env, dc); - } while (!dc->is_jmp && !tcg_op_buf_full() && + } while (!dc->is_jmp && !tcg_op_buf_full() && !tcg_temp_full(64) && !cs->singlestep_enabled && !singlestep && (pc_offset) < (TARGET_PAGE_SIZE - 32) && diff --git a/tcg/tcg.h b/tcg/tcg.h index e6d9dc0643..ccfe050e27 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -836,6 +836,12 @@ static inline bool tcg_op_buf_full(void) { return false; } +/* Test if we overflow the temp variable array */ + +static inline bool tcg_temp_full(int marging) +{ + return tcg_ctx->nb_temps > TCG_MAX_TEMPS - marging; +} =20 /* pool based memory allocation */ =20 --=20 2.14.3