From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?UTF-8?Q?Linus_Bj=C3=B6rnstam?= Newsgroups: gmane.lisp.guile.devel,gmane.lisp.guile.user Subject: Re: Prevent inlining Date: Wed, 12 Feb 2020 22:49:58 +0100 Message-ID: <941ae97e-169a-4ab2-991f-f9ecf97e8845@www.fastmail.com> References: Mime-Version: 1.0 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="13420"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Cyrus-JMAP/3.1.7-802-g7a41c81-fmstable-20200203v1 To: "Stefan Israelsson Tampe" , guile-devel , "Guile User" Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Wed Feb 12 22:50:45 2020 Return-path: Envelope-to: guile-devel@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 1j1zu7-0003Kg-SK for guile-devel@m.gmane-mx.org; Wed, 12 Feb 2020 22:50:44 +0100 Original-Received: from localhost ([::1]:43844 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j1zu6-0002uX-QD for guile-devel@m.gmane-mx.org; Wed, 12 Feb 2020 16:50:42 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53143) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j1ztv-0002tf-Li for guile-devel@gnu.org; Wed, 12 Feb 2020 16:50:32 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j1ztu-0002Lv-Fl for guile-devel@gnu.org; Wed, 12 Feb 2020 16:50:31 -0500 Original-Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:44219) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j1ztu-0002JJ-3E; Wed, 12 Feb 2020 16:50:30 -0500 Original-Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 9CA0DF85; Wed, 12 Feb 2020 16:50:27 -0500 (EST) Original-Received: from imap1 ([10.202.2.51]) by compute3.internal (MEProxy); Wed, 12 Feb 2020 16:50:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=veryfast.biz; h= mime-version:message-id:in-reply-to:references:date:from:to :subject:content-type:content-transfer-encoding; s=fm1; bh=FS7sv 2x8mS1TJaKDrrTggWCJeC/weJxJLpl/dxpdxfs=; b=KWNQDJlvYs+e0dAo9ZgGG f01lnj4GQmxzC80Y+x7zEuHeMjHihqUwPPi2pGy7FoYxcJmxYmRVV7gfDUnmMyG6 2jomb0b9g6Sejeov4aGURQYbR+nqroWGjTTSHA9hzZ/8nmYuQYFqOsANSKtsdrdP ZPKVRJsDm923XtUUEU1UV5LO3XyfAgFfFjR4Ziu3eSODsKSuJmhVgI8Idut0DcS+ XL5MwErPUEoJpC2tSRTKkrIv7ddH89cIUccItYT0kxLD5pDnH7hLr8J4xqsaIq+l dsismqzn78zejZnVTy13bpXxRKekPCprp8I9uyThxGKtO6kRR2TI50kzYTI+s8mX Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=FS7sv2x8mS1TJaKDrrTggWCJeC/weJxJLpl/dxpdx fs=; b=eGAI+V/6k7Ag1ojzFXyp20ZG8B2aTyLwMlnehku1tomFtezt4RpAfr/hd 6cUb7Lw6zl5ODrwin3D5u+FBFv+ifaxuINW/nKKMOyrMkHTGCgxAv4GTEU4cxfBr HTBNpYMrvm6zquU87PrI7w0okfTz2zZuE79ad1Tw5jM97H5hSU6+WkuLAb4D9pM5 sspIp/wJdAc1xIM0UKu6+HjO5Ao308PgeZaHgDVSH5LOpdUVPQR388G3ZhQLi9hR mmH/lZ7W1yh3XMI1746k2CUHsv/EDCrXK8AFzrzeuIEQ6D+5Nee1rStBbNqGiDYY l0OoOsvu7VjTZ6eyqPwEHpNPJ4QJg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrieeigddulecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefofgggkfgjfhffhffvufgtgfesthhqredtreerjeenucfhrhhomhepnfhinhhu shgpuehjnphrnhhsthgrmhcuoehlihhnuhhsrdgsjhhorhhnshhtrghmsehvvghrhihfrg hsthdrsghiiieqnecuffhomhgrihhnpehgnhhurdhorhhgnecuvehluhhsthgvrhfuihii vgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhhinhhushdrsghjohhrnhhsthgrmh esvhgvrhihfhgrshhtrdgsihii X-ME-Proxy: Original-Received: by mailuser.nyi.internal (Postfix, from userid 501) id F2EE6C200A4; Wed, 12 Feb 2020 16:50:26 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 64.147.123.19 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: "guile-devel" Xref: news.gmane.io gmane.lisp.guile.devel:20411 gmane.lisp.guile.user:16168 Archived-At: If guile ever gets cross-module Inlining in even the simplest form, this= will break. This kind of inlining is probably the most secure one to re= ly on ever (my for loops rely on it, for example). A more future proof o= ption is maybe to (set! ...) A variable within the same module, which ma= kes it implicitly boxed. Slow unless guile is able to do unboxing... Ludo used the trick here: http://git.savannah.gnu.org/cgit/guile.git/com= mit/?id=3Dbf1f5422bdb364667d6761dd73454558d6dbf895 --=20 Linus Bj=C3=B6rnstam On Wed, 12 Feb 2020, at 18:44, Stefan Israelsson Tampe wrote: > Hi all, >=20 > Current guile inlines even variables exposed in the module interface,=20= > and I understand that we must live with that and code around it. So=20= > here is a few tips how to mitigate it. >=20 > The simplest way is to put this definition in a module: > ------------------------ > (define-module (syntax not-inline) > #:export (not-inline)) >=20 > (cond-expand > (guile-3.0 > (define (not-inline x) x)) > ((or (guile-2.0 guile-2.2) > (define-syntax-rule (not-inline x) x))) >=20 > ------------------------------------- > And then in another module do, >=20 > (use-modules (syntax not-inline)) > (define variable (not-inline 12)) > (define function (not-inline (lambda () ...))) > etc >=20 > This is also an option (not perfect but you get the gist) >=20 > ----------------------------------------------------------------- > (define-module (syntax define-not-inlinable) > #:use-module (syntax not-inline) > #:export (inline define lambda define* lambda* define-values) > (define inline (lambda (x) x)) > (define-syntax define > (syntax-rules (inline) > ((define (f . x) . code) > (define f (not-inline (lambda x . code))) > ((define f (inline x)) > (define f x)) > ((define f x) > (define f (not-inlinable x)))) > ----------------------------------------------------------------------= ------------ > using this module will make all usual define not inlineable and to=20 > enable inlining you would > explicitly ask for it like >=20 > (define f (inline (lambda (x) (+ x 10)))) >=20 > If there is a need for this I can write the modules and expose it on=20= > the intertubes. >=20 > WDYT >=20 > /Stefan >=20 >=20 >=20 >