Commit b102ceb1 authored by Paul Eggert's avatar Paul Eggert

* 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.
parent 179dade4
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
......@@ -33,6 +38,7 @@
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
......
......@@ -505,7 +505,7 @@ struct buffer
collect killed buffers properly.
Note that vectors and most pseudovectors are all on one chain,
but buffers are on a separate chain of their own. */
struct vector_header header;
struct vectorlike_header header;
/* This structure holds the coordinates of the buffer contents
in ordinary buffers. In indirect buffers, this is not used. */
......
......@@ -254,7 +254,7 @@ extern Lisp_Object Qja, Qko;
struct font_spec
{
struct vector_header header;
struct vectorlike_header header;
Lisp_Object props[FONT_SPEC_MAX];
};
......@@ -262,7 +262,7 @@ struct font_spec
struct font_entity
{
struct vector_header header;
struct vectorlike_header header;
Lisp_Object props[FONT_ENTITY_MAX];
};
......@@ -275,7 +275,7 @@ struct font_entity
struct font
{
struct vector_header header;
struct vectorlike_header header;
/* All Lisp_Object components must come first.
That ensures they are all aligned normally. */
......
......@@ -82,7 +82,7 @@ struct font_driver_list;
struct frame
{
struct vector_header header;
struct vectorlike_header header;
/* All Lisp_Object components must come first.
That ensures they are all aligned normally. */
......
......@@ -557,7 +557,8 @@ extern Lisp_Object make_number (EMACS_INT);
/* 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. */
......@@ -612,7 +613,7 @@ extern Lisp_Object make_number (EMACS_INT);
#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)) \
......@@ -793,7 +794,7 @@ struct Lisp_String
/* 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 {
......@@ -804,7 +805,7 @@ struct vector_header
struct Lisp_Vector
{
struct vector_header header;
struct vectorlike_header header;
Lisp_Object contents[1];
};
......@@ -909,7 +910,7 @@ struct Lisp_Char_Table
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. */
......@@ -938,7 +939,7 @@ struct Lisp_Sub_Char_Table
{
/* 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
......@@ -959,7 +960,7 @@ struct Lisp_Bool_Vector
{
/* 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. */
......@@ -972,7 +973,7 @@ struct Lisp_Bool_Vector
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
{
......@@ -1120,7 +1121,7 @@ struct Lisp_Symbol
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;
......@@ -1652,7 +1653,7 @@ typedef struct {
/* 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. */
......
......@@ -34,7 +34,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
struct Lisp_Process
{
struct vector_header header;
struct vectorlike_header header;
/* Name of subprocess terminal. */
Lisp_Object tty_name;
......
......@@ -323,7 +323,7 @@ struct w32_display_info;
struct terminal
{
/* This is for Lisp; the terminal code does not refer to it. */
struct vector_header header;
struct vectorlike_header header;
/* Parameter alist of this terminal. */
Lisp_Object param_alist;
......
......@@ -5794,7 +5794,7 @@ zero means top of window, negative means relative to bottom of window. */)
struct save_window_data
{
struct vector_header header;
struct vectorlike_header header;
Lisp_Object selected_frame;
Lisp_Object current_window;
Lisp_Object current_buffer;
......@@ -5816,7 +5816,7 @@ struct save_window_data
/* This is saved as a Lisp_Vector */
struct saved_window
{
struct vector_header header;
struct vectorlike_header header;
Lisp_Object window;
Lisp_Object buffer, start, pointm, mark;
Lisp_Object left_col, top_line, total_cols, total_lines;
......
......@@ -89,7 +89,7 @@ struct cursor_pos
struct window
{
/* This is for Lisp; the terminal code does not refer to it. */
struct vector_header header;
struct vectorlike_header header;
/* The frame this window is on. */
Lisp_Object frame;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment