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.bugs Subject: bug#65491: [PATCH] Improve performance allocating vectors Date: Sat, 16 Sep 2023 20:11:56 +0300 Message-ID: <83pm2igi03.fsf@gnu.org> References: <6B2EDD07-AAEB-40E8-B369-F634296BD3D9@gmail.com> <83v8cagkqv.fsf@gnu.org> <83ttrugkj2.fsf@gnu.org> <83sf7egitx.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38196"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 65491@debbugs.gnu.org, monnier@iro.umontreal.ca To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Sep 16 19:13:04 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1qhYqu-0009k1-Av for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 16 Sep 2023 19:13:04 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qhYqm-000745-R3; Sat, 16 Sep 2023 13:12:56 -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 1qhYql-00073Q-Fl for bug-gnu-emacs@gnu.org; Sat, 16 Sep 2023 13:12:55 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qhYql-0000TB-7l for bug-gnu-emacs@gnu.org; Sat, 16 Sep 2023 13:12:55 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qhYqs-0004Rq-AX for bug-gnu-emacs@gnu.org; Sat, 16 Sep 2023 13:13:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 16 Sep 2023 17:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65491 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 65491-submit@debbugs.gnu.org id=B65491.169488433617031 (code B ref 65491); Sat, 16 Sep 2023 17:13:02 +0000 Original-Received: (at 65491) by debbugs.gnu.org; 16 Sep 2023 17:12:16 +0000 Original-Received: from localhost ([127.0.0.1]:48484 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhYq7-0004Qc-Pn for submit@debbugs.gnu.org; Sat, 16 Sep 2023 13:12:16 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37812) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhYq5-0004QP-BL for 65491@debbugs.gnu.org; Sat, 16 Sep 2023 13:12:15 -0400 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 1qhYps-0000Be-PZ; Sat, 16 Sep 2023 13:12:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=bX9lTN+Nl0dd8hItPeUHcRcl6IuTdQGbfdDVZsBkY4E=; b=B8Ot3u+ON4IAdUHzQCb2 qhEWP2DOku3UjfN+cB35hsMEhQ2sx8vap+OLwI8dh6GSx4cuoF3EX1fHzBVt/ujW69DH/3dlL+6B3 ww7pIh8yc2+rK2h6VBeci1fGRssa3vcd6CCcm2OTCoK++kQZJpC8B5Fk15T5EySXaz0vx75aeysel QKZ66YJZMI33R5nFKhDdzYHJRabllUVWcB6iu45kiloe1cAzjY0loax1WCyZZVGTGAqE5kf344K31 sGyTADrsGeSSY6uoeOsulJVzb4LML1tTSx7iShTwoEjFQXDOihT+fLr72GzC/Dx2Dt/+OZeYy4P7e nSScBUQPFXoIDQ==; In-Reply-To: (message from Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= on Sat, 16 Sep 2023 19:03:33 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:270639 Archived-At: > From: Mattias EngdegÄrd > Date: Sat, 16 Sep 2023 19:03:33 +0200 > Cc: 65491@debbugs.gnu.org, > monnier@iro.umontreal.ca > > 16 sep. 2023 kl. 18.54 skrev Eli Zaretskii : > > > It does, but LISP_WORD_TAG(type) is a 64=bit type with the only bits > > set above 32 bit, so how casting it to uintptr_t is TRT? > > Because XUNTAG is used to get the pointer part; we don't want the tag bits. Then just casting should do, no? Why the subtraction? > > Why did you need to change the original cast in the first place? > > The commit message tried to explain that, but in essence, the old code untagged a Lisp_Object value by casting it to char *, then do pointer arithmetic on that, and then cast the result to whatever pointer we want. > > The C standard severely restricts pointer arithmetic: in particular, for P+X where X is an integer and P is a pointer, P cannot be null (nor will P+X, since both P and P+X must be pointers to objects in the same array). > > This means that XUNTAG could never reliably untag a null pointer and this did cause mayhem in some places. We have just been lucky not to trigger it so far but I noticed when attempting to make some innocent-looking changes. Sorry, this is not a reason good enough to make changes in these parts. However "unreliable" the old code worked for many moons, luck or no luck, so if there's no other reason, I prefer to leave it alone. And I'd like to hear from Paul before we make any further changes in that area, please.