From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#65491: [PATCH] Improve performance allocating vectors Date: Sun, 17 Sep 2023 13:02:15 -0400 Message-ID: References: <6B2EDD07-AAEB-40E8-B369-F634296BD3D9@gmail.com> <83v8cagkqv.fsf@gnu.org> <83ttrugkj2.fsf@gnu.org> <83sf7egitx.fsf@gnu.org> <871qexzelk.fsf@yahoo.com> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24042"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 65491@debbugs.gnu.org, Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= , Eli Zaretskii To: Po Lu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 17 19:03:19 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 1qhvB0-00060Z-RN for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 17 Sep 2023 19:03:19 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qhvAe-0007rc-Ry; Sun, 17 Sep 2023 13:02: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 1qhvAd-0007rN-58 for bug-gnu-emacs@gnu.org; Sun, 17 Sep 2023 13:02: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 1qhvAc-0001S0-T9 for bug-gnu-emacs@gnu.org; Sun, 17 Sep 2023 13:02:54 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qhvAj-0005yf-JM for bug-gnu-emacs@gnu.org; Sun, 17 Sep 2023 13:03:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 17 Sep 2023 17:03:01 +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.169497016222952 (code B ref 65491); Sun, 17 Sep 2023 17:03:01 +0000 Original-Received: (at 65491) by debbugs.gnu.org; 17 Sep 2023 17:02:42 +0000 Original-Received: from localhost ([127.0.0.1]:51297 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhvAQ-0005y7-Fj for submit@debbugs.gnu.org; Sun, 17 Sep 2023 13:02:42 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:4909) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhvAL-0005xq-3R for 65491@debbugs.gnu.org; Sun, 17 Sep 2023 13:02:40 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 468DE440CE9; Sun, 17 Sep 2023 13:02:23 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1694970137; bh=2aSO7tgyHt23/IVZdN4mtLcWCoBQq5CnF0xQhXLgOBs=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=ehWUc9+KMeWdfQdgv/sNEIEvVbzJzQ04ducDUhffIpq98Vw9wxFwqv8uixDvHyIlU OL/Byg6qaE7x9Qoczc2UNfZqv6WAOxzqnlL5PKYh9gK6auAPffFqawYDLmUUbT8Sl0 +AhvG6i+Vx7uFKdWXJz4HJr8ykNdM6NK+1fFl3eZzvyKoaub//eTdDpNvVYNwFnHFI /7pVT2vxYSCpiaNO3aFn+9wXVLh71JkSsntckZIS60oBjLRCUhQDnYzNnnNILKbOHK 5VWA0DRndcVzT+wlQWZVWdWBc0IyLaCWqkHpDlbXWKVCmnNYWwZWImuZngPlJGUfmk 0hPC9wN6KC04g== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 6CEEB440C84; Sun, 17 Sep 2023 13:02:17 -0400 (EDT) Original-Received: from pastel (unknown [104.247.237.102]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 3C9621201D8; Sun, 17 Sep 2023 13:02:17 -0400 (EDT) In-Reply-To: <871qexzelk.fsf@yahoo.com> (Po Lu's message of "Sun, 17 Sep 2023 11:02:47 +0800") 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:270714 Archived-At: > Within Standard C, the result of converting a pointer value to an > integer and vice versa is also implementation defined behavior. FWIW, last I checked it's literally impossible to implement our conservative GC (or `malloc` for that matter) without relying on undefined and implementation defined behaviors in C. So the best we can do is to try and avoid those undefined behavior that compilers *do* use to bite in the rear. I still haven't seen any compiler that tries to make use of the implementation defined behavior of conversion from pointer to integer as a basis for optimization, so AFAIK we're still safe using those. Even converting them back to their original pointer (which is what we do with tag/untag pairs) is documented to be well-defined if you compile using GCC. In contrast the pointer arithmetic on NULL pointers appears to be something which compilers have started to (ab)use as an assumption for their optimizations. Hence the need to update our code. Stefan