From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tomas Volf <~@wolfsden.cz> Newsgroups: gmane.lisp.guile.user Subject: Re: How to globally replace core binding? Date: Tue, 28 Nov 2023 02:37:15 +0100 Message-ID: References: <90c7afb7-9bfd-30f1-c83e-3458067b69f6@telenet.be> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="jj6wVyNre8Bv0yYY" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33585"; mail-complaints-to="usenet@ciao.gmane.io" Cc: guile-user@gnu.org To: Maxime Devos Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Tue Nov 28 02:38:05 2023 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r7n35-0008V7-La for guile-user@m.gmane-mx.org; Tue, 28 Nov 2023 02:38:03 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r7n2S-0007Mx-Mf; Mon, 27 Nov 2023 20:37:24 -0500 Original-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 1r7n2Q-0007MZ-36 for guile-user@gnu.org; Mon, 27 Nov 2023 20:37:22 -0500 Original-Received: from wolfsden.cz ([37.205.8.62]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r7n2N-0004Xf-Vl for guile-user@gnu.org; Mon, 27 Nov 2023 20:37:21 -0500 Original-Received: by wolfsden.cz (Postfix, from userid 104) id B08F625FBA5; Tue, 28 Nov 2023 01:37:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1701135436; bh=/b6MCtVZBQJV65S0tghWvR0DXVJp33SirgpAQfMT+Mw=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=Xgc6YNv3HSjBBuW72q0XGlcoqORCTybXwH5sQ+GgfkMUxRow/7viinx8ah5yP/Fhc WI5mVAraDAjuP4GXESCYt6yE0YWFnI7D64j8n/v4hUsBo9EZGfCSW4Nu0GJUbIZvpA M2FaLqZAfrGV96Ph6QLs8J0dEzi+tKVgHW4LqpVEcbqFJQCZCwCm8XI5QPj2ElXCKq XmkGfEbZ2yScxdCw7bARfU1DCTcjbZtB1E+JKX1SqdFoRpVOmhOUM6u/PiYiBETao0 CruM6YqlzxVDzDdIcd4VHDOyLOwOwWI54BD3EgNVHoQlPfhXna7u8R54SNCFnqODrN fux+LrHU/DfsJ8YCATTQAmV67z8Tb3hdln0W4jYItdI6OhWXm2iHdBAx4W9o8Klut0 Tw1hpZrTTIvs5S5pGAzWRMPy4JEHasxCKtT/jLoSBnv/TQyhOPbqVxHXu4Pfol9WX6 WYJ73sxbPcTEAnCoaKRPCDzaR1l36LEcu07KHZlVUu/OLONJM7T3X54Ox4ToL5M4aG DuE26rCmNd2uLcaWWlLCMmh//F3+H56z75ccPC6ci3qjlL3gZbeXIfMyRrsterOB9H WLeYoGYeeIZPHTbGx/pibYW4KN+BqgqF2PTt4N2ok9Nj6sLZ/ZaHgqRoiHBZjHvho7 vZv265ptOBiylLtYraZol+GI= Original-Received: from localhost (unknown [193.32.127.136]) by wolfsden.cz (Postfix) with ESMTPSA id DA51625F13D; Tue, 28 Nov 2023 01:37:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1701135436; bh=/b6MCtVZBQJV65S0tghWvR0DXVJp33SirgpAQfMT+Mw=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=Xgc6YNv3HSjBBuW72q0XGlcoqORCTybXwH5sQ+GgfkMUxRow/7viinx8ah5yP/Fhc WI5mVAraDAjuP4GXESCYt6yE0YWFnI7D64j8n/v4hUsBo9EZGfCSW4Nu0GJUbIZvpA M2FaLqZAfrGV96Ph6QLs8J0dEzi+tKVgHW4LqpVEcbqFJQCZCwCm8XI5QPj2ElXCKq XmkGfEbZ2yScxdCw7bARfU1DCTcjbZtB1E+JKX1SqdFoRpVOmhOUM6u/PiYiBETao0 CruM6YqlzxVDzDdIcd4VHDOyLOwOwWI54BD3EgNVHoQlPfhXna7u8R54SNCFnqODrN fux+LrHU/DfsJ8YCATTQAmV67z8Tb3hdln0W4jYItdI6OhWXm2iHdBAx4W9o8Klut0 Tw1hpZrTTIvs5S5pGAzWRMPy4JEHasxCKtT/jLoSBnv/TQyhOPbqVxHXu4Pfol9WX6 WYJ73sxbPcTEAnCoaKRPCDzaR1l36LEcu07KHZlVUu/OLONJM7T3X54Ox4ToL5M4aG DuE26rCmNd2uLcaWWlLCMmh//F3+H56z75ccPC6ci3qjlL3gZbeXIfMyRrsterOB9H WLeYoGYeeIZPHTbGx/pibYW4KN+BqgqF2PTt4N2ok9Nj6sLZ/ZaHgqRoiHBZjHvho7 vZv265ptOBiylLtYraZol+GI= Original-Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 02ee98dd; Tue, 28 Nov 2023 01:37:15 +0000 (UTC) Mail-Followup-To: Maxime Devos , guile-user@gnu.org Content-Disposition: inline In-Reply-To: <90c7afb7-9bfd-30f1-c83e-3458067b69f6@telenet.be> Received-SPF: none client-ip=37.205.8.62; envelope-from=ws@wolfsnet.cz; helo=wolfsden.cz X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_PASS=-0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01, UNPARSEABLE_RELAY=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.user:19330 Archived-At: --jj6wVyNre8Bv0yYY Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, thanks for the answers. On 2023-11-28 01:51:46 +0100, Maxime Devos wrote: > (set! copy-file improved-copy-file) >=20 > This replacement 100% functioning assumes no inlining, nobody capturing t= he > old copy-file on the top-level, nobody calling the C function directly ... In that case this is what I will use. There should be no fundamental probl= em if some case will be missed, since I am doing performance optimization only, correctness is not affected. >=20 > If the original copy-file is implemented in Scheme, then to avoid inlining > problems, the module defining copy-file should do >=20 > (set! copy-file copy-file). It looks like it is defined inside libguile/filesys.c, so that is not an op= tion. And I would like to avoid patching the Guile itself anyway. >=20 > That way, Guile's compiler/optimizer knows that the binding is mutable and > should not inlined (well, Guile being Guile, every binding is mutable, but > now it is mutable from the perspective of the inliner too). Interesting, is there a way to do the same hint from the C code? Would the= re be a reason? I assume C code cannot be inlined anyway, so there is no need? >=20 > Depending on whether 'copy-file' is just a stand-in for something else and > depending on how the better copy-file works/how it is =E2=80=98better=E2= =80=99, it might be > better to eventually write a patch to replace copy-file with the improved > better-file, as then the improved copy-file is more widely available. (As= a > long-term thing; for short-term =E2=80=98trying things out=E2=80=99, doin= g set! is much more > practical.) What I want to do is to replace (copy-file oldfile newfile) by modified ver= sion with signature (copy-file oldfile newfile [reflink]) with reflink defaultin= g to 'auto (see man cp for details). I expect this to be a somewhat controversial change, so I did not intend to= send a patch, however I can, if you think it has a chance of getting merged. Tomas --=20 There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors. --jj6wVyNre8Bv0yYY Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEt4NJs4wUfTYpiGikL7/ufbZ/wakFAmVlREsACgkQL7/ufbZ/ wak0jQ//VkhQR1eSTU7rDdz1zOobH1j62InIIsLHhIW1CbpGFMNvcy/8REbaj4hd QO9g/QA1SmuU7dAkwHxNEj1RH/UymUZDtB7Kbxh7ARo+dI9VT6zFRpQDY2EkZimQ d/lGsx61wB3wD4b5KlhO/tBd6RDBspiWYcIakACgyW1W9y3zAui+JASnmTT3lA7T RvtTAYlaMLYXfVedjJSwiCNd3rEutJBkxJj1b8/hFVpX34pZQxyXul+Ztjjpb/36 a28UPDQh6EAuxBn0/buQxPjt/bKqgARr4mWeCYXadqehjAtn3MyDM2U5Wo1U0gRT zpwiKK9aQdxQuYz1InHC7vr9LLphl9PYxnZjwvWHOBcW0U9pi4bE4PQDQyWtR2dN OyDqowSoTNOtuErY1Zc7Fb7XfXUOG81rvWYSBBPWWJKPCcDG9mk9Ha02be/CGF23 eR3DO8M9MuRvSrxmQkxP2DNv8ecV/b1F0ntxa9WiggyCTdm+S74+49QkF7JjYZTg ObtpbdEzDpOEfa607qMUtN8DikEHA+ExvpK5JU5CJUyXdHWXurvuQaoCR9AoMMGH i66Ys8VodJa3w5fsM/CDhu+EWh3GkplfRML812+ekkNWZLsnrtNX4pJHduMb6wMR hdlZdWYlluun5qRBqPeSp87UCzIwgHe6QA2ZAbQ/oXja8YMSnLQ= =X39T -----END PGP SIGNATURE----- --jj6wVyNre8Bv0yYY--