From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: tags in the 3 lowest bits Date: 20 Nov 2003 11:21:52 +0100 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1069320325 18150 80.91.224.253 (20 Nov 2003 09:25:25 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 20 Nov 2003 09:25:25 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Thu Nov 20 10:25:20 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AMl3w-00036h-00 for ; Thu, 20 Nov 2003 10:25:20 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1AMl3v-0002MB-00 for ; Thu, 20 Nov 2003 10:25:20 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AMlyz-00028I-Mo for emacs-devel@quimby.gnus.org; Thu, 20 Nov 2003 05:24:17 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AMlyq-00027f-OH for emacs-devel@gnu.org; Thu, 20 Nov 2003 05:24:08 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AMlyJ-0001pz-2H for emacs-devel@gnu.org; Thu, 20 Nov 2003 05:24:06 -0500 Original-Received: from [212.88.64.25] (helo=mail-relay.sonofon.dk) by monty-python.gnu.org with smtp (Exim 4.24) id 1AMlyI-0001oz-60 for emacs-devel@gnu.org; Thu, 20 Nov 2003 05:23:34 -0500 Original-Received: (qmail 14445 invoked from network); 20 Nov 2003 09:22:08 -0000 Original-Received: from unknown (HELO kfs-l.imdomain.dk.cua.dk) (213.83.150.2) by 0 with SMTP; 20 Nov 2003 09:22:08 -0000 Original-To: Stefan Monnier In-Reply-To: Original-Lines: 65 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:17951 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:17951 Stefan Monnier writes: > > The only reason I can see for this is that there is a small > > performance penalty on XFASTINT with LSB -- but I'd prefer that > > penalty rather than having to support two different methods. > > I doubt the performance penalty is an issue. After all, manipulating MSB > is generally slightly more costly than LSB, so the performance impact might > even be positive. But I expect it's a wash. Once LSB is in place, I would like us to get rid of XFASTINT all-together. It's a potential danger lurking to hit us. > > > Or are there systems which cannot use LSB? > > The LSB code needs pointers values that are multiples of 8. > On some systems, malloc does not guarantee it. Probably we can use > gmalloc.c for those systems, but we'll need to make sure that's an option > and we'll need to figure out when that's nmecessary. We could wrap malloc and free on such systems to force 8 byte alignment like this (it's a little costly in memory, but no big deal): char *malloc_wrap(size_t len) { char *p = malloc(len + 16); char *p1 = p; p = (char *)((unsigned)(p + 15) & ~0x7); *(char **)(p - 8) = p1; return p; } char free_wrap(char *p) { free(*(char **)(p - 8)); } > Also, there might be > systems that are word-addressed rather than byte-addressed. I don't know > if such systems are still in use and whether Emacs runs on them, but if > yes, we'll probably need to find some other way to deal with them, > maybe keeping the old behavior. > > I also hope we can switch to LSB everywhere, but I don't think we can > do that right now. > > I suggest to start with something like along the lines of > > #if defined GLIBC || defined GNU_MALLOC > #define USE_LSB_TAG > #endif That's a good starting point, yes. Or we could use the above trick like this: #if !(defined GLIBC || defined GNU_MALLOC) #define malloc malloc_wrap #define free free_wrap #endif -- Kim F. Storm http://www.cua.dk