From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pip Cet Newsgroups: gmane.emacs.devel Subject: Re: master 8c81818673a 6/7: Tune volatile in read_char Date: Mon, 19 Aug 2024 23:40:18 +0000 Message-ID: <87jzgcaxpe.fsf@protonmail.com> References: <172386820621.30556.15409337288904485218@vcs2.savannah.gnu.org> <861q2ky0tg.fsf@gnu.org> <87le0scxig.fsf@protonmail.com> <86y14swksj.fsf@gnu.org> <871q2kcp0a.fsf@protonmail.com> <86r0akwbuk.fsf@gnu.org> <87wmkcb7ig.fsf@protonmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3745"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , acorallo@gnu.org, emacs-devel@gnu.org, stefankangas@gmail.com To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Aug 20 04:20:25 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 1sgETx-0000pn-D4 for ged-emacs-devel@m.gmane-mx.org; Tue, 20 Aug 2024 04:20:25 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sgET0-0006tw-Dq; Mon, 19 Aug 2024 22:19:26 -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 1sgBzA-0004sV-Gv for emacs-devel@gnu.org; Mon, 19 Aug 2024 19:40:28 -0400 Original-Received: from mail-40131.protonmail.ch ([185.70.40.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sgBz8-0006nY-LG for emacs-devel@gnu.org; Mon, 19 Aug 2024 19:40:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1724110824; x=1724370024; bh=QoEDxZlQJwH338h7QCbmTZkMPPo6rSUZgiD1sOuwa4E=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=u8SXeL+PDwqHHcHBeyHw38NGbgMkyY5RJzkRgBNpulYNDOxIXYFhKkCaFmC4Tpptd 9Kl1/ZDMQ8p8/1pvEZVjyBW23pyNtAkmjfo3TGBKB5zY8Y0aOiz++aMd5m2U2Yklw0 zzV1dXEpbQ9p+ykumAE6Pj7qX3Hp918xVAUtPhGHYbsoqn7v/mg70DtOXGzIaMPMHg Z656DjIIw3w/9RjTSNZslQJz98DAaUPueJZUr+LkPLR29KueiJFmxvyWDKs4rEYoTl zkXDxrwQBtoKA+V/oJuBzxkn1vRaU1jd7dnP2DkYQNADAZTzywpHZV8I2/4x7Sl5Km OCHGn0aPMs0aA== In-Reply-To: Feedback-ID: 112775352:user:proton X-Pm-Message-ID: 934cffd03c6098c123581c4377e3e122fffee877 Received-SPF: pass client-ip=185.70.40.131; envelope-from=pipcet@protonmail.com; helo=mail-40131.protonmail.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Mon, 19 Aug 2024 22:19:24 -0400 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:322949 Archived-At: "Paul Eggert" writes: > On 2024-08-19 13:08, Pip Cet wrote: >> one can come up with similar examples without a >> backward jump, which loop unquittably even in emacs-30 > > Ouch, in that case this issue happens regardless of the recent > 'volatile'-related changes, and we should address the issue regardless > of what we do with 'volatile'. Agreed. > Would the attached patch fix the issue in master? It can be tuned > further (and obviously needs comments); I'm just trying to see whether I > understand the point you're making. =09=09pc =3D bytestr_data; =09=09PUSH (c->val); +=09=09if (BYTE_CODE_SAFE) +=09=09 quitcounter +=3D ! (op < 0); =09=09goto op_branch; =09 } Yes, that does work, though I had to fix a bug in my code and it now reads: (disassemble #[65535 "\210\3011\0\0\202\013\0\302\211\241\202\010\000" [argument (wrong-type-argument) 0 t] 65536]) But, as you say, it could be simplified: =09=09pc =3D bytestr_data; =09=09PUSH (c->val); +=09=09if (BYTE_CODE_SAFE) +=09=09 quitcounter++; =09=09goto op_branch; =09 } 'op' is relative to the beginning of the byte string, so it should never be less than 0. If it is, and BYTE_CODE_SAFE is true, we will call emacs_abort in op_branch. > This patch affects behavior only if BYTE_CODE_SAFE, because as I > understand things we trust bytecode anyway otherwise. (That reminds me of a bug that I hunted down in which it turned out gcc helpfully generated different code depending on whether -g (not -Og) was specified or not. I would prefer to err on the side of making things reproducible and unconditionally increment quitcounter.) By the way, I was very surprised that 'signal_or_quit', by way of 'Fmemq', calls 'maybe_quit'. I hope that cannot result in infinite recursion. Pip