Commit a038df77 authored by Paul Eggert's avatar Paul Eggert

Allow gap before first non-Lisp pseudovec member

Problem reported by Keith David Bershatsky in:
https://lists.gnu.org/r/emacs-devel/2019-04/msg00259.html
Solution suggested by Stefan Monnier in:
https://lists.gnu.org/r/emacs-devel/2019-04/msg00282.html
* src/buffer.h (BUFFER_LISP_SIZE): Simplify by using PSEUDOVECSIZE.
(BUFFER_REST_SIZE): Simplify by using VECSIZE and BUFFER_LISP_SIZE.
* src/lisp.h (PSEUDOVECSIZE): Base it on the last Lisp field,
not the first non-Lisp field.  All callers changed.  Callers
without Lisp fields changed to use ALLOCATE_PLAIN_PSEUDOVECTOR.
(ALLOCATE_PLAIN_PSEUDOVECTOR): New macro.
parent 31e9087c
Pipeline #1206 failed with stage
in 60 minutes and 2 seconds
...@@ -3718,8 +3718,8 @@ Its value is void, and its function definition and property list are nil. */) ...@@ -3718,8 +3718,8 @@ Its value is void, and its function definition and property list are nil. */)
Lisp_Object Lisp_Object
make_misc_ptr (void *a) make_misc_ptr (void *a)
{ {
struct Lisp_Misc_Ptr *p = ALLOCATE_PSEUDOVECTOR (struct Lisp_Misc_Ptr, pointer, struct Lisp_Misc_Ptr *p = ALLOCATE_PLAIN_PSEUDOVECTOR (struct Lisp_Misc_Ptr,
PVEC_MISC_PTR); PVEC_MISC_PTR);
p->pointer = a; p->pointer = a;
return make_lisp_ptr (p, Lisp_Vectorlike); return make_lisp_ptr (p, Lisp_Vectorlike);
} }
...@@ -3729,7 +3729,7 @@ make_misc_ptr (void *a) ...@@ -3729,7 +3729,7 @@ make_misc_ptr (void *a)
Lisp_Object Lisp_Object
build_overlay (Lisp_Object start, Lisp_Object end, Lisp_Object plist) build_overlay (Lisp_Object start, Lisp_Object end, Lisp_Object plist)
{ {
struct Lisp_Overlay *p = ALLOCATE_PSEUDOVECTOR (struct Lisp_Overlay, next, struct Lisp_Overlay *p = ALLOCATE_PSEUDOVECTOR (struct Lisp_Overlay, plist,
PVEC_OVERLAY); PVEC_OVERLAY);
Lisp_Object overlay = make_lisp_ptr (p, Lisp_Vectorlike); Lisp_Object overlay = make_lisp_ptr (p, Lisp_Vectorlike);
OVERLAY_START (overlay) = start; OVERLAY_START (overlay) = start;
...@@ -3743,8 +3743,8 @@ DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 0, ...@@ -3743,8 +3743,8 @@ DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 0,
doc: /* Return a newly allocated marker which does not point at any place. */) doc: /* Return a newly allocated marker which does not point at any place. */)
(void) (void)
{ {
struct Lisp_Marker *p = ALLOCATE_PSEUDOVECTOR (struct Lisp_Marker, buffer, struct Lisp_Marker *p = ALLOCATE_PLAIN_PSEUDOVECTOR (struct Lisp_Marker,
PVEC_MARKER); PVEC_MARKER);
p->buffer = 0; p->buffer = 0;
p->bytepos = 0; p->bytepos = 0;
p->charpos = 0; p->charpos = 0;
...@@ -3766,8 +3766,8 @@ build_marker (struct buffer *buf, ptrdiff_t charpos, ptrdiff_t bytepos) ...@@ -3766,8 +3766,8 @@ build_marker (struct buffer *buf, ptrdiff_t charpos, ptrdiff_t bytepos)
/* Every character is at least one byte. */ /* Every character is at least one byte. */
eassert (charpos <= bytepos); eassert (charpos <= bytepos);
struct Lisp_Marker *m = ALLOCATE_PSEUDOVECTOR (struct Lisp_Marker, buffer, struct Lisp_Marker *m = ALLOCATE_PLAIN_PSEUDOVECTOR (struct Lisp_Marker,
PVEC_MARKER); PVEC_MARKER);
m->buffer = buf; m->buffer = buf;
m->charpos = charpos; m->charpos = charpos;
m->bytepos = bytepos; m->bytepos = bytepos;
...@@ -3821,8 +3821,8 @@ make_event_array (ptrdiff_t nargs, Lisp_Object *args) ...@@ -3821,8 +3821,8 @@ make_event_array (ptrdiff_t nargs, Lisp_Object *args)
Lisp_Object Lisp_Object
make_user_ptr (void (*finalizer) (void *), void *p) make_user_ptr (void (*finalizer) (void *), void *p)
{ {
struct Lisp_User_Ptr *uptr = ALLOCATE_PSEUDOVECTOR (struct Lisp_User_Ptr, struct Lisp_User_Ptr *uptr
finalizer, PVEC_USER_PTR); = ALLOCATE_PLAIN_PSEUDOVECTOR (struct Lisp_User_Ptr, PVEC_USER_PTR);
uptr->finalizer = finalizer; uptr->finalizer = finalizer;
uptr->p = p; uptr->p = p;
return make_lisp_ptr (uptr, Lisp_Vectorlike); return make_lisp_ptr (uptr, Lisp_Vectorlike);
...@@ -3945,7 +3945,7 @@ FUNCTION. FUNCTION will be run once per finalizer object. */) ...@@ -3945,7 +3945,7 @@ FUNCTION. FUNCTION will be run once per finalizer object. */)
(Lisp_Object function) (Lisp_Object function)
{ {
struct Lisp_Finalizer *finalizer struct Lisp_Finalizer *finalizer
= ALLOCATE_PSEUDOVECTOR (struct Lisp_Finalizer, prev, PVEC_FINALIZER); = ALLOCATE_PSEUDOVECTOR (struct Lisp_Finalizer, function, PVEC_FINALIZER);
finalizer->function = function; finalizer->function = function;
finalizer->prev = finalizer->next = NULL; finalizer->prev = finalizer->next = NULL;
finalizer_insert (&finalizers, finalizer); finalizer_insert (&finalizers, finalizer);
......
...@@ -86,8 +86,8 @@ make_bignum_bits (size_t bits) ...@@ -86,8 +86,8 @@ make_bignum_bits (size_t bits)
if (integer_width < bits) if (integer_width < bits)
overflow_error (); overflow_error ();
struct Lisp_Bignum *b = ALLOCATE_PSEUDOVECTOR (struct Lisp_Bignum, value, struct Lisp_Bignum *b = ALLOCATE_PLAIN_PSEUDOVECTOR (struct Lisp_Bignum,
PVEC_BIGNUM); PVEC_BIGNUM);
mpz_init (b->value); mpz_init (b->value);
mpz_swap (b->value, mpz[0]); mpz_swap (b->value, mpz[0]);
return make_lisp_ptr (b, Lisp_Vectorlike); return make_lisp_ptr (b, Lisp_Vectorlike);
...@@ -342,8 +342,8 @@ bignum_to_string (Lisp_Object num, int base) ...@@ -342,8 +342,8 @@ bignum_to_string (Lisp_Object num, int base)
Lisp_Object Lisp_Object
make_bignum_str (char const *num, int base) make_bignum_str (char const *num, int base)
{ {
struct Lisp_Bignum *b = ALLOCATE_PSEUDOVECTOR (struct Lisp_Bignum, value, struct Lisp_Bignum *b = ALLOCATE_PLAIN_PSEUDOVECTOR (struct Lisp_Bignum,
PVEC_BIGNUM); PVEC_BIGNUM);
mpz_init (b->value); mpz_init (b->value);
int check = mpz_set_str (b->value, num, base); int check = mpz_set_str (b->value, num, base);
eassert (check == 0); eassert (check == 0);
......
...@@ -741,8 +741,8 @@ struct buffer ...@@ -741,8 +741,8 @@ struct buffer
See `cursor-type' for other values. */ See `cursor-type' for other values. */
Lisp_Object cursor_in_non_selected_windows_; Lisp_Object cursor_in_non_selected_windows_;
/* No more Lisp_Object beyond this point. Except undo_list, /* No more Lisp_Object beyond cursor_in_non_selected_windows_.
which is handled specially in Fgarbage_collect. */ Except undo_list, which is handled specially in Fgarbage_collect. */
/* This structure holds the coordinates of the buffer contents /* This structure holds the coordinates of the buffer contents
in ordinary buffers. In indirect buffers, this is not used. */ in ordinary buffers. In indirect buffers, this is not used. */
...@@ -1019,14 +1019,12 @@ bset_width_table (struct buffer *b, Lisp_Object val) ...@@ -1019,14 +1019,12 @@ bset_width_table (struct buffer *b, Lisp_Object val)
structure, make sure that this is still correct. */ structure, make sure that this is still correct. */
#define BUFFER_LISP_SIZE \ #define BUFFER_LISP_SIZE \
((offsetof (struct buffer, own_text) - header_size) / word_size) PSEUDOVECSIZE (struct buffer, cursor_in_non_selected_windows_)
/* Size of the struct buffer part beyond leading Lisp_Objects, in word_size /* Allocated size of the struct buffer part beyond leading
units. Rounding is needed for --with-wide-int configuration. */ Lisp_Objects, in word_size units. */
#define BUFFER_REST_SIZE \ #define BUFFER_REST_SIZE (VECSIZE (struct buffer) - BUFFER_LISP_SIZE)
((((sizeof (struct buffer) - offsetof (struct buffer, own_text)) \
+ (word_size - 1)) & ~(word_size - 1)) / word_size)
/* Initialize the pseudovector header of buffer object. BUFFER_LISP_SIZE /* Initialize the pseudovector header of buffer object. BUFFER_LISP_SIZE
is required for GC, but BUFFER_REST_SIZE is set up just to be consistent is required for GC, but BUFFER_REST_SIZE is set up just to be consistent
......
...@@ -427,7 +427,7 @@ static struct Lisp_Module_Function * ...@@ -427,7 +427,7 @@ static struct Lisp_Module_Function *
allocate_module_function (void) allocate_module_function (void)
{ {
return ALLOCATE_PSEUDOVECTOR (struct Lisp_Module_Function, return ALLOCATE_PSEUDOVECTOR (struct Lisp_Module_Function,
min_arity, PVEC_MODULE_FUNCTION); documentation, PVEC_MODULE_FUNCTION);
} }
#define XSET_MODULE_FUNCTION(var, ptr) \ #define XSET_MODULE_FUNCTION(var, ptr) \
......
...@@ -3904,7 +3904,7 @@ static struct Lisp_Hash_Table * ...@@ -3904,7 +3904,7 @@ static struct Lisp_Hash_Table *
allocate_hash_table (void) allocate_hash_table (void)
{ {
return ALLOCATE_PSEUDOVECTOR (struct Lisp_Hash_Table, return ALLOCATE_PSEUDOVECTOR (struct Lisp_Hash_Table,
count, PVEC_HASH_TABLE); index, PVEC_HASH_TABLE);
} }
/* An upper bound on the size of a hash table index. It must fit in /* An upper bound on the size of a hash table index. It must fit in
......
...@@ -798,7 +798,8 @@ adjust_frame_size (struct frame *f, int new_width, int new_height, int inhibit, ...@@ -798,7 +798,8 @@ adjust_frame_size (struct frame *f, int new_width, int new_height, int inhibit,
static struct frame * static struct frame *
allocate_frame (void) allocate_frame (void)
{ {
return ALLOCATE_ZEROED_PSEUDOVECTOR (struct frame, face_cache, PVEC_FRAME); return ALLOCATE_ZEROED_PSEUDOVECTOR (struct frame, tool_bar_items,
PVEC_FRAME);
} }
struct frame * struct frame *
......
...@@ -190,9 +190,6 @@ struct frame ...@@ -190,9 +190,6 @@ struct frame
Lisp_Object current_tool_bar_string; Lisp_Object current_tool_bar_string;
#endif #endif
/* Desired and current tool-bar items. */
Lisp_Object tool_bar_items;
#ifdef USE_GTK #ifdef USE_GTK
/* Where tool bar is, can be left, right, top or bottom. /* Where tool bar is, can be left, right, top or bottom.
Except with GTK, the only supported position is `top'. */ Except with GTK, the only supported position is `top'. */
...@@ -204,7 +201,9 @@ struct frame ...@@ -204,7 +201,9 @@ struct frame
Lisp_Object font_data; Lisp_Object font_data;
#endif #endif
/* Beyond here, there should be no more Lisp_Object components. */ /* Desired and current tool-bar items. */
Lisp_Object tool_bar_items;
/* tool_bar_items should be the last Lisp_Object member. */
/* Cache of realized faces. */ /* Cache of realized faces. */
struct face_cache *face_cache; struct face_cache *face_cache;
......
...@@ -1904,9 +1904,9 @@ memclear (void *p, ptrdiff_t nbytes) ...@@ -1904,9 +1904,9 @@ memclear (void *p, ptrdiff_t nbytes)
at the end and we need to compute the number of Lisp_Object fields (the at the end and we need to compute the number of Lisp_Object fields (the
ones that the GC needs to trace). */ ones that the GC needs to trace). */
#define PSEUDOVECSIZE(type, nonlispfield) \ #define PSEUDOVECSIZE(type, lastlispfield) \
(offsetof (type, nonlispfield) < header_size \ (offsetof (type, lastlispfield) + word_size < header_size \
? 0 : (offsetof (type, nonlispfield) - header_size) / word_size) ? 0 : (offsetof (type, lastlispfield) + word_size - header_size) / word_size)
/* Compute A OP B, using the unsigned comparison operator OP. A and B /* Compute A OP B, using the unsigned comparison operator OP. A and B
should be integer expressions. This is not the same as should be integer expressions. This is not the same as
...@@ -2109,11 +2109,14 @@ enum char_table_specials ...@@ -2109,11 +2109,14 @@ enum char_table_specials
/* This is the number of slots that every char table must have. This /* This is the number of slots that every char table must have. This
counts the ordinary slots and the top, defalt, parent, and purpose counts the ordinary slots and the top, defalt, parent, and purpose
slots. */ slots. */
CHAR_TABLE_STANDARD_SLOTS = PSEUDOVECSIZE (struct Lisp_Char_Table, extras), CHAR_TABLE_STANDARD_SLOTS
= (PSEUDOVECSIZE (struct Lisp_Char_Table, contents) - 1
+ (1 << CHARTAB_SIZE_BITS_0)),
/* This is an index of first Lisp_Object field in Lisp_Sub_Char_Table /* This is the index of the first Lisp_Object field in Lisp_Sub_Char_Table
when the latter is treated as an ordinary Lisp_Vector. */ when the latter is treated as an ordinary Lisp_Vector. */
SUB_CHAR_TABLE_OFFSET = PSEUDOVECSIZE (struct Lisp_Sub_Char_Table, contents) SUB_CHAR_TABLE_OFFSET
= PSEUDOVECSIZE (struct Lisp_Sub_Char_Table, contents) - 1
}; };
/* Sanity-check pseudovector layout. */ /* Sanity-check pseudovector layout. */
...@@ -2313,8 +2316,8 @@ struct Lisp_Hash_Table ...@@ -2313,8 +2316,8 @@ struct Lisp_Hash_Table
hash table size to reduce collisions. */ hash table size to reduce collisions. */
Lisp_Object index; Lisp_Object index;
/* Only the fields above are traced normally by the GC. The ones below /* Only the fields above are traced normally by the GC. The ones after
`count' are special and are either ignored by the GC or traced in 'index' are special and are either ignored by the GC or traced in
a special way (e.g. because of weakness). */ a special way (e.g. because of weakness). */
/* Number of key/value entries in the table. */ /* Number of key/value entries in the table. */
...@@ -3940,6 +3943,11 @@ make_nil_vector (ptrdiff_t size) ...@@ -3940,6 +3943,11 @@ make_nil_vector (ptrdiff_t size)
extern struct Lisp_Vector *allocate_pseudovector (int, int, int, extern struct Lisp_Vector *allocate_pseudovector (int, int, int,
enum pvec_type); enum pvec_type);
/* Allocate uninitialized pseudovector with no Lisp_Object slots. */
#define ALLOCATE_PLAIN_PSEUDOVECTOR(type, tag) \
((type *) allocate_pseudovector (VECSIZE (type), 0, 0, tag))
/* Allocate partially initialized pseudovector where all Lisp_Object /* Allocate partially initialized pseudovector where all Lisp_Object
slots are set to Qnil but the rest (if any) is left uninitialized. */ slots are set to Qnil but the rest (if any) is left uninitialized. */
......
...@@ -2702,7 +2702,7 @@ dump_hash_table (struct dump_context *ctx, ...@@ -2702,7 +2702,7 @@ dump_hash_table (struct dump_context *ctx,
Lisp_Object object, Lisp_Object object,
dump_off offset) dump_off offset)
{ {
#if CHECK_STRUCTS && !defined (HASH_Lisp_Hash_Table_73C9BFB7D1) #if CHECK_STRUCTS && !defined HASH_Lisp_Hash_Table_EF95ED06FF
# error "Lisp_Hash_Table changed. See CHECK_STRUCTS comment." # error "Lisp_Hash_Table changed. See CHECK_STRUCTS comment."
#endif #endif
const struct Lisp_Hash_Table *hash_in = XHASH_TABLE (object); const struct Lisp_Hash_Table *hash_in = XHASH_TABLE (object);
...@@ -2770,7 +2770,7 @@ dump_hash_table (struct dump_context *ctx, ...@@ -2770,7 +2770,7 @@ dump_hash_table (struct dump_context *ctx,
static dump_off static dump_off
dump_buffer (struct dump_context *ctx, const struct buffer *in_buffer) dump_buffer (struct dump_context *ctx, const struct buffer *in_buffer)
{ {
#if CHECK_STRUCTS && !defined HASH_buffer_2CEE653E74 #if CHECK_STRUCTS && !defined HASH_buffer_E34A11C6B9
# error "buffer changed. See CHECK_STRUCTS comment." # error "buffer changed. See CHECK_STRUCTS comment."
#endif #endif
struct buffer munged_buffer = *in_buffer; struct buffer munged_buffer = *in_buffer;
......
...@@ -858,7 +858,8 @@ allocate_pty (char pty_name[PTY_NAME_SIZE]) ...@@ -858,7 +858,8 @@ allocate_pty (char pty_name[PTY_NAME_SIZE])
static struct Lisp_Process * static struct Lisp_Process *
allocate_process (void) allocate_process (void)
{ {
return ALLOCATE_ZEROED_PSEUDOVECTOR (struct Lisp_Process, pid, PVEC_PROCESS); return ALLOCATE_ZEROED_PSEUDOVECTOR (struct Lisp_Process, thread,
PVEC_PROCESS);
} }
static Lisp_Object static Lisp_Object
......
...@@ -117,9 +117,7 @@ struct Lisp_Process ...@@ -117,9 +117,7 @@ struct Lisp_Process
/* The thread a process is linked to, or nil for any thread. */ /* The thread a process is linked to, or nil for any thread. */
Lisp_Object thread; Lisp_Object thread;
/* After this point, there are no Lisp_Objects. */
/* After this point, there are no Lisp_Objects any more. */
/* alloc.c assumes that `pid' is the first such non-Lisp slot. */
/* Process ID. A positive value is a child process ID. /* Process ID. A positive value is a child process ID.
Zero is for pseudo-processes such as network or serial connections, Zero is for pseudo-processes such as network or serial connections,
......
...@@ -408,7 +408,7 @@ struct terminal ...@@ -408,7 +408,7 @@ struct terminal
whether the mapping is available. */ whether the mapping is available. */
Lisp_Object glyph_code_table; Lisp_Object glyph_code_table;
/* All fields before `next_terminal' should be Lisp_Object and are traced /* All earlier fields should be Lisp_Objects and are traced
by the GC. All fields afterwards are ignored by the GC. */ by the GC. All fields afterwards are ignored by the GC. */
/* Chain of all terminal devices. */ /* Chain of all terminal devices. */
......
...@@ -264,8 +264,8 @@ get_named_terminal (const char *name) ...@@ -264,8 +264,8 @@ get_named_terminal (const char *name)
static struct terminal * static struct terminal *
allocate_terminal (void) allocate_terminal (void)
{ {
return ALLOCATE_ZEROED_PSEUDOVECTOR return ALLOCATE_ZEROED_PSEUDOVECTOR (struct terminal, glyph_code_table,
(struct terminal, next_terminal, PVEC_TERMINAL); PVEC_TERMINAL);
} }
/* Create a new terminal object of TYPE and add it to the terminal list. RIF /* Create a new terminal object of TYPE and add it to the terminal list. RIF
......
...@@ -267,7 +267,7 @@ informational only. */) ...@@ -267,7 +267,7 @@ informational only. */)
if (!NILP (name)) if (!NILP (name))
CHECK_STRING (name); CHECK_STRING (name);
mutex = ALLOCATE_PSEUDOVECTOR (struct Lisp_Mutex, mutex, PVEC_MUTEX); mutex = ALLOCATE_PSEUDOVECTOR (struct Lisp_Mutex, name, PVEC_MUTEX);
memset ((char *) mutex + offsetof (struct Lisp_Mutex, mutex), memset ((char *) mutex + offsetof (struct Lisp_Mutex, mutex),
0, sizeof (struct Lisp_Mutex) - offsetof (struct Lisp_Mutex, 0, sizeof (struct Lisp_Mutex) - offsetof (struct Lisp_Mutex,
mutex)); mutex));
...@@ -386,7 +386,7 @@ informational only. */) ...@@ -386,7 +386,7 @@ informational only. */)
if (!NILP (name)) if (!NILP (name))
CHECK_STRING (name); CHECK_STRING (name);
condvar = ALLOCATE_PSEUDOVECTOR (struct Lisp_CondVar, cond, PVEC_CONDVAR); condvar = ALLOCATE_PSEUDOVECTOR (struct Lisp_CondVar, name, PVEC_CONDVAR);
memset ((char *) condvar + offsetof (struct Lisp_CondVar, cond), memset ((char *) condvar + offsetof (struct Lisp_CondVar, cond),
0, sizeof (struct Lisp_CondVar) - offsetof (struct Lisp_CondVar, 0, sizeof (struct Lisp_CondVar) - offsetof (struct Lisp_CondVar,
cond)); cond));
...@@ -805,7 +805,7 @@ If NAME is given, it must be a string; it names the new thread. */) ...@@ -805,7 +805,7 @@ If NAME is given, it must be a string; it names the new thread. */)
if (!NILP (name)) if (!NILP (name))
CHECK_STRING (name); CHECK_STRING (name);
new_thread = ALLOCATE_PSEUDOVECTOR (struct thread_state, m_stack_bottom, new_thread = ALLOCATE_PSEUDOVECTOR (struct thread_state, event_object,
PVEC_THREAD); PVEC_THREAD);
memset ((char *) new_thread + offset, 0, memset ((char *) new_thread + offset, 0,
sizeof (struct thread_state) - offset); sizeof (struct thread_state) - offset);
...@@ -1064,7 +1064,7 @@ static void ...@@ -1064,7 +1064,7 @@ static void
init_main_thread (void) init_main_thread (void)
{ {
main_thread.s.header.size main_thread.s.header.size
= PSEUDOVECSIZE (struct thread_state, m_stack_bottom); = PSEUDOVECSIZE (struct thread_state, event_object);
XSETPVECTYPE (&main_thread.s, PVEC_THREAD); XSETPVECTYPE (&main_thread.s, PVEC_THREAD);
main_thread.s.m_last_thing_searched = Qnil; main_thread.s.m_last_thing_searched = Qnil;
main_thread.s.m_saved_last_thing_searched = Qnil; main_thread.s.m_saved_last_thing_searched = Qnil;
......
...@@ -61,8 +61,8 @@ struct thread_state ...@@ -61,8 +61,8 @@ struct thread_state
/* If we are waiting for some event, this holds the object we are /* If we are waiting for some event, this holds the object we are
waiting on. */ waiting on. */
Lisp_Object event_object; Lisp_Object event_object;
/* event_object must be the last Lisp field. */
/* m_stack_bottom must be the first non-Lisp field. */
/* An address near the bottom of the stack. /* An address near the bottom of the stack.
Tells GC how to save a copy of the stack. */ Tells GC how to save a copy of the stack. */
char const *m_stack_bottom; char const *m_stack_bottom;
......
...@@ -3896,7 +3896,7 @@ x_scroll_bar_create (struct window *w, int left, int top, int width, int height, ...@@ -3896,7 +3896,7 @@ x_scroll_bar_create (struct window *w, int left, int top, int width, int height,
HWND hwnd; HWND hwnd;
SCROLLINFO si; SCROLLINFO si;
struct scroll_bar *bar struct scroll_bar *bar
= ALLOCATE_PSEUDOVECTOR (struct scroll_bar, top, PVEC_OTHER); = ALLOCATE_PSEUDOVECTOR (struct scroll_bar, w32_widget_high, PVEC_OTHER);
Lisp_Object barobj; Lisp_Object barobj;
block_input (); block_input ();
......
...@@ -4170,8 +4170,8 @@ temp_output_buffer_show (register Lisp_Object buf) ...@@ -4170,8 +4170,8 @@ temp_output_buffer_show (register Lisp_Object buf)
static struct window * static struct window *
allocate_window (void) allocate_window (void)
{ {
return ALLOCATE_ZEROED_PSEUDOVECTOR return ALLOCATE_ZEROED_PSEUDOVECTOR (struct window, mode_line_help_echo,
(struct window, current_matrix, PVEC_WINDOW); PVEC_WINDOW);
} }
/* Make new window, have it replace WINDOW in window-tree, and make /* Make new window, have it replace WINDOW in window-tree, and make
...@@ -6710,7 +6710,8 @@ struct save_window_data ...@@ -6710,7 +6710,8 @@ struct save_window_data
Lisp_Object saved_windows; Lisp_Object saved_windows;
/* All fields above are traced by the GC. /* All fields above are traced by the GC.
From `frame-cols' down, the fields are ignored by the GC. */ After saved_windows, the fields are ignored by the GC. */
/* We should be able to do without the following two. */ /* We should be able to do without the following two. */
int frame_cols, frame_lines; int frame_cols, frame_lines;
/* These two should get eventually replaced by their pixel /* These two should get eventually replaced by their pixel
...@@ -7383,15 +7384,11 @@ redirection (see `redirect-frame-focus'). The variable ...@@ -7383,15 +7384,11 @@ redirection (see `redirect-frame-focus'). The variable
saved by this function. */) saved by this function. */)
(Lisp_Object frame) (Lisp_Object frame)
{ {
Lisp_Object tem;
ptrdiff_t i, n_windows;
struct save_window_data *data;
struct frame *f = decode_live_frame (frame); struct frame *f = decode_live_frame (frame);
ptrdiff_t n_windows = count_windows (XWINDOW (FRAME_ROOT_WINDOW (f)));
n_windows = count_windows (XWINDOW (FRAME_ROOT_WINDOW (f))); struct save_window_data *data
data = ALLOCATE_PSEUDOVECTOR (struct save_window_data, frame_cols, = ALLOCATE_PSEUDOVECTOR (struct save_window_data, saved_windows,
PVEC_WINDOW_CONFIGURATION); PVEC_WINDOW_CONFIGURATION);
data->frame_cols = FRAME_COLS (f); data->frame_cols = FRAME_COLS (f);
data->frame_lines = FRAME_LINES (f); data->frame_lines = FRAME_LINES (f);
data->frame_menu_bar_lines = FRAME_MENU_BAR_LINES (f); data->frame_menu_bar_lines = FRAME_MENU_BAR_LINES (f);
...@@ -7407,9 +7404,9 @@ saved by this function. */) ...@@ -7407,9 +7404,9 @@ saved by this function. */)
data->minibuf_selected_window = minibuf_level > 0 ? minibuf_selected_window : Qnil; data->minibuf_selected_window = minibuf_level > 0 ? minibuf_selected_window : Qnil;
data->root_window = FRAME_ROOT_WINDOW (f); data->root_window = FRAME_ROOT_WINDOW (f);
data->focus_frame = FRAME_FOCUS_FRAME (f); data->focus_frame = FRAME_FOCUS_FRAME (f);
tem = make_uninit_vector (n_windows); Lisp_Object tem = make_uninit_vector (n_windows);
data->saved_windows = tem; data->saved_windows = tem;
for (i = 0; i < n_windows; i++) for (ptrdiff_t i = 0; i < n_windows; i++)
ASET (tem, i, make_nil_vector (VECSIZE (struct saved_window))); ASET (tem, i, make_nil_vector (VECSIZE (struct saved_window)));
save_window_save (FRAME_ROOT_WINDOW (f), XVECTOR (tem), 0); save_window_save (FRAME_ROOT_WINDOW (f), XVECTOR (tem), 0);
XSETWINDOW_CONFIGURATION (tem, data); XSETWINDOW_CONFIGURATION (tem, data);
......
...@@ -212,9 +212,8 @@ struct window ...@@ -212,9 +212,8 @@ struct window
/* The help echo text for this window. Qnil if there's none. */ /* The help echo text for this window. Qnil if there's none. */
Lisp_Object mode_line_help_echo; Lisp_Object mode_line_help_echo;
/* No Lisp data may follow below this point without changing /* No Lisp data may follow this point; mode_line_help_echo must be
mark_object in alloc.c. The member current_matrix must be the the last Lisp member. */
first non-Lisp member. */
/* Glyph matrices. */ /* Glyph matrices. */
struct glyph_matrix *current_matrix; struct glyph_matrix *current_matrix;
......
...@@ -6611,8 +6611,8 @@ x_scroll_bar_create (struct window *w, int top, int left, ...@@ -6611,8 +6611,8 @@ x_scroll_bar_create (struct window *w, int top, int left,
int width, int height, bool horizontal) int width, int height, bool horizontal)
{ {
struct frame *f = XFRAME (w->frame); struct frame *f = XFRAME (w->frame);
struct scroll_bar *bar struct scroll_bar *bar = ALLOCATE_PSEUDOVECTOR (struct scroll_bar, prev,
= ALLOCATE_PSEUDOVECTOR (struct scroll_bar, x_window, PVEC_OTHER); PVEC_OTHER);
Lisp_Object barobj; Lisp_Object barobj;
block_input (); block_input ();
......
...@@ -897,7 +897,7 @@ struct scroll_bar ...@@ -897,7 +897,7 @@ struct scroll_bar
/* The next and previous in the chain of scroll bars in this frame. */ /* The next and previous in the chain of scroll bars in this frame. */
Lisp_Object next, prev; Lisp_Object next, prev;
/* Fields from `x_window' down will not be traced by the GC. */ /* Fields after 'prev' are not traced by the GC. */
/* The X window representing this scroll bar. */ /* The X window representing this scroll bar. */
Window x_window; Window x_window;
......
...@@ -41,14 +41,13 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ ...@@ -41,14 +41,13 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
static struct xwidget * static struct xwidget *
allocate_xwidget (void) allocate_xwidget (void)
{ {
return ALLOCATE_PSEUDOVECTOR (struct xwidget, height, PVEC_XWIDGET); return ALLOCATE_PSEUDOVECTOR (struct xwidget, script_callbacks, PVEC_XWIDGET);
} }
static struct xwidget_view * static struct xwidget_view *
allocate_xwidget_view (void) allocate_xwidget_view (void)
{ {
return ALLOCATE_PSEUDOVECTOR (struct xwidget_view, redisplayed, return ALLOCATE_PSEUDOVECTOR (struct xwidget_view, w, PVEC_XWIDGET_VIEW);
PVEC_XWIDGET_VIEW);
} }
#define XSETXWIDGET(a, b) XSETPSEUDOVECTOR (a, b, PVEC_XWIDGET) #define XSETXWIDGET(a, b) XSETPSEUDOVECTOR (a, b, PVEC_XWIDGET)
......
...@@ -49,8 +49,7 @@ struct xwidget ...@@ -49,8 +49,7 @@ struct xwidget
/* Vector of currently executing scripts with callbacks. */ /* Vector of currently executing scripts with callbacks. */
Lisp_Object script_callbacks; Lisp_Object script_callbacks;
/* Here ends the Lisp part. script_callbacks is the marker field. */
/* Here ends the Lisp part. "height" is the marker field. */
int height; int height;
int width; int width;
...@@ -68,8 +67,7 @@ struct xwidget_view ...@@ -68,8 +67,7 @@ struct xwidget_view
union vectorlike_header header; union vectorlike_header header;
Lisp_Object model; Lisp_Object model;
Lisp_Object w; Lisp_Object w;
/* Here ends the lisp part. "w" is the marker field. */
/* Here ends the lisp part. "redisplayed" is the marker field. */
/* If touched by redisplay. */ /* If touched by redisplay. */
bool redisplayed; bool redisplayed;
......
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