From patchwork Mon Mar 19 11:35:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 887684 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=vivier.eu Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 404Ytm3wMmz9sRc for ; Mon, 19 Mar 2018 22:36:47 +1100 (AEDT) Received: from localhost ([::1]:41374 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ext5m-0000GT-Fg for incoming@patchwork.ozlabs.org; Mon, 19 Mar 2018 07:36:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60761) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ext5F-0000GE-R2 for qemu-devel@nongnu.org; Mon, 19 Mar 2018 07:36:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ext5C-0000vY-5X for qemu-devel@nongnu.org; Mon, 19 Mar 2018 07:36:09 -0400 Received: from mout.kundenserver.de ([212.227.17.13]:41653) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ext5B-0000v2-RU for qemu-devel@nongnu.org; Mon, 19 Mar 2018 07:36:06 -0400 Received: from localhost.localdomain ([78.238.229.36]) by mrelayeu.kundenserver.de (mreue103 [212.227.15.183]) with ESMTPSA (Nemesis) id 0MgI6w-1fIKRF1Z3O-00NjZE; Mon, 19 Mar 2018 12:35:59 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Mon, 19 Mar 2018 12:35:42 +0100 Message-Id: <20180319113544.704-1-laurent@vivier.eu> X-Mailer: git-send-email 2.14.3 X-Provags-ID: V03:K0:vB3/HInY5u8TVqpYAYp1TDpSVuvnUdIBKBzZqxg89eA7p74FUGb kgkUadkd4FuMVpZoX1g7qIq2mlXvrL9XXr0bxbnDtk0rDY8omCFMK1rXobCw213daLegR7E yaJLbsi/cCl9QXV/nwq26Np4K9PJCNQA1AfeKI6GgBXrFnOIL4p59LTod+4fe9zcPJZxnke wwd3yZ1+anUG+mV/dpfDQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:LmoQCK8DK5M=:K77k74C47KIB3/MrbhfFF/ m+qyese2HfkoAk0QFxK20qeC52A2jNMGYjLtkBZw23YYTyivdHNx7NHmFhoDKW84gln3zA9lJ qcnUOCadDgYgsKsvVX9AKdTQ7c++QFd+1KEx9e16WCLU8E4udK3f69GTfCdw6PFOxUlyNXP8U 0KyvIy9Z7OMt/SMga2FUv3lRJ2Xjles1Q0omzkmX7V5I41wij+mrRlIsCKQ8FWK0dJh/aOmFS gXEngdK7/WImqoTfH3NoQ4sx6/kC2ETbJRC2jZ5JwOE+lSWRvtvGzR0tOS3SkEnT7BOs2toV4 IBfvfPLq0S2D3M8PVrlDqMg04v2x0BNibgMny5FdAw8fQF9ms4Nj6sHQVci0qhRRRHSF+VJGO wr/YrpGCq8LHWBTL+Snpr3aCd3iAavwfQmAS/RdgZSbo7cycO0fCJAePNBpsRjSQAwa+xDjHD z6HdTD7rpK708bV7qNal4E4yj4Q4hwMFDILL5YXMjh8fXBUoXTU1st0JMYzNAru5RfQwdeA/d hBzy+Hf47+AQ3LzUI+UnO2IQccekC6FxL1GvM89RV/1581/IBEWhEzdN+oVEDseacI7hlErhu iVIbprcDnS5QMOCgJXrF1NoEFQYAHCLVg7E731xpoGPPI9olNdML2psk8i5yieWFdbFFoh/An JneYcABOw3S30AmyPeimkIAih4W5kx7nkfue45ZPhTlTrEHjDRBsAANS79Umj68MrRNIjKQcE GpRj0NRVxepFYmf7+ivMOe1HK56YZKOZHV/CTA== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.13 Subject: [Qemu-devel] [PATCH v2 0/2] target/m68k: add a mechanism to automatically free TCGv 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: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" SRC_EA() and gen_extend() can return either a temporary TCGv or a memory allocated one. Mark them when they are allocated, and free them automatically at end of the instruction translation. We want to free locally allocated TCGv to avoid overflow in sequence like: 0xc00ae406: movel %fp@(-132),%fp@(-268) 0xc00ae40c: movel %fp@(-128),%fp@(-264) 0xc00ae412: movel %fp@(-20),%fp@(-212) 0xc00ae418: movel %fp@(-16),%fp@(-208) 0xc00ae41e: movel %fp@(-60),%fp@(-220) 0xc00ae424: movel %fp@(-56),%fp@(-216) 0xc00ae42a: movel %fp@(-124),%fp@(-252) 0xc00ae430: movel %fp@(-120),%fp@(-248) 0xc00ae436: movel %fp@(-12),%fp@(-260) 0xc00ae43c: movel %fp@(-8),%fp@(-256) 0xc00ae442: movel %fp@(-52),%fp@(-276) 0xc00ae448: movel %fp@(-48),%fp@(-272) ... That can fill a lot of TCGv entries in a sequence, especially since 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. v2: split patch in two (separate the patch to add parameter to gen_exten()) mark to release missed gen_load() in gen_lea_indexed() Laurent Vivier (2): target/m68k: add DisasContext parameter to gen_extend() target/m68k: add a mechanism to automatically free TCGv target/m68k/translate.c | 102 +++++++++++++++++++++++++++++++----------------- 1 file changed, 66 insertions(+), 36 deletions(-)