From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Help sought: Details of byte-compile-make-closure, please. Date: Tue, 17 May 2022 08:33:09 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23186"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue May 17 15:07:51 2022 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 1nqwvX-0005ni-Cv for ged-emacs-devel@m.gmane-mx.org; Tue, 17 May 2022 15:07:51 +0200 Original-Received: from localhost ([::1]:57238 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nqwvW-00043M-Ar for ged-emacs-devel@m.gmane-mx.org; Tue, 17 May 2022 09:07:50 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53420) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nqwO5-0005Wq-4X for emacs-devel@gnu.org; Tue, 17 May 2022 08:33:17 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:48267) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nqwO2-00036w-Ax for emacs-devel@gnu.org; Tue, 17 May 2022 08:33:15 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 3A14C100442; Tue, 17 May 2022 08:33:12 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id BF1D8100140; Tue, 17 May 2022 08:33:10 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1652790790; bh=I9rYxxMj2Hlgmn8Gkhp63EtpE8iIfsmuubjRqMSWbKk=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=J3fak60tq0Z4pCv+l6oeeQdDvbbIUPUfcanXmv3eCkNI9PB8w0KdOH+TavFglIQP9 zOeqPjv7eWi6oYCqUIzBWuVOs6f2bCyKFULh6vOnImgCyw9trfux96jmyv1wy7X5Zp YFy44ewdT36MBEvdf0HUASCgPQxzB+0rFngYDe4lZyb3v3iQTfwtr+Z3QHfu878/E9 +r2lsTUnqb4rTK/qeo0BePDhBiOuujXnxRci3yA6uxDjoU9gTeSAXD3dhmW/UgI9rT PAW6/BA0KXm2HPLKDEM1ztlODwLeZzaVvcwBAyDwnIE3C6xpVSpvoOcSoIHuGdJ8mT bF3lWKQXfBm9w== Original-Received: from pastel (unknown [45.72.221.51]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 8C15812080B; Tue, 17 May 2022 08:33:10 -0400 (EDT) In-Reply-To: (Alan Mackenzie's message of "Tue, 17 May 2022 09:15:37 +0000") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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:289843 Archived-At: Alan Mackenzie [2022-05-17 09:15:37] wrote: > Whilst fixing bug #55323, I came across more places in the byte compiler > where we might need to strip positions from symbols. [ Sidenote: I don't understand why you'd need to strip the positions manually here. Is it for the `(apply #'make-byte-code ...` case, because your later position-stripping code doesn't recurse within byte-code functions? ] > (i) Does byte-compile-make-closure get called at all when > lexical-binding is nil? No. > (ii) Is the ARG argument to make-byte-code, extracted from the parameter > FORM always in the bit-encoded form (7 bits for minimum args, 7 bits for > maximum args and 1 bit for &rest), or might it sometimes be an "old > fashioned" list of symbols? It's never the "old fashioned" list of symbols, because that's only used for lexical-binding==nil functions as you can see in `byte-compile-lambda` where we do: (apply #'make-byte-code (if lexical-binding (byte-compile-make-args-desc arglist) bare-arglist) > I need to know this because such a list > might need positions stripping from these symbols. Indeed. > (iii) Is there ever a non-null interactive form contained in the > parameter FORM? Usually not, but sometimes yes. > (If so, it comes in in a &rest parameter and is > forwarded to make-byte-code in an &optional argument.) Such an > interactive form may need positions stripping from its symbols too. FWIW, I think that is `byte-compile-lambda` strips the positions then `byte-compile-make-closure` won't need to (since all the args, constant vector, interactive form, ... comes from the byte code returned by `byte-compile-make-closure`). Oh, actually not quite: the `docstring-exp` needs to be stripped before passing it to `eval`. Stefan