2011-04-25 Paul Eggert <eggert@cs.ucla.edu>
+ * lisp.h: Say "vectorlike header" rather than "vector header.
+ (struct vectorlike_header): Rename from struct vector_header.
+ (XVECTORLIKE_HEADER_SIZE): Renamed from XVECTOR_HEADER_SIZE.
+ All uses changed.
+
lisp.h: Fix a problem with aliasing and vector headers.
GCC 4.6.0 optimizes based on type-based alias analysis. For
example, if b is of type struct buffer * and v of type struct
object, to help avoid aliasing.
(PSEUDOVECTORP): Rewrite in terms of TYPED_PSEUDOVECTORP.
(SUBRP): Likewise, since Lisp_Subr is a special case.
+
* lisp.h (struct Lisp_Vector, struct Lisp_Char_Table):
(struct Lisp_Sub_Char_Table, struct Lisp_Bool_Vector):
(struct Lisp_Hash_Table): Combine first two members into a single
/* Extract the size field of a vector or vector-like object. */
#define XVECTOR_SIZE(a) (XVECTOR (a)->header.size + 0)
-#define XVECTOR_HEADER_SIZE(a) (((struct vector_header *) XPNTR (a))->size + 0)
+#define XVECTORLIKE_HEADER_SIZE(a) \
+ (((struct vectorlike_header *) XPNTR (a))->size + 0)
/* Misc types. */
#define XSETPVECTYPESIZE(v, code, sizeval) \
((v)->header.size = PSEUDOVECTOR_FLAG | (code) | (sizeval))
#define XSETPSEUDOVECTOR(a, b, code) \
- XSETTYPED_PSEUDOVECTOR(a, b, XVECTOR_HEADER_SIZE (a), code)
+ XSETTYPED_PSEUDOVECTOR(a, b, XVECTORLIKE_HEADER_SIZE (a), code)
#define XSETTYPED_PSEUDOVECTOR(a, b, size, code) \
(XSETVECTOR (a, b), \
eassert ((size & (PSEUDOVECTOR_FLAG | PVEC_TYPE_MASK)) \
/* Header of vector-like objects. This type documents the constraints on
layout of vectors and pseudovectors, and helps optimizing compilers not get
fooled by Emacs's type punning. */
-struct vector_header
+struct vectorlike_header
{
EMACS_UINT size;
union {
struct Lisp_Vector
{
- struct vector_header header;
+ struct vectorlike_header header;
Lisp_Object contents[1];
};
pseudovector type information. It holds the size, too.
The size counts the defalt, parent, purpose, ascii,
contents, and extras slots. */
- struct vector_header header;
+ struct vectorlike_header header;
/* This holds a default value,
which is used whenever the value for a specific character is nil. */
{
/* HEADER.SIZE is the vector's size field, which also holds the
pseudovector type information. It holds the size, too. */
- struct vector_header header;
+ struct vectorlike_header header;
/* Depth of this sub char-table. It should be 1, 2, or 3. A sub
char-table of depth 1 contains 16 elements, and each element
{
/* HEADER.SIZE is the vector's size field. It doesn't have the real size,
just the subtype information. */
- struct vector_header header;
+ struct vectorlike_header header;
/* This is the size in bits. */
EMACS_UINT size;
/* This contains the actual bits, packed into bytes. */
This type is treated in most respects as a pseudovector,
but since we never dynamically allocate or free them,
- we don't need a struct vector_header and its 'next' field. */
+ we don't need a struct vectorlike_header and its 'next' field. */
struct Lisp_Subr
{
struct Lisp_Hash_Table
{
/* This is for Lisp; the hash table code does not refer to it. */
- struct vector_header header;
+ struct vectorlike_header header;
/* Function used to compare keys. */
Lisp_Object test;
/* True if object X is a pseudovector whose code is CODE. */
#define PSEUDOVECTORP(x, code) \
- TYPED_PSEUDOVECTORP(x, vector_header, code)
+ TYPED_PSEUDOVECTORP(x, vectorlike_header, code)
/* True if object X, with internal type struct T *, is a pseudovector whose
code is CODE. */