From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.devel Subject: Re: master 8c81818673a 6/7: Tune volatile in read_char Date: Mon, 19 Aug 2024 11:59:28 -0700 Organization: UCLA Computer Science Department Message-ID: <71607435-31fd-4a6c-8392-ad5725c8f3b3@cs.ucla.edu> References: <172386820621.30556.15409337288904485218@vcs2.savannah.gnu.org> <20240817041648.A6687C2BC66@vcs2.savannah.gnu.org> <87f24fac-aa71-499f-a398-2bad70a0ca42@cs.ucla.edu> <8634n0y2th.fsf@gnu.org> <87plq4cyuj.fsf@protonmail.com> <861q2ky0tg.fsf@gnu.org> <87le0scxig.fsf@protonmail.com> <86y14swksj.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16015"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: acorallo@gnu.org, emacs-devel@gnu.org, stefankangas@gmail.com To: Eli Zaretskii , Pip Cet Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Aug 19 21:00:42 2024 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 1sg7cN-0003z3-2U for ged-emacs-devel@m.gmane-mx.org; Mon, 19 Aug 2024 21:00:39 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sg7bO-0000Da-7q; Mon, 19 Aug 2024 14:59:38 -0400 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 1sg7bK-0000D4-TN for emacs-devel@gnu.org; Mon, 19 Aug 2024 14:59:34 -0400 Original-Received: from mail.cs.ucla.edu ([131.179.128.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sg7bH-0003gv-TI; Mon, 19 Aug 2024 14:59:33 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 21B893C00E400; Mon, 19 Aug 2024 11:59:29 -0700 (PDT) Original-Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id P5MguXWZkQEG; Mon, 19 Aug 2024 11:59:28 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id C90DC3C00E8B0; Mon, 19 Aug 2024 11:59:28 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu C90DC3C00E8B0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1724093968; bh=g4M9mArHmnV1WGA+DSPcGip4GQ03YuOKfy6KWKLwTaM=; h=Message-ID:Date:MIME-Version:To:From; b=YwP+EiZecyh1i6NG8dh291QHIIbtlS5L+ZzWerU6OC4M/eosdd9U78gn9dOVjPm2t qubYo6t/l2wP5zA1yPUNgc4J4WHMpIkHjGj+4HnAoBqxbW4Rl4801V2VDGBix1bvY3 Zfmhmu6GQiCI0wjVNxM6R0veeklhYC0DxJV84l06JrvscOTcgCy++9/kqWrA3QNGOc XOWNP6/4+eU8N8PfAnUgoOYqn+u2yPfw3SBCnlwnUFqcpaPijRgRF1tKiIh72xkVj+ 5Cwk5DOQFblx2bNQFZTcTz6/bW9rccc10fyNLFAMJXlebjD88H7Q9tCf3xK8Tff53M DrcCq5NaMgsPw== X-Virus-Scanned: amavis at mail.cs.ucla.edu Original-Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id nG8M8MrmPP2H; Mon, 19 Aug 2024 11:59:28 -0700 (PDT) Original-Received: from [192.168.254.12] (unknown [47.150.137.250]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id A72C43C00E400; Mon, 19 Aug 2024 11:59:28 -0700 (PDT) Content-Language: en-US In-Reply-To: <86y14swksj.fsf@gnu.org> Received-SPF: pass client-ip=131.179.128.66; envelope-from=eggert@cs.ucla.edu; helo=mail.cs.ucla.edu X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:322940 Archived-At: On 2024-08-19 09:15, Eli Zaretskii wrote: > Why not simply undo that single patch, and be done? Let's not. The issue has long been present and is not limited to read_char; see, for example, the variable "this_op" in exec_byte_code, which is merely a volatile copy of "op". The method Emacs uses to address this issue works and there's no reason to use a different method in read_char than everywhere else. A better way to deal with 'volatile' is to not use it, the way Stefan did in 2013; see commit adf2aa61404305e58e71cde0193bb650aff2c4b3. If we wanted to do further surgery in read_char etc., I suggest splitting each setjmp-calling function into multiple functions: the part that really needs setjmp and the (hopefully) larger part that does not. We could then focus on minimizing the number of local variables affected in the functions that really need setjmp. When we're lucky the number of affected variables would be zero. Most likely there would still be a few volatile variables, which would still cause trouble (good luck taking their addresses, for example) but that's life and at least we'd have less 'volatile' than we do now. I suspect, though, it's better to quit while we're ahead.