From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.devel Subject: Re: Minor simplification in byte-opt.el Date: Mon, 27 Jul 2020 11:38:55 +0200 Message-ID: References: Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.15\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_E3D6A14E-CB42-4244-873F-F6D407AEDC3D" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12588"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jul 27 11:39:37 2020 Return-path: Envelope-to: ged-emacs-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 1jzzbd-0003AO-7j for ged-emacs-devel@m.gmane-mx.org; Mon, 27 Jul 2020 11:39:37 +0200 Original-Received: from localhost ([::1]:47272 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jzzbc-0001zi-Am for ged-emacs-devel@m.gmane-mx.org; Mon, 27 Jul 2020 05:39:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36774) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jzzb6-0001aJ-TK for emacs-devel@gnu.org; Mon, 27 Jul 2020 05:39:05 -0400 Original-Received: from mail157c50.megamailservers.eu ([91.136.10.167]:37216 helo=mail51c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jzzb3-0004xz-WA for emacs-devel@gnu.org; Mon, 27 Jul 2020 05:39:04 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1595842738; bh=w7vk1iAjWDRypwTQfIJ3Y3xXSLLLY8ui5DorCPWCVw8=; h=From:Subject:Date:In-Reply-To:Cc:To:References:From; b=dL7R9rxmfzUXmDKQ+2UBVdrEi5anB4ccbx4/e7bz0twauby9v/lei310Yg9bqxqvF m9TiCc8m05ULEdRBjCG0UqLyb/POJJzjd6IbvQwAaFe7pELIb1Ul16BnX1MM0LGY1u e36eGSAGRHL8vOrmEaqAMcmbmHmoDI0+d2rWGf0Q= Feedback-ID: mattiase@acm.or Original-Received: from stanniol.lan (c-4e4ae655.032-75-73746f71.bbcust.telenor.se [85.230.74.78]) (authenticated bits=0) by mail51c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 06R9ctpr023792; Mon, 27 Jul 2020 09:38:58 +0000 In-Reply-To: X-Mailer: Apple Mail (2.3445.104.15) X-CTCH-RefID: str=0001.0A782F1E.5F1EA0B2.0094:SCFSTAT68638221, ss=1, re=-4.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: -4.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=MOMeZ/Rl c=1 sm=1 tr=0 a=klNLuyVZdLUgl+K5Uafb2A==:117 a=klNLuyVZdLUgl+K5Uafb2A==:17 a=M51BFTxLslgA:10 a=iRZporoAAAAA:8 a=ZUSPYbSOhzin8dP4HPsA:9 a=CjuIK1q_8ugA:10 a=BSGXyeBuzAYpsmw6OykA:9 a=B2y7HmGcmWMA:10 a=NOBgFS-JBQ2l-kSd6-zu:22 Received-SPF: softfail client-ip=91.136.10.167; envelope-from=mattiase@acm.org; helo=mail51c50.megamailservers.eu X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/27 05:38:59 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x (no timestamps) [generic] X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665, URIBL_BLOCKED=0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:253284 Archived-At: --Apple-Mail=_E3D6A14E-CB42-4244-873F-F6D407AEDC3D Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii 26 juli 2020 kl. 22.41 skrev Stefan Monnier : > Could someone look over the patch below to confirm it's safe? Thank you, looks decent to me. Good that you spotted the 1+/1-, I forgot = about those. > Also, as a result of this, there is only one call to > `byte-optimize-form-code-walker` left, in `byte-optimize-form`, so = maybe > the two functions could be merged, tho it's probably not worth the = trouble. Maybe -- there seems to be little to gain from integrating them other = than the elimination of the function call. By the way, what about this little improvement? --Apple-Mail=_E3D6A14E-CB42-4244-873F-F6D407AEDC3D Content-Disposition: attachment; filename=0001-Simplify-and-streamline-optimizer-clauses.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Simplify-and-streamline-optimizer-clauses.patch" Content-Transfer-Encoding: quoted-printable =46rom=20cc6cbb304193c62354d3cb6b0b76f8ce066b2189=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Mon,=2027=20Jul=202020=2011:27:00=20+0200=0A= Subject:=20[PATCH]=20Simplify=20and=20streamline=20optimizer=20clauses=0A= =0A*=20lisp/emacs-lisp/byte-opt.el=20(byte-optimize-form-code-walker):=0A= Remove=20clause=20for=20'with-output-to-temp-buffer',=20since=20it=20is=20= a=0Amacro=20and=20will=20have=20been=20expanded=20before=20reaching=20= this=20point.=0AMove=20clauses=20for=20'lambda'=20and=20'closure'=20to=20= avoid=20splitting=0Aa=20cond=20jump=20table.=0A---=0A=20= lisp/emacs-lisp/byte-opt.el=20|=2023=20+++++++++--------------=0A=201=20= file=20changed,=209=20insertions(+),=2014=20deletions(-)=0A=0Adiff=20= --git=20a/lisp/emacs-lisp/byte-opt.el=20b/lisp/emacs-lisp/byte-opt.el=0A= index=206f801be545..48efff911f=20100644=0A---=20= a/lisp/emacs-lisp/byte-opt.el=0A+++=20b/lisp/emacs-lisp/byte-opt.el=0A@@=20= -391,13=20+391,6=20@@=20byte-optimize-form-code-walker=0A=20=09=20=20=20= (and=20(nth=201=20form)=0A=20=09=09(not=20for-effect)=0A=20=09=09form))=0A= -=09=20=20((eq=20(car-safe=20fn)=20'lambda)=0A-=09=20=20=20(let=20= ((newform=20(byte-compile-unfold-lambda=20form)))=0A-=09=20=20=20=20=20= (if=20(eq=20newform=20form)=0A-=09=09=20;;=20Some=20error=20occurred,=20= avoid=20infinite=20recursion=0A-=09=09=20form=0A-=09=20=20=20=20=20=20=20= (byte-optimize-form-code-walker=20newform=20for-effect))))=0A-=09=20=20= ((eq=20(car-safe=20fn)=20'closure)=20form)=0A=20=09=20=20((memq=20fn=20= '(let=20let*))=0A=20=09=20=20=20;;=20recursively=20enter=20the=20= optimizer=20for=20the=20bindings=20and=20body=0A=20=09=20=20=20;;=20of=20= a=20let=20or=20let*.=20=20This=20for=20depth-firstness:=20forms=20that=0A= @@=20-444,13=20+437,6=20@@=20byte-optimize-form-code-walker=0A=20=09=20=20= =20;;=20will=20be=20optimized=20away=20in=20the=20lap-optimize=20pass.=0A= =20=09=20=20=20(cons=20fn=20(byte-optimize-body=20(cdr=20form)=20= for-effect)))=0A=20=0A-=09=20=20((eq=20fn=20'with-output-to-temp-buffer)=0A= -=09=20=20=20;;=20this=20is=20just=20like=20the=20above,=20except=20for=20= the=20first=20argument.=0A-=09=20=20=20(cons=20fn=0A-=09=20=20=20=20=20= (cons=0A-=09=20=20=20=20=20=20(byte-optimize-form=20(nth=201=20form)=20= nil)=0A-=09=20=20=20=20=20=20(byte-optimize-body=20(cdr=20(cdr=20form))=20= for-effect))))=0A-=0A=20=09=20=20((eq=20fn=20'if)=0A=20=09=20=20=20(when=20= (<=20(length=20form)=203)=0A=20=09=20=20=20=20=20(byte-compile-warn=20= "too=20few=20arguments=20for=20`if'"))=0A@@=20-530,6=20+516,15=20@@=20= byte-optimize-form-code-walker=0A=20=20=20=20=20=20=20=20=20=20=20;;=20= Needed=20as=20long=20as=20we=20run=20byte-optimize-form=20after=20cconv.=0A= =20=20=20=20=20=20=20=20=20=20=20((eq=20fn=20'internal-make-closure)=20= form)=0A=20=0A+=09=20=20((eq=20(car-safe=20fn)=20'lambda)=0A+=09=20=20=20= (let=20((newform=20(byte-compile-unfold-lambda=20form)))=0A+=09=20=20=20=20= =20(if=20(eq=20newform=20form)=0A+=09=09=20;;=20Some=20error=20occurred,=20= avoid=20infinite=20recursion=0A+=09=09=20form=0A+=09=20=20=20=20=20=20=20= (byte-optimize-form-code-walker=20newform=20for-effect))))=0A+=0A+=09=20=20= ((eq=20(car-safe=20fn)=20'closure)=20form)=0A+=0A=20=20=20=20=20=20=20=20= =20=20=20((byte-code-function-p=20fn)=0A=20=20=20=20=20=20=20=20=20=20=20= =20(cons=20fn=20(mapcar=20#'byte-optimize-form=20(cdr=20form))))=0A=20=0A= --=20=0A2.21.1=20(Apple=20Git-122.3)=0A=0A= --Apple-Mail=_E3D6A14E-CB42-4244-873F-F6D407AEDC3D--