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 19:54:02 +0300 Message-ID: <83sf7egitx.fsf@gnu.org> References: <6B2EDD07-AAEB-40E8-B369-F634296BD3D9@gmail.com> <83v8cagkqv.fsf@gnu.org> <83ttrugkj2.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="34314"; 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 18:55:18 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 1qhYZh-0008fN-5m for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 16 Sep 2023 18:55:17 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qhYZM-0004uP-A6; Sat, 16 Sep 2023 12:54: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 1qhYZL-0004u5-0R for bug-gnu-emacs@gnu.org; Sat, 16 Sep 2023 12:54: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 1qhYZK-0004EK-PD for bug-gnu-emacs@gnu.org; Sat, 16 Sep 2023 12:54:54 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qhYZR-0003vv-SR for bug-gnu-emacs@gnu.org; Sat, 16 Sep 2023 12:55:01 -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 16:55: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.169488326315040 (code B ref 65491); Sat, 16 Sep 2023 16:55:01 +0000 Original-Received: (at 65491) by debbugs.gnu.org; 16 Sep 2023 16:54:23 +0000 Original-Received: from localhost ([127.0.0.1]:48458 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhYYo-0003uW-Mu for submit@debbugs.gnu.org; Sat, 16 Sep 2023 12:54:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47174) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qhYYm-0003uC-MA for 65491@debbugs.gnu.org; Sat, 16 Sep 2023 12:54:21 -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 1qhYYZ-000433-HO; Sat, 16 Sep 2023 12:54:07 -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=5ZUA7Kwp61RMpxBdjbKt20AuVd4of1L8Y5JmsWxec38=; b=BZ9dw00Pg3VFYzcDPmkY avJuffhW9lZtUx6hltPbEhAmIh7Umn8CzhHU//vCOxLJk/RIiyxouc6U/Tl+b8FW74Y/7MbQr2z9y Cm07x3CHqCQginbBD3YnDNKFfA9GwrXO7ZQxRGaYZDUCjemlqfgKpRGDFsD1L4vhuB6jb6QTHazHU uQ03Rc6Y6CyqQEqwMKUZN7mfQgck0hnyJ96pVfV8JvsCmP7gAo4sIkdq2Zs+ltxewJ0W80jEtLCDn OR67Mxd/fGW2wAALDvXYWxWyTx/i0FCfr7YupiRawv4snZwtjStt/7r0rQjM1lq0FVYMSfTPjZibB ylD84DdxX937BQ==; In-Reply-To: (message from Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= on Sat, 16 Sep 2023 18:32:31 +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:270636 Archived-At: > From: Mattias EngdegÄrd > Date: Sat, 16 Sep 2023 18:32:31 +0200 > Cc: 65491@debbugs.gnu.org, > monnier@iro.umontreal.ca > > The new XUNTAG is: > > #define XUNTAG(a, type, ctype) ((ctype *) \ > ((uintptr_t) XLP (a) - LISP_WORD_TAG (type))) > > so you get a warning from what, conversion of a 64-bit number to (ctype *)? Yes, I think so: In file included from dispnew.c:27: lisp.h: In function 'PSEUDOVECTORP': lisp.h:813:33: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] 813 | #define XUNTAG(a, type, ctype) ((ctype *) \ | ^ lisp.h:374:6: note: in expansion of macro 'XUNTAG' 374 | ((XUNTAG ((a), Lisp_Vectorlike, union vectorlike_header)->size \ | ^~~~~~ lisp.h:1127:10: note: in expansion of macro 'lisp_h_PSEUDOVECTORP' 1127 | return lisp_h_PSEUDOVECTORP (a, code); | ^~~~~~~~~~~~~~~~~~~~ lisp.h: In function 'XSYMBOL_WITH_POS': lisp.h:813:33: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] 813 | #define XUNTAG(a, type, ctype) ((ctype *) \ | ^ lisp.h:1152:12: note: in expansion of macro 'XUNTAG' 1152 | return XUNTAG (a, Lisp_Vectorlike, struct Lisp_Symbol_With_Pos); | ^~~~~~ lisp.h: In function 'XBARE_SYMBOL': lisp.h:813:33: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] 813 | #define XUNTAG(a, type, ctype) ((ctype *) \ | ^ lisp.h:1159:27: note: in expansion of macro 'XUNTAG' 1159 | intptr_t i = (intptr_t) XUNTAG (a, Lisp_Symbol, struct Lisp_Symbol); | ^~~~~~ > Does changing the definition to > > #define XUNTAG(a, type, ctype) \ > ((ctype *) ((uintptr_t) XLP (a) - (uintptr_t)LISP_WORD_TAG (type))) > > help? (That is, cast the LISP_WORD_TAG return value to uintptr_t.) 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? Why did you need to change the original cast in the first place?