emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC, PATCH] shrink struct vectorlike_header #2


From: Nix
Subject: Re: [RFC, PATCH] shrink struct vectorlike_header #2
Date: Thu, 08 Nov 2012 17:42:04 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

On 8 Nov 2012, Paul Eggert spake thusly:
> But better yet would be to omit the casts entirely.
> This might let GCC do more optimizations safely.  That is,
> change struct Lisp_Vector to be something like this:
>
> struct Lisp_Vector
>   {
>      struct vectorlike_header header;
>      union
>        {
>           Lisp_Object contents[1];
>           struct Lisp_Vector *next;
>        } u;
>   };
>
> Replace all current uses of 'contents'
> with 'u.contents', and then use u.next
> when you want to use the memory as a next field.

It's a shame we can't use an unnamed union here:

struct Lisp_Vector
  {
     struct vectorlike_header header;
     union
       {
          Lisp_Object contents[1];
          struct Lisp_Vector *next;
       };
  };

No changes to source necessary.

Downside: GCC extension :( which probably rules it out unless wrapped in
compiler-specific macro trickery, and if you're doing that you might as
well just unconditionally use a named union.

Sigh.

-- 
NULL && (void)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]