From unknown Sun Jul 27 05:17:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#39709: 28.0.50; [PATCH] substring and the byte compiler Resent-From: Mark Oteiza Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 21 Feb 2020 06:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 39709 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 39709@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.158226613531830 (code B ref -1); Fri, 21 Feb 2020 06:23:02 +0000 Received: (at submit) by debbugs.gnu.org; 21 Feb 2020 06:22:15 +0000 Received: from localhost ([127.0.0.1]:46276 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j51hW-0008HK-UV for submit@debbugs.gnu.org; Fri, 21 Feb 2020 01:22:15 -0500 Received: from lists.gnu.org ([209.51.188.17]:48952) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j51hU-0008HB-EN for submit@debbugs.gnu.org; Fri, 21 Feb 2020 01:22:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33611) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j51hS-0004Sg-Vy for bug-gnu-emacs@gnu.org; Fri, 21 Feb 2020 01:22:12 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j51hR-0006yU-F7 for bug-gnu-emacs@gnu.org; Fri, 21 Feb 2020 01:22:10 -0500 Received: from mail-qv1-xf2f.google.com ([2607:f8b0:4864:20::f2f]:42883) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j51hR-0006oT-22 for bug-gnu-emacs@gnu.org; Fri, 21 Feb 2020 01:22:09 -0500 Received: by mail-qv1-xf2f.google.com with SMTP id dc14so548167qvb.9 for ; Thu, 20 Feb 2020 22:22:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=udel-edu.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:mime-version; bh=upQU0pEWO2I0Y4Bnyzqip36hjjbYtgNlB5QXBF7Fzio=; b=J7zoPh1m7pvKi2GpttGZqsjgpWQnaMh/pXq8zZWlSigSwcgr1MVjyWNNMeJXfUO6/B 9JJpEA8EpbYLKDuwAAXfRHb3X5TE7hHGo1wlN73S+BtjrdFUAwAbq8g10oUA3vclrDB1 ncj/89GJbhDVv22nfreZh4K8XYT1kKpffqyoyF5zm3s+ciwbUiWlELzBFdf3mIlSw318 wBWcqfmbgW11hur2hnynmFu5pPP8ogX+x1ilAxskvoeqX8+zd2RPC9FLcGkRBmiw2zMa J48YOCVL5sAKSceJQbH6GTQVEC2naW4uqQLSy+CqrI0gX1eyOEvjz4fYnPQueSFc4Z+V ukcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=upQU0pEWO2I0Y4Bnyzqip36hjjbYtgNlB5QXBF7Fzio=; b=SjiGH+TOIkd0Q6kil/T/bWGX1XvqyzJp0XthLAiOx34vF4eh2whBu1J8lsy+7BgGY/ jd4ftluZ+fo6evvvC+rN17M6Ach66kMuV4D8ZPg4kB6HflwgNFAxHMlizJRzM8UZPTR+ hD7kiQyp4xyZqBpYBcabAinOKntrdXdtHMtvSwFTzNvexLUVUqbBRvobc60NVw0kQ8L3 vIrojIVeQUzAxPt6H2z/ctEqACPwpg8u62jy5SQRQ+ita0yw8P3dMhjEslkR4es4+3Qs qUqvqAtY2mqtU+FC1S+dXl66Mss16DVhEdSCBdY8Nr2VPF+ZWY8V9xHi7ysGGq1CAZjy xcLA== X-Gm-Message-State: APjAAAVpnm8uX59qoJLYn7rNUsrrFn2gOkiSo8IvmH6QKqRNavEKYfHY 8kt3GnSeQNdMvBaiikExvYbfUE0IuXM= X-Google-Smtp-Source: APXvYqxMsQimrN+5vlHkFNX2tZVMS0wjm4DDCu/AMEmjYiat3PwJ5SXxJJVDP9pqmckb9xH8lkTdWg== X-Received: by 2002:a0c:ab8f:: with SMTP id j15mr28882275qvb.223.1582266127639; Thu, 20 Feb 2020 22:22:07 -0800 (PST) Received: from holos.localdomain (c-69-251-56-176.hsd1.md.comcast.net. [69.251.56.176]) by smtp.gmail.com with ESMTPSA id x41sm1064677qtj.52.2020.02.20.22.22.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Feb 2020 22:22:07 -0800 (PST) Received: by holos.localdomain (Postfix, from userid 1000) id 8B4C266BE0; Fri, 21 Feb 2020 01:22:06 -0500 (EST) From: Mark Oteiza Date: Fri, 21 Feb 2020 01:22:06 -0500 Message-ID: <87zhdcmpdd.fsf@udel.edu> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::f2f X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi, I don't really understand the byte compiler, but I noticed in disassembly that substring, despite having an opcode, is getting call'd: 10 constant substring 11 stack-ref 3 12 constant 0 13 stack-ref 7 15 call 3 when really I'd expect to see something like 57 stack-ref 2 58 stack-ref 7 60 min 61 stack-ref 7 63 substring The only relevant change I found is bug#33807. Enlightenment welcome. Naive patch below. diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index fce5e4aed6..ec340cd451 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -3506,6 +3506,7 @@ byte-defop-compiler (0-1 . byte-compile-zero-or-one-arg) (1-2 . byte-compile-one-or-two-args) (2-3 . byte-compile-two-or-three-args) + (1-3 . byte-compile-one-to-three-args) ))) compile-handler (intern (concat "byte-compile-" @@ -3690,6 +3691,13 @@ byte-compile-two-or-three-args ((= len 4) (byte-compile-three-args form)) (t (byte-compile-subr-wrong-args form "2-3"))))) +(defun byte-compile-one-to-three-args (form) + (let ((len (length form))) + (cond ((= len 2) (byte-compile-one-arg form)) + ((= len 3) (byte-compile-two-args form)) + ((= len 4) (byte-compile-three-args form)) + (t (byte-compile-subr-wrong-args form "1-3"))))) + (defun byte-compile-noop (_form) (byte-compile-constant nil)) diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index fe0930c684..d3c84335ec 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -1511,11 +1511,11 @@ byte-compile-side-effect-and-error-free-ops (defconst byte-compile-side-effect-free-ops (nconc '(byte-varref byte-nth byte-memq byte-car byte-cdr byte-length byte-aref - byte-symbol-value byte-get byte-concat2 byte-concat3 byte-sub1 byte-add1 - byte-eqlsign byte-gtr byte-lss byte-leq byte-geq byte-diff byte-negate - byte-plus byte-max byte-min byte-mult byte-char-after byte-char-syntax - byte-buffer-substring byte-string= byte-string< byte-nthcdr byte-elt - byte-member byte-assq byte-quo byte-rem) + byte-symbol-value byte-get byte-substring byte-concat2 byte-concat3 + byte-sub1 byte-add1 byte-eqlsign byte-gtr byte-lss byte-leq byte-geq + byte-diff byte-negate byte-plus byte-max byte-min byte-mult byte-char-after + byte-char-syntax byte-buffer-substring byte-string= byte-string< + byte-nthcdr byte-elt byte-member byte-assq byte-quo byte-rem) byte-compile-side-effect-and-error-free-ops)) ;; This crock is because of the way DEFVAR_BOOL variables work. From unknown Sun Jul 27 05:17:54 2025 X-Loop: help-debbugs@gnu.org Subject: bug#39709: #39709: 28.0.50; [PATCH] substring and the byte compiler References: <87zhdcmpdd.fsf@udel.edu> In-Reply-To: <87zhdcmpdd.fsf@udel.edu> Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 21 Feb 2020 11:49:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39709 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Mark Oteiza Cc: 39709@debbugs.gnu.org, Stefan Monnier Received: via spool by 39709-submit@debbugs.gnu.org id=B39709.15822856968060 (code B ref 39709); Fri, 21 Feb 2020 11:49:01 +0000 Received: (at 39709) by debbugs.gnu.org; 21 Feb 2020 11:48:16 +0000 Received: from localhost ([127.0.0.1]:46470 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j56n1-00025w-Lw for submit@debbugs.gnu.org; Fri, 21 Feb 2020 06:48:15 -0500 Received: from mail1467c50.megamailservers.eu ([91.136.14.67]:35806 helo=mail268c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j56mz-00025i-HE for 39709@debbugs.gnu.org; Fri, 21 Feb 2020 06:48:14 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1582285686; bh=dwKo7ggEMD4btg6+TgPT1vED02JyGJfNd5RfyrTbDxk=; h=From:Subject:Date:Cc:To:From; b=cJ2NfPuiXR8PQ1N5lGD311T/+bJrjSRK1s4hdMr/lo3fhvPKAz13BDEYIfpHxuTxZ 87RhgnTHxSR2wmR5L/30lF7WkGbPoXF6OUecdKe+kXfy1leNyrVTZWM12Msu29d2/e hymES0HYwVioViOA/nP3hwcPW/KcnXzxyoPiIZF4= Feedback-ID: mattiase@acm.or Received: from stanniol.lan (c-6f4fe655.032-75-73746f71.bbcust.telenor.se [85.230.79.111]) (authenticated bits=0) by mail268c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 01LBm2tT006612; Fri, 21 Feb 2020 11:48:04 +0000 From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Content-Type: multipart/mixed; boundary="Apple-Mail=_6BF09137-FAFC-43FE-8E41-91250EF08735" Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Message-Id: Date: Fri, 21 Feb 2020 12:48:01 +0100 X-Mailer: Apple Mail (2.3445.104.11) X-CTCH-RefID: str=0001.0A0B0212.5E4FC376.0028, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=J53UEzvS c=1 sm=1 tr=0 a=fHaj9vQUQVKQ4sUldAaXuQ==:117 a=fHaj9vQUQVKQ4sUldAaXuQ==:17 a=mH-Mn3afZmEA:10 a=M51BFTxLslgA:10 a=_eUHPonvJK-qHF4CvkgA:9 a=CjuIK1q_8ugA:10 a=cFeDVpgumuDKt5Z1JRkA:9 a=B2y7HmGcmWMA:10 X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: The missing 1-3 case seems to be a simple omission -- thanks for spotting it. +(defun byte-compile-one-to-three-args (form) + (let ((len (length form))) + (cond ((= len 2) (byte-compile-one-arg form)) + ((= len 3) (byte-compile-two-args form)) + ((= len 4) (byte-compile-three-a [...] Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: megamailservers.eu] 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.3 KHOP_HELO_FCRDNS Relay HELO differs from its IP's reverse DNS X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) --Apple-Mail=_6BF09137-FAFC-43FE-8E41-91250EF08735 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii The missing 1-3 case seems to be a simple omission -- thanks for = spotting it. +(defun byte-compile-one-to-three-args (form) + (let ((len (length form))) + (cond ((=3D len 2) (byte-compile-one-arg form)) + ((=3D len 3) (byte-compile-two-args form)) + ((=3D len 4) (byte-compile-three-args form)) + (t (byte-compile-subr-wrong-args form "1-3"))))) Not sure how this would work. Don't you need to add the missing = arguments? Cleaned-up patch attached. (Unless, of course, there is evidence that the byte op has never been = emitted --- then we have an opportunity to drop it instead.) --Apple-Mail=_6BF09137-FAFC-43FE-8E41-91250EF08735 Content-Disposition: attachment; filename=0001-Generate-substring-byte-op-bug-39709.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Generate-substring-byte-op-bug-39709.patch" Content-Transfer-Encoding: quoted-printable =46rom=20c7163d7a23f124b7bca611615e42a23e2987bd4d=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20=3D?UTF-8?q?Mattias=3D20Engdeg=3DC3=3DA5rd?=3D=20= =0ADate:=20Fri,=2021=20Feb=202020=2012:16:20=20+0100=0A= Subject:=20[PATCH]=20Generate=20'substring'=20byte=20op=20(bug#39709)=0A=0A= The=20'substring'=20byte=20op=20was=20not=20emitted,=20apparently=20by=20= mistake.=20=20Fix.=0ASuggested=20by=20Mark=20Oteiza=20= .=0A=0A*=20lisp/emacs-lisp/bytecomp.el=20= (byte-defop-compiler):=20Add=20'1-3'=20clause.=0A= (byte-compile-one-to-three-args):=20New.=0A*=20= lisp/emacs-lisp/byte-opt.el=20(byte-compile-side-effect-free-ops):=0AAdd=20= 'byte-substring'.=0A*=20test/lisp/emacs-lisp/bytecomp-tests.el=0A= (byte-opt-testsuite-arith-data):=20Test=20'substring'.=0A---=0A=20= lisp/emacs-lisp/byte-opt.el=20=20=20=20=20=20=20=20=20=20=20=20|=20=202=20= +-=0A=20lisp/emacs-lisp/bytecomp.el=20=20=20=20=20=20=20=20=20=20=20=20|=20= 10=20+++++++++-=0A=20test/lisp/emacs-lisp/bytecomp-tests.el=20|=20=207=20= ++++++-=0A=203=20files=20changed,=2016=20insertions(+),=203=20= deletions(-)=0A=0Adiff=20--git=20a/lisp/emacs-lisp/byte-opt.el=20= b/lisp/emacs-lisp/byte-opt.el=0Aindex=20fe0930c684..4f72251aed=20100644=0A= ---=20a/lisp/emacs-lisp/byte-opt.el=0A+++=20= b/lisp/emacs-lisp/byte-opt.el=0A@@=20-1515,7=20+1515,7=20@@=20= byte-compile-side-effect-free-ops=0A=20=20=20=20=20=20byte-eqlsign=20= byte-gtr=20byte-lss=20byte-leq=20byte-geq=20byte-diff=20byte-negate=0A=20= =20=20=20=20=20byte-plus=20byte-max=20byte-min=20byte-mult=20= byte-char-after=20byte-char-syntax=0A=20=20=20=20=20=20= byte-buffer-substring=20byte-string=3D=20byte-string<=20byte-nthcdr=20= byte-elt=0A-=20=20=20=20=20byte-member=20byte-assq=20byte-quo=20= byte-rem)=0A+=20=20=20=20=20byte-member=20byte-assq=20byte-quo=20= byte-rem=20byte-substring)=0A=20=20=20=20= byte-compile-side-effect-and-error-free-ops))=0A=20=0A=20;;=20This=20= crock=20is=20because=20of=20the=20way=20DEFVAR_BOOL=20variables=20work.=0A= diff=20--git=20a/lisp/emacs-lisp/bytecomp.el=20= b/lisp/emacs-lisp/bytecomp.el=0Aindex=20fce5e4aed6..6a2ee978af=20100644=0A= ---=20a/lisp/emacs-lisp/bytecomp.el=0A+++=20= b/lisp/emacs-lisp/bytecomp.el=0A@@=20-3487,7=20+3487,7=20@@=20= byte-defop-compiler=0A=20is=20the=20function=20and=20the=20second=20= element=20is=20the=20bytecode-symbol.=0A=20The=20second=20element=20may=20= be=20nil,=20meaning=20there=20is=20no=20opcode.=0A=20COMPILE-HANDLER=20= is=20the=20function=20to=20use=20to=20compile=20this=20byte-op,=20or=0A= -may=20be=20the=20abbreviations=200,=201,=202,=203,=200-1,=20or=201-2.=0A= +may=20be=20the=20abbreviations=200,=201,=202,=203,=200-1,=201-2,=201-3,=20= 2-3,=20or=202-and.=0A=20If=20it=20is=20nil,=20then=20the=20handler=20is=20= \"byte-compile-SYMBOL.\""=0A=20=20=20(let=20(opcode)=0A=20=20=20=20=20= (if=20(symbolp=20function)=0A@@=20-3506,6=20+3506,7=20@@=20= byte-defop-compiler=0A=20=09=09=09=09=09(0-1=20.=20= byte-compile-zero-or-one-arg)=0A=20=09=09=09=09=09(1-2=20.=20= byte-compile-one-or-two-args)=0A=20=09=09=09=09=09(2-3=20.=20= byte-compile-two-or-three-args)=0A+=09=09=09=09=09(1-3=20.=20= byte-compile-one-to-three-args)=0A=20=09=09=09=09=09)))=0A=20=09=09=09=20= =20=20compile-handler=0A=20=09=09=09=20=20=20(intern=20(concat=20= "byte-compile-"=0A@@=20-3690,6=20+3691,13=20@@=20= byte-compile-two-or-three-args=0A=20=09=20=20((=3D=20len=204)=20= (byte-compile-three-args=20form))=0A=20=09=20=20(t=20= (byte-compile-subr-wrong-args=20form=20"2-3")))))=0A=20=0A+(defun=20= byte-compile-one-to-three-args=20(form)=0A+=20=20(let=20((len=20(length=20= form)))=0A+=20=20=20=20(cond=20((=3D=20len=202)=20= (byte-compile-three-args=20(append=20form=20'(nil=20nil))))=0A+=20=20=20=20= =20=20=20=20=20=20((=3D=20len=203)=20(byte-compile-three-args=20(append=20= form=20'(nil))))=0A+=20=20=20=20=20=20=20=20=20=20((=3D=20len=204)=20= (byte-compile-three-args=20form))=0A+=20=20=20=20=20=20=20=20=20=20(t=20= (byte-compile-subr-wrong-args=20form=20"1-3")))))=0A+=0A=20(defun=20= byte-compile-noop=20(_form)=0A=20=20=20(byte-compile-constant=20nil))=0A=20= =0Adiff=20--git=20a/test/lisp/emacs-lisp/bytecomp-tests.el=20= b/test/lisp/emacs-lisp/bytecomp-tests.el=0Aindex=20= de11ae22d5..d4ceb47c36=20100644=0A---=20= a/test/lisp/emacs-lisp/bytecomp-tests.el=0A+++=20= b/test/lisp/emacs-lisp/bytecomp-tests.el=0A@@=20-347,7=20+347,12=20@@=20= byte-opt-testsuite-arith-data=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20((eq=20x=20't)=20= 99)=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20(t=20999))))=0A=20=20=20=20=20=20=20=20=20=20= =20=20=20'((a=20c)=20(b=20c)=20(7=20c)=20(-3=20c)=20(nil=20nil)=20(t=20= c)=20(q=20c)=20(r=20c)=20(s=20c)=0A-=20=20=20=20=20=20=20=20=20=20=20=20=20= =20(t=20c)=20(x=20"a")=20(x=20"c")=20(x=20c)=20(x=20d)=20(x=20e))))=0A+=20= =20=20=20=20=20=20=20=20=20=20=20=20=20(t=20c)=20(x=20"a")=20(x=20"c")=20= (x=20c)=20(x=20d)=20(x=20e)))=0A+=0A+=20=20=20=20;;=20`substring'=20= bytecode=20generation=20(bug#39709).=0A+=20=20=20=20(substring=20= "abcdef")=0A+=20=20=20=20(substring=20"abcdef"=202)=0A+=20=20=20=20= (substring=20"abcdef"=203=202))=0A=20=20=20"List=20of=20expression=20for=20= test.=0A=20Each=20element=20will=20be=20executed=20by=20interpreter=20= and=20with=0A=20bytecompiled=20code,=20and=20their=20results=20= compared.")=0A--=20=0A2.21.1=20(Apple=20Git-122.3)=0A=0A= --Apple-Mail=_6BF09137-FAFC-43FE-8E41-91250EF08735-- From unknown Sun Jul 27 05:17:54 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Mark Oteiza Subject: bug#39709: closed (Re: #39709: 28.0.50; [PATCH] substring and the byte compiler) Message-ID: References: <24CAAE43-91D7-42EA-A88C-D3D53DEA3F23@acm.org> <87zhdcmpdd.fsf@udel.edu> X-Gnu-PR-Message: they-closed 39709 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 39709@debbugs.gnu.org Date: Tue, 25 Feb 2020 15:43:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1582645382-18919-1" This is a multi-part message in MIME format... ------------=_1582645382-18919-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #39709: 28.0.50; [PATCH] substring and the byte compiler which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 39709@debbugs.gnu.org. --=20 39709: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D39709 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1582645382-18919-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 39709-done) by debbugs.gnu.org; 25 Feb 2020 15:42:36 +0000 Received: from localhost ([127.0.0.1]:55999 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j6cM0-0004uX-9B for submit@debbugs.gnu.org; Tue, 25 Feb 2020 10:42:36 -0500 Received: from mail151c50.megamailservers.eu ([91.136.10.161]:57608 helo=mail50c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j6cLy-0004uN-8w for 39709-done@debbugs.gnu.org; Tue, 25 Feb 2020 10:42:35 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1582645352; bh=lawR61PyG0lBQX0PYSsR2pw7mymoxG/KecAzDcOhaEs=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=GTnof7u7KslBgNTXBeOAuHvtgdl7fySzCjoWQaGb6QcZgtjwTOlV2Zbqaz8CmnXrC xX399KjZtUU5bumacnDqHeYUGRYz2AT5YD8RQqF7UviIgebugI9WEDKKKMw1/q6txf cOVybrxEZ4jHW8pvOevxlhhoQp8Ehc3udJc8ypBI= Feedback-ID: mattiase@acm.or Received: from stanniol.lan (c-6f4fe655.032-75-73746f71.bbcust.telenor.se [85.230.79.111]) (authenticated bits=0) by mail50c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 01PFgS9O031000; Tue, 25 Feb 2020 15:42:30 +0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: #39709: 28.0.50; [PATCH] substring and the byte compiler From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= In-Reply-To: Date: Tue, 25 Feb 2020 16:42:28 +0100 Content-Transfer-Encoding: 7bit Message-Id: <24CAAE43-91D7-42EA-A88C-D3D53DEA3F23@acm.org> References: To: Mark Oteiza X-Mailer: Apple Mail (2.3445.104.11) X-CTCH-RefID: str=0001.0A0B020E.5E554068.0016, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Rules: X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=N4FX6F1B c=1 sm=1 tr=0 a=fHaj9vQUQVKQ4sUldAaXuQ==:117 a=fHaj9vQUQVKQ4sUldAaXuQ==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=mH-Mn3afZmEA:10 a=M51BFTxLslgA:10 a=x6KTh5m2-pX-4PUgv08A:9 a=CjuIK1q_8ugA:10 X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: No objection arrived -- pushed to master. Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: megamailservers.eu] 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.3 KHOP_HELO_FCRDNS Relay HELO differs from its IP's reverse DNS X-Debbugs-Envelope-To: 39709-done Cc: 39709-done@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) No objection arrived -- pushed to master. ------------=_1582645382-18919-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 21 Feb 2020 06:22:15 +0000 Received: from localhost ([127.0.0.1]:46276 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j51hW-0008HK-UV for submit@debbugs.gnu.org; Fri, 21 Feb 2020 01:22:15 -0500 Received: from lists.gnu.org ([209.51.188.17]:48952) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j51hU-0008HB-EN for submit@debbugs.gnu.org; Fri, 21 Feb 2020 01:22:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33611) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j51hS-0004Sg-Vy for bug-gnu-emacs@gnu.org; Fri, 21 Feb 2020 01:22:12 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j51hR-0006yU-F7 for bug-gnu-emacs@gnu.org; Fri, 21 Feb 2020 01:22:10 -0500 Received: from mail-qv1-xf2f.google.com ([2607:f8b0:4864:20::f2f]:42883) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j51hR-0006oT-22 for bug-gnu-emacs@gnu.org; Fri, 21 Feb 2020 01:22:09 -0500 Received: by mail-qv1-xf2f.google.com with SMTP id dc14so548167qvb.9 for ; Thu, 20 Feb 2020 22:22:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=udel-edu.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:mime-version; bh=upQU0pEWO2I0Y4Bnyzqip36hjjbYtgNlB5QXBF7Fzio=; b=J7zoPh1m7pvKi2GpttGZqsjgpWQnaMh/pXq8zZWlSigSwcgr1MVjyWNNMeJXfUO6/B 9JJpEA8EpbYLKDuwAAXfRHb3X5TE7hHGo1wlN73S+BtjrdFUAwAbq8g10oUA3vclrDB1 ncj/89GJbhDVv22nfreZh4K8XYT1kKpffqyoyF5zm3s+ciwbUiWlELzBFdf3mIlSw318 wBWcqfmbgW11hur2hnynmFu5pPP8ogX+x1ilAxskvoeqX8+zd2RPC9FLcGkRBmiw2zMa J48YOCVL5sAKSceJQbH6GTQVEC2naW4uqQLSy+CqrI0gX1eyOEvjz4fYnPQueSFc4Z+V ukcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=upQU0pEWO2I0Y4Bnyzqip36hjjbYtgNlB5QXBF7Fzio=; b=SjiGH+TOIkd0Q6kil/T/bWGX1XvqyzJp0XthLAiOx34vF4eh2whBu1J8lsy+7BgGY/ jd4ftluZ+fo6evvvC+rN17M6Ach66kMuV4D8ZPg4kB6HflwgNFAxHMlizJRzM8UZPTR+ hD7kiQyp4xyZqBpYBcabAinOKntrdXdtHMtvSwFTzNvexLUVUqbBRvobc60NVw0kQ8L3 vIrojIVeQUzAxPt6H2z/ctEqACPwpg8u62jy5SQRQ+ita0yw8P3dMhjEslkR4es4+3Qs qUqvqAtY2mqtU+FC1S+dXl66Mss16DVhEdSCBdY8Nr2VPF+ZWY8V9xHi7ysGGq1CAZjy xcLA== X-Gm-Message-State: APjAAAVpnm8uX59qoJLYn7rNUsrrFn2gOkiSo8IvmH6QKqRNavEKYfHY 8kt3GnSeQNdMvBaiikExvYbfUE0IuXM= X-Google-Smtp-Source: APXvYqxMsQimrN+5vlHkFNX2tZVMS0wjm4DDCu/AMEmjYiat3PwJ5SXxJJVDP9pqmckb9xH8lkTdWg== X-Received: by 2002:a0c:ab8f:: with SMTP id j15mr28882275qvb.223.1582266127639; Thu, 20 Feb 2020 22:22:07 -0800 (PST) Received: from holos.localdomain (c-69-251-56-176.hsd1.md.comcast.net. [69.251.56.176]) by smtp.gmail.com with ESMTPSA id x41sm1064677qtj.52.2020.02.20.22.22.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Feb 2020 22:22:07 -0800 (PST) Received: by holos.localdomain (Postfix, from userid 1000) id 8B4C266BE0; Fri, 21 Feb 2020 01:22:06 -0500 (EST) From: Mark Oteiza To: bug-gnu-emacs@gnu.org Subject: 28.0.50; [PATCH] substring and the byte compiler Date: Fri, 21 Feb 2020 01:22:06 -0500 Message-ID: <87zhdcmpdd.fsf@udel.edu> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::f2f X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi, I don't really understand the byte compiler, but I noticed in disassembly that substring, despite having an opcode, is getting call'd: 10 constant substring 11 stack-ref 3 12 constant 0 13 stack-ref 7 15 call 3 when really I'd expect to see something like 57 stack-ref 2 58 stack-ref 7 60 min 61 stack-ref 7 63 substring The only relevant change I found is bug#33807. Enlightenment welcome. Naive patch below. diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index fce5e4aed6..ec340cd451 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -3506,6 +3506,7 @@ byte-defop-compiler (0-1 . byte-compile-zero-or-one-arg) (1-2 . byte-compile-one-or-two-args) (2-3 . byte-compile-two-or-three-args) + (1-3 . byte-compile-one-to-three-args) ))) compile-handler (intern (concat "byte-compile-" @@ -3690,6 +3691,13 @@ byte-compile-two-or-three-args ((= len 4) (byte-compile-three-args form)) (t (byte-compile-subr-wrong-args form "2-3"))))) +(defun byte-compile-one-to-three-args (form) + (let ((len (length form))) + (cond ((= len 2) (byte-compile-one-arg form)) + ((= len 3) (byte-compile-two-args form)) + ((= len 4) (byte-compile-three-args form)) + (t (byte-compile-subr-wrong-args form "1-3"))))) + (defun byte-compile-noop (_form) (byte-compile-constant nil)) diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index fe0930c684..d3c84335ec 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -1511,11 +1511,11 @@ byte-compile-side-effect-and-error-free-ops (defconst byte-compile-side-effect-free-ops (nconc '(byte-varref byte-nth byte-memq byte-car byte-cdr byte-length byte-aref - byte-symbol-value byte-get byte-concat2 byte-concat3 byte-sub1 byte-add1 - byte-eqlsign byte-gtr byte-lss byte-leq byte-geq byte-diff byte-negate - byte-plus byte-max byte-min byte-mult byte-char-after byte-char-syntax - byte-buffer-substring byte-string= byte-string< byte-nthcdr byte-elt - byte-member byte-assq byte-quo byte-rem) + byte-symbol-value byte-get byte-substring byte-concat2 byte-concat3 + byte-sub1 byte-add1 byte-eqlsign byte-gtr byte-lss byte-leq byte-geq + byte-diff byte-negate byte-plus byte-max byte-min byte-mult byte-char-after + byte-char-syntax byte-buffer-substring byte-string= byte-string< + byte-nthcdr byte-elt byte-member byte-assq byte-quo byte-rem) byte-compile-side-effect-and-error-free-ops)) ;; This crock is because of the way DEFVAR_BOOL variables work. ------------=_1582645382-18919-1--