From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: scratch/comp-static-data 5aa3db2f11: comp: Add support for compiling elisp constants into static data. Date: Sun, 20 Nov 2022 18:54:48 +0200 Message-ID: <8335ad5zxj.fsf@gnu.org> References: <166844679660.19180.3470364122428955894@vcs2.savannah.gnu.org> <20221114172637.78215C0E4C7@vcs2.savannah.gnu.org> <871qq5hxf9.fsf@yahoo.com> <9c27dd84e3298e2ed979415016f2db75d1cef882.camel@gmail.com> <83zgcobr9x.fsf@gnu.org> <83zgcm5b60.fsf@gnu.org> <18b7286a9bd88d8c30822d195d9893f1267fd665.camel@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26116"; mail-complaints-to="usenet@ciao.gmane.io" Cc: rms@gnu.org, akrl@sdf.org, luangruo@yahoo.com, emacs-devel@gnu.org To: vibhavp@gmail.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Nov 20 17:55:13 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 1ownb6-0006aA-9U for ged-emacs-devel@m.gmane-mx.org; Sun, 20 Nov 2022 17:55:12 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ownac-0002BD-4T; Sun, 20 Nov 2022 11:54:42 -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 1ownab-0002An-2l for emacs-devel@gnu.org; Sun, 20 Nov 2022 11:54:41 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ownaa-0001KN-Os; Sun, 20 Nov 2022 11:54:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=WBATcxpz7ISutUCycPbEuBbQIq8XlC8dMcAfubYq1RE=; b=IwJZrWmdVxRf 3niZQvXYJayPI2rRh9xZlz0kR14Zk30ClYMyLJlM+4TlWZYh+TGYI0L4zpt1baIP6pFg/M3ud91tC gLXNvNJvv9Aof11MetwasJRgrDbxSFONb1+paKFoh6SJFo9r5LR4BCpZpInyRKqL3WdAzMMYoswtR Vr1ld36Ivj1LQnUQEWdM5JQX7L6E5dbzbkZe3wyPpqLIaB+R7aSfbY8b2ikre20prAb4/0zSO0kz/ eEkH2o78DqdtpPkxarymckvg8PRdwpxqhQobFJi+ieqXpV6LhfqV+82hH0w3279FD2DgefxQtEBq/ +pVaYBYXhx93vlcZeCHnFw==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ownaa-00017O-1t; Sun, 20 Nov 2022 11:54:40 -0500 In-Reply-To: <18b7286a9bd88d8c30822d195d9893f1267fd665.camel@gmail.com> (vibhavp@gmail.com) 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:300256 Archived-At: > From: vibhavp@gmail.com > Cc: akrl@sdf.org, luangruo@yahoo.com, emacs-devel@gnu.org > Date: Sun, 20 Nov 2022 22:07:12 +0530 > > The follow elisp snipper is an example of code that when compiled under > this branch, crashes Emacs: > ;; -*- lexical-binding: t; -*- > (defun fault-function () > (let ((a [1 2 3])) > (aset a 0 5) > a)) > > (fault-function) Then I think Richard is right, and we shouldn't do this. It is OK to signal an error in this case, but not crash the entire Emacs session. > Therefore, `lisp_data_3' gets stored in .rodata (or .data.rel.ro), > which causes the call to `aset' to trigger a SIGSEGV. This behaviour is > documented by the Elisp reference manual, which states that self- > evaluating forms are immutable, and changing then can read to > crashes/undefined behaviour > (https://www.gnu.org/software/emacs/manual/html_node/elisp/Self_002dEvaluating-Forms.html > ). The documentation says "don't do that!", but it's a far cry from an actual crash. Sorry, I'm against doing this in Emacs. > The idea behind this patch is to replace the runtime initialization of > lisp objects in the original bytecode constant vector with static > variables, compiled into the eln itself. For now, it is able to do so > for strings (without text properties), bare symbols in `lispsym', > floats, vectors (and other psuedovectors in the future), and conses. > Objects that require runtime initialization (for instance, interned > symbols) are still created by calling their respective initialization > functions, and are not able to be stored as consts. I understand, but if the price is such crashes, it's a price I don't think we want to pay.