all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Antipov <dmantipov@yandex.ru>
To: Emacs development discussions <emacs-devel@gnu.org>
Cc: Paul Eggert <eggert@cs.ucla.edu>,
	Stefan Monnier <monnier@iro.umontreal.ca>
Subject: Re: [RFC, PATCH] shrink struct vectorlike_header #2
Date: Thu, 08 Nov 2012 19:08:34 +0400	[thread overview]
Message-ID: <509BCAF2.2070404@yandex.ru> (raw)
In-Reply-To: <509BC584.7080208@yandex.ru>

[-- Attachment #1: Type: text/plain, Size: 652 bytes --]

On 11/08/2012 06:45 PM, Dmitry Antipov wrote:

> On 11/08/2012 06:03 PM, Stefan Monnier wrote:
>
>>> struct Lisp_Vector
>>>    {
>>>       struct vectorlike_header header;
>>>       union
>>>         {
>>>            Lisp_Object contents[1];
>>>            struct Lisp_Vector *next;
>>>         } u;
>>>    };
>>
>> Yes, that'd be better.
>
> This will be a quite large patch, with a lot of small changes,
> and I don't want to mix them with the core logical changes.
> So if others votes for such a change, I would rather like to
> do it separately.

Argh, there is another solution (comes into my head immediately
after commit, of course).

Dmitry



[-- Attachment #2: lisp_vectorlike_free.patch --]
[-- Type: text/plain, Size: 1067 bytes --]

=== modified file 'src/alloc.c'
--- src/alloc.c	2012-11-08 14:10:28 +0000
+++ src/alloc.c	2012-11-08 15:05:02 +0000
@@ -2611,16 +2611,18 @@
 
 #define VINDEX(nbytes) (((nbytes) - VBLOCK_BYTES_MIN) / roundup_size)
 
-/* When V is on the free list, first word after header is used as a pointer
-   to next vector on the free list.  It might be done in a better way with:
-
-   (*(struct Lisp_Vector **)&(v->contents[0]))
-
-   but this breaks GCC's strict-aliasing rules (which looks more relaxed
-   for char and void pointers).  */
-
-#define NEXT_IN_FREE_LIST(v)				\
-  (*(struct Lisp_Vector **)((char *) v + header_size))
+/* This is a pseudo vectorlike object used to represent any
+   block-allocated vectorlike object on the free list.  */
+
+struct Lisp_Vectorlike_Free
+{
+  struct vectorlike_header header;
+  struct Lisp_Vector *next;
+};
+
+/* When V is on the free list, it's always treated as Lisp_Vectorlike_Free.  */
+
+#define NEXT_IN_FREE_LIST(v) ((struct Lisp_Vectorlike_Free *) v)->next
 
 /* Common shortcut to setup vector on a free list.  */
 


  reply	other threads:[~2012-11-08 15:08 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-11  6:41 [PATCH] shrink struct vectorlike_header Dmitry Antipov
2012-10-11 12:57 ` Stefan Monnier
2012-11-06 17:09   ` [RFC, PATCH] shrink struct vectorlike_header #2 Dmitry Antipov
2012-11-06 18:17     ` Stefan Monnier
2012-11-07 14:57       ` Dmitry Antipov
2012-11-08  3:08         ` Stefan Monnier
2012-11-08  5:25           ` Paul Eggert
2012-11-08 13:31             ` Dmitry Antipov
2012-11-08 14:03             ` Stefan Monnier
2012-11-08 14:45               ` Dmitry Antipov
2012-11-08 15:08                 ` Dmitry Antipov [this message]
2012-11-08 16:30                   ` Paul Eggert
2012-11-08 17:12               ` Andreas Schwab
2012-11-08 17:42             ` Nix
2012-11-09 18:04               ` Andreas Rottmann
2012-11-08  6:56           ` Stephen J. Turnbull
2012-11-06 20:53     ` Paul Eggert
2012-11-06 21:28       ` Eli Zaretskii
2012-10-11 16:42 ` [PATCH] shrink struct vectorlike_header Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=509BCAF2.2070404@yandex.ru \
    --to=dmantipov@yandex.ru \
    --cc=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.