aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2019-04-08 12:59:22 -0700
committerPaul Eggert2019-04-08 13:01:21 -0700
commita038df77de7b1aa2d73a6478493b8838b59e4982 (patch)
treefbaa0087bab52a815dfd249d189301e53de0d345 /src
parent31e9087cdcd0b78b2247c3d8532290881abfbb08 (diff)
downloademacs-a038df77de7b1aa2d73a6478493b8838b59e4982.tar.gz
emacs-a038df77de7b1aa2d73a6478493b8838b59e4982.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/alloc.c20
-rw-r--r--src/bignum.c8
-rw-r--r--src/buffer.h14
-rw-r--r--src/emacs-module.c2
-rw-r--r--src/fns.c2
-rw-r--r--src/frame.c3
-rw-r--r--src/frame.h7
-rw-r--r--src/lisp.h24
-rw-r--r--src/pdumper.c4
-rw-r--r--src/process.c3
-rw-r--r--src/process.h4
-rw-r--r--src/termhooks.h2
-rw-r--r--src/terminal.c4
-rw-r--r--src/thread.c8
-rw-r--r--src/thread.h2
-rw-r--r--src/w32term.c2
-rw-r--r--src/window.c23
-rw-r--r--src/window.h5
-rw-r--r--src/xterm.c4
-rw-r--r--src/xterm.h2
-rw-r--r--src/xwidget.c5
-rw-r--r--src/xwidget.h6
22 files changed, 76 insertions, 78 deletions
diff --git a/src/alloc.c b/src/alloc.c
index e48807c49ad..dd783863be8 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -3718,8 +3718,8 @@ Its value is void, and its function definition and property list are nil. */)
3718Lisp_Object 3718Lisp_Object
3719make_misc_ptr (void *a) 3719make_misc_ptr (void *a)
3720{ 3720{
3721 struct Lisp_Misc_Ptr *p = ALLOCATE_PSEUDOVECTOR (struct Lisp_Misc_Ptr, pointer, 3721 struct Lisp_Misc_Ptr *p = ALLOCATE_PLAIN_PSEUDOVECTOR (struct Lisp_Misc_Ptr,
3722 PVEC_MISC_PTR); 3722 PVEC_MISC_PTR);
3723 p->pointer = a; 3723 p->pointer = a;
3724 return make_lisp_ptr (p, Lisp_Vectorlike); 3724 return make_lisp_ptr (p, Lisp_Vectorlike);
3725} 3725}
@@ -3729,7 +3729,7 @@ make_misc_ptr (void *a)
3729Lisp_Object 3729Lisp_Object
3730build_overlay (Lisp_Object start, Lisp_Object end, Lisp_Object plist) 3730build_overlay (Lisp_Object start, Lisp_Object end, Lisp_Object plist)
3731{ 3731{
3732 struct Lisp_Overlay *p = ALLOCATE_PSEUDOVECTOR (struct Lisp_Overlay, next, 3732 struct Lisp_Overlay *p = ALLOCATE_PSEUDOVECTOR (struct Lisp_Overlay, plist,
3733 PVEC_OVERLAY); 3733 PVEC_OVERLAY);
3734 Lisp_Object overlay = make_lisp_ptr (p, Lisp_Vectorlike); 3734 Lisp_Object overlay = make_lisp_ptr (p, Lisp_Vectorlike);
3735 OVERLAY_START (overlay) = start; 3735 OVERLAY_START (overlay) = start;
@@ -3743,8 +3743,8 @@ DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 0,
3743 doc: /* Return a newly allocated marker which does not point at any place. */) 3743 doc: /* Return a newly allocated marker which does not point at any place. */)
3744 (void) 3744 (void)
3745{ 3745{
3746 struct Lisp_Marker *p = ALLOCATE_PSEUDOVECTOR (struct Lisp_Marker, buffer, 3746 struct Lisp_Marker *p = ALLOCATE_PLAIN_PSEUDOVECTOR (struct Lisp_Marker,
3747 PVEC_MARKER); 3747 PVEC_MARKER);
3748 p->buffer = 0; 3748 p->buffer = 0;
3749 p->bytepos = 0; 3749 p->bytepos = 0;
3750 p->charpos = 0; 3750 p->charpos = 0;
@@ -3766,8 +3766,8 @@ build_marker (struct buffer *buf, ptrdiff_t charpos, ptrdiff_t bytepos)
3766 /* Every character is at least one byte. */ 3766 /* Every character is at least one byte. */
3767 eassert (charpos <= bytepos); 3767 eassert (charpos <= bytepos);
3768 3768
3769 struct Lisp_Marker *m = ALLOCATE_PSEUDOVECTOR (struct Lisp_Marker, buffer, 3769 struct Lisp_Marker *m = ALLOCATE_PLAIN_PSEUDOVECTOR (struct Lisp_Marker,
3770 PVEC_MARKER); 3770 PVEC_MARKER);
3771 m->buffer = buf; 3771 m->buffer = buf;
3772 m->charpos = charpos; 3772 m->charpos = charpos;
3773 m->bytepos = bytepos; 3773 m->bytepos = bytepos;
@@ -3821,8 +3821,8 @@ make_event_array (ptrdiff_t nargs, Lisp_Object *args)
3821Lisp_Object 3821Lisp_Object
3822make_user_ptr (void (*finalizer) (void *), void *p) 3822make_user_ptr (void (*finalizer) (void *), void *p)
3823{ 3823{
3824 struct Lisp_User_Ptr *uptr = ALLOCATE_PSEUDOVECTOR (struct Lisp_User_Ptr, 3824 struct Lisp_User_Ptr *uptr
3825 finalizer, PVEC_USER_PTR); 3825 = ALLOCATE_PLAIN_PSEUDOVECTOR (struct Lisp_User_Ptr, PVEC_USER_PTR);
3826 uptr->finalizer = finalizer; 3826 uptr->finalizer = finalizer;
3827 uptr->p = p; 3827 uptr->p = p;
3828 return make_lisp_ptr (uptr, Lisp_Vectorlike); 3828 return make_lisp_ptr (uptr, Lisp_Vectorlike);
@@ -3945,7 +3945,7 @@ FUNCTION. FUNCTION will be run once per finalizer object. */)
3945 (Lisp_Object function) 3945 (Lisp_Object function)
3946{ 3946{
3947 struct Lisp_Finalizer *finalizer 3947 struct Lisp_Finalizer *finalizer
3948 = ALLOCATE_PSEUDOVECTOR (struct Lisp_Finalizer, prev, PVEC_FINALIZER); 3948 = ALLOCATE_PSEUDOVECTOR (struct Lisp_Finalizer, function, PVEC_FINALIZER);
3949 finalizer->function = function; 3949 finalizer->function = function;
3950 finalizer->prev = finalizer->next = NULL; 3950 finalizer->prev = finalizer->next = NULL;
3951 finalizer_insert (&finalizers, finalizer); 3951 finalizer_insert (&finalizers, finalizer);
diff --git a/src/bignum.c b/src/bignum.c
index 4118601e108..009d73118c2 100644
--- a/src/bignum.c
+++ b/src/bignum.c
@@ -86,8 +86,8 @@ make_bignum_bits (size_t bits)
86 if (integer_width < bits) 86 if (integer_width < bits)
87 overflow_error (); 87 overflow_error ();
88 88
89 struct Lisp_Bignum *b = ALLOCATE_PSEUDOVECTOR (struct Lisp_Bignum, value, 89 struct Lisp_Bignum *b = ALLOCATE_PLAIN_PSEUDOVECTOR (struct Lisp_Bignum,
90 PVEC_BIGNUM); 90 PVEC_BIGNUM);
91 mpz_init (b->value); 91 mpz_init (b->value);
92 mpz_swap (b->value, mpz[0]); 92 mpz_swap (b->value, mpz[0]);
93 return make_lisp_ptr (b, Lisp_Vectorlike); 93 return make_lisp_ptr (b, Lisp_Vectorlike);
@@ -342,8 +342,8 @@ bignum_to_string (Lisp_Object num, int base)
342Lisp_Object 342Lisp_Object
343make_bignum_str (char const *num, int base) 343make_bignum_str (char const *num, int base)
344{ 344{
345 struct Lisp_Bignum *b = ALLOCATE_PSEUDOVECTOR (struct Lisp_Bignum, value, 345 struct Lisp_Bignum *b = ALLOCATE_PLAIN_PSEUDOVECTOR (struct Lisp_Bignum,
346 PVEC_BIGNUM); 346 PVEC_BIGNUM);
347 mpz_init (b->value); 347 mpz_init (b->value);
348 int check = mpz_set_str (b->value, num, base); 348 int check = mpz_set_str (b->value, num, base);
349 eassert (check == 0); 349 eassert (check == 0);
diff --git a/src/buffer.h b/src/buffer.h
index 63b162161c6..f42c3e97b97 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -741,8 +741,8 @@ struct buffer
741 See `cursor-type' for other values. */ 741 See `cursor-type' for other values. */
742 Lisp_Object cursor_in_non_selected_windows_; 742 Lisp_Object cursor_in_non_selected_windows_;
743 743
744 /* No more Lisp_Object beyond this point. Except undo_list, 744 /* No more Lisp_Object beyond cursor_in_non_selected_windows_.
745 which is handled specially in Fgarbage_collect. */ 745 Except undo_list, which is handled specially in Fgarbage_collect. */
746 746
747 /* This structure holds the coordinates of the buffer contents 747 /* This structure holds the coordinates of the buffer contents
748 in ordinary buffers. In indirect buffers, this is not used. */ 748 in ordinary buffers. In indirect buffers, this is not used. */
@@ -1019,14 +1019,12 @@ bset_width_table (struct buffer *b, Lisp_Object val)
1019 structure, make sure that this is still correct. */ 1019 structure, make sure that this is still correct. */
1020 1020
1021#define BUFFER_LISP_SIZE \ 1021#define BUFFER_LISP_SIZE \
1022 ((offsetof (struct buffer, own_text) - header_size) / word_size) 1022 PSEUDOVECSIZE (struct buffer, cursor_in_non_selected_windows_)
1023 1023
1024/* Size of the struct buffer part beyond leading Lisp_Objects, in word_size 1024/* Allocated size of the struct buffer part beyond leading
1025 units. Rounding is needed for --with-wide-int configuration. */ 1025 Lisp_Objects, in word_size units. */
1026 1026
1027#define BUFFER_REST_SIZE \ 1027#define BUFFER_REST_SIZE (VECSIZE (struct buffer) - BUFFER_LISP_SIZE)
1028 ((((sizeof (struct buffer) - offsetof (struct buffer, own_text)) \
1029 + (word_size - 1)) & ~(word_size - 1)) / word_size)
1030 1028
1031/* Initialize the pseudovector header of buffer object. BUFFER_LISP_SIZE 1029/* Initialize the pseudovector header of buffer object. BUFFER_LISP_SIZE
1032 is required for GC, but BUFFER_REST_SIZE is set up just to be consistent 1030 is required for GC, but BUFFER_REST_SIZE is set up just to be consistent
diff --git a/src/emacs-module.c b/src/emacs-module.c
index 2bb1062574e..47ca3368c0f 100644
--- a/src/emacs-module.c
+++ b/src/emacs-module.c
@@ -427,7 +427,7 @@ static struct Lisp_Module_Function *
427allocate_module_function (void) 427allocate_module_function (void)
428{ 428{
429 return ALLOCATE_PSEUDOVECTOR (struct Lisp_Module_Function, 429 return ALLOCATE_PSEUDOVECTOR (struct Lisp_Module_Function,
430 min_arity, PVEC_MODULE_FUNCTION); 430 documentation, PVEC_MODULE_FUNCTION);
431} 431}
432 432
433#define XSET_MODULE_FUNCTION(var, ptr) \ 433#define XSET_MODULE_FUNCTION(var, ptr) \
diff --git a/src/fns.c b/src/fns.c
index b97b132b0fe..c3202495daf 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -3904,7 +3904,7 @@ static struct Lisp_Hash_Table *
3904allocate_hash_table (void) 3904allocate_hash_table (void)
3905{ 3905{
3906 return ALLOCATE_PSEUDOVECTOR (struct Lisp_Hash_Table, 3906 return ALLOCATE_PSEUDOVECTOR (struct Lisp_Hash_Table,
3907 count, PVEC_HASH_TABLE); 3907 index, PVEC_HASH_TABLE);
3908} 3908}
3909 3909
3910/* An upper bound on the size of a hash table index. It must fit in 3910/* An upper bound on the size of a hash table index. It must fit in
diff --git a/src/frame.c b/src/frame.c
index 6fdb7d0cbb9..192ef4244fb 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -798,7 +798,8 @@ adjust_frame_size (struct frame *f, int new_width, int new_height, int inhibit,
798static struct frame * 798static struct frame *
799allocate_frame (void) 799allocate_frame (void)
800{ 800{
801 return ALLOCATE_ZEROED_PSEUDOVECTOR (struct frame, face_cache, PVEC_FRAME); 801 return ALLOCATE_ZEROED_PSEUDOVECTOR (struct frame, tool_bar_items,
802 PVEC_FRAME);
802} 803}
803 804
804struct frame * 805struct frame *
diff --git a/src/frame.h b/src/frame.h
index ed62e7ace0f..ec8f61465f2 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -190,9 +190,6 @@ struct frame
190 Lisp_Object current_tool_bar_string; 190 Lisp_Object current_tool_bar_string;
191#endif 191#endif
192 192
193 /* Desired and current tool-bar items. */
194 Lisp_Object tool_bar_items;
195
196#ifdef USE_GTK 193#ifdef USE_GTK
197 /* Where tool bar is, can be left, right, top or bottom. 194 /* Where tool bar is, can be left, right, top or bottom.
198 Except with GTK, the only supported position is `top'. */ 195 Except with GTK, the only supported position is `top'. */
@@ -204,7 +201,9 @@ struct frame
204 Lisp_Object font_data; 201 Lisp_Object font_data;
205#endif 202#endif
206 203
207 /* Beyond here, there should be no more Lisp_Object components. */ 204 /* Desired and current tool-bar items. */
205 Lisp_Object tool_bar_items;
206 /* tool_bar_items should be the last Lisp_Object member. */
208 207
209 /* Cache of realized faces. */ 208 /* Cache of realized faces. */
210 struct face_cache *face_cache; 209 struct face_cache *face_cache;
diff --git a/src/lisp.h b/src/lisp.h
index a0a7cbdf518..681efc3b52b 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1904,9 +1904,9 @@ memclear (void *p, ptrdiff_t nbytes)
1904 at the end and we need to compute the number of Lisp_Object fields (the 1904 at the end and we need to compute the number of Lisp_Object fields (the
1905 ones that the GC needs to trace). */ 1905 ones that the GC needs to trace). */
1906 1906
1907#define PSEUDOVECSIZE(type, nonlispfield) \ 1907#define PSEUDOVECSIZE(type, lastlispfield) \
1908 (offsetof (type, nonlispfield) < header_size \ 1908 (offsetof (type, lastlispfield) + word_size < header_size \
1909 ? 0 : (offsetof (type, nonlispfield) - header_size) / word_size) 1909 ? 0 : (offsetof (type, lastlispfield) + word_size - header_size) / word_size)
1910 1910
1911/* Compute A OP B, using the unsigned comparison operator OP. A and B 1911/* Compute A OP B, using the unsigned comparison operator OP. A and B
1912 should be integer expressions. This is not the same as 1912 should be integer expressions. This is not the same as
@@ -2109,11 +2109,14 @@ enum char_table_specials
2109 /* This is the number of slots that every char table must have. This 2109 /* This is the number of slots that every char table must have. This
2110 counts the ordinary slots and the top, defalt, parent, and purpose 2110 counts the ordinary slots and the top, defalt, parent, and purpose
2111 slots. */ 2111 slots. */
2112 CHAR_TABLE_STANDARD_SLOTS = PSEUDOVECSIZE (struct Lisp_Char_Table, extras), 2112 CHAR_TABLE_STANDARD_SLOTS
2113 = (PSEUDOVECSIZE (struct Lisp_Char_Table, contents) - 1
2114 + (1 << CHARTAB_SIZE_BITS_0)),
2113 2115
2114 /* This is an index of first Lisp_Object field in Lisp_Sub_Char_Table 2116 /* This is the index of the first Lisp_Object field in Lisp_Sub_Char_Table
2115 when the latter is treated as an ordinary Lisp_Vector. */ 2117 when the latter is treated as an ordinary Lisp_Vector. */
2116 SUB_CHAR_TABLE_OFFSET = PSEUDOVECSIZE (struct Lisp_Sub_Char_Table, contents) 2118 SUB_CHAR_TABLE_OFFSET
2119 = PSEUDOVECSIZE (struct Lisp_Sub_Char_Table, contents) - 1
2117 }; 2120 };
2118 2121
2119/* Sanity-check pseudovector layout. */ 2122/* Sanity-check pseudovector layout. */
@@ -2313,8 +2316,8 @@ struct Lisp_Hash_Table
2313 hash table size to reduce collisions. */ 2316 hash table size to reduce collisions. */
2314 Lisp_Object index; 2317 Lisp_Object index;
2315 2318
2316 /* Only the fields above are traced normally by the GC. The ones below 2319 /* Only the fields above are traced normally by the GC. The ones after
2317 `count' are special and are either ignored by the GC or traced in 2320 'index' are special and are either ignored by the GC or traced in
2318 a special way (e.g. because of weakness). */ 2321 a special way (e.g. because of weakness). */
2319 2322
2320 /* Number of key/value entries in the table. */ 2323 /* Number of key/value entries in the table. */
@@ -3940,6 +3943,11 @@ make_nil_vector (ptrdiff_t size)
3940extern struct Lisp_Vector *allocate_pseudovector (int, int, int, 3943extern struct Lisp_Vector *allocate_pseudovector (int, int, int,
3941 enum pvec_type); 3944 enum pvec_type);
3942 3945
3946/* Allocate uninitialized pseudovector with no Lisp_Object slots. */
3947
3948#define ALLOCATE_PLAIN_PSEUDOVECTOR(type, tag) \
3949 ((type *) allocate_pseudovector (VECSIZE (type), 0, 0, tag))
3950
3943/* Allocate partially initialized pseudovector where all Lisp_Object 3951/* Allocate partially initialized pseudovector where all Lisp_Object
3944 slots are set to Qnil but the rest (if any) is left uninitialized. */ 3952 slots are set to Qnil but the rest (if any) is left uninitialized. */
3945 3953
diff --git a/src/pdumper.c b/src/pdumper.c
index b19f206d1bd..cb2915cb203 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -2702,7 +2702,7 @@ dump_hash_table (struct dump_context *ctx,
2702 Lisp_Object object, 2702 Lisp_Object object,
2703 dump_off offset) 2703 dump_off offset)
2704{ 2704{
2705#if CHECK_STRUCTS && !defined (HASH_Lisp_Hash_Table_73C9BFB7D1) 2705#if CHECK_STRUCTS && !defined HASH_Lisp_Hash_Table_EF95ED06FF
2706# error "Lisp_Hash_Table changed. See CHECK_STRUCTS comment." 2706# error "Lisp_Hash_Table changed. See CHECK_STRUCTS comment."
2707#endif 2707#endif
2708 const struct Lisp_Hash_Table *hash_in = XHASH_TABLE (object); 2708 const struct Lisp_Hash_Table *hash_in = XHASH_TABLE (object);
@@ -2770,7 +2770,7 @@ dump_hash_table (struct dump_context *ctx,
2770static dump_off 2770static dump_off
2771dump_buffer (struct dump_context *ctx, const struct buffer *in_buffer) 2771dump_buffer (struct dump_context *ctx, const struct buffer *in_buffer)
2772{ 2772{
2773#if CHECK_STRUCTS && !defined HASH_buffer_2CEE653E74 2773#if CHECK_STRUCTS && !defined HASH_buffer_E34A11C6B9
2774# error "buffer changed. See CHECK_STRUCTS comment." 2774# error "buffer changed. See CHECK_STRUCTS comment."
2775#endif 2775#endif
2776 struct buffer munged_buffer = *in_buffer; 2776 struct buffer munged_buffer = *in_buffer;
diff --git a/src/process.c b/src/process.c
index 802ac026249..6770a5ed884 100644
--- a/src/process.c
+++ b/src/process.c
@@ -858,7 +858,8 @@ allocate_pty (char pty_name[PTY_NAME_SIZE])
858static struct Lisp_Process * 858static struct Lisp_Process *
859allocate_process (void) 859allocate_process (void)
860{ 860{
861 return ALLOCATE_ZEROED_PSEUDOVECTOR (struct Lisp_Process, pid, PVEC_PROCESS); 861 return ALLOCATE_ZEROED_PSEUDOVECTOR (struct Lisp_Process, thread,
862 PVEC_PROCESS);
862} 863}
863 864
864static Lisp_Object 865static Lisp_Object
diff --git a/src/process.h b/src/process.h
index d66aa062a54..5e957c4298e 100644
--- a/src/process.h
+++ b/src/process.h
@@ -117,9 +117,7 @@ struct Lisp_Process
117 117
118 /* The thread a process is linked to, or nil for any thread. */ 118 /* The thread a process is linked to, or nil for any thread. */
119 Lisp_Object thread; 119 Lisp_Object thread;
120 120 /* After this point, there are no Lisp_Objects. */
121 /* After this point, there are no Lisp_Objects any more. */
122 /* alloc.c assumes that `pid' is the first such non-Lisp slot. */
123 121
124 /* Process ID. A positive value is a child process ID. 122 /* Process ID. A positive value is a child process ID.
125 Zero is for pseudo-processes such as network or serial connections, 123 Zero is for pseudo-processes such as network or serial connections,
diff --git a/src/termhooks.h b/src/termhooks.h
index ca6782f461b..a92b981110d 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -408,7 +408,7 @@ struct terminal
408 whether the mapping is available. */ 408 whether the mapping is available. */
409 Lisp_Object glyph_code_table; 409 Lisp_Object glyph_code_table;
410 410
411 /* All fields before `next_terminal' should be Lisp_Object and are traced 411 /* All earlier fields should be Lisp_Objects and are traced
412 by the GC. All fields afterwards are ignored by the GC. */ 412 by the GC. All fields afterwards are ignored by the GC. */
413 413
414 /* Chain of all terminal devices. */ 414 /* Chain of all terminal devices. */
diff --git a/src/terminal.c b/src/terminal.c
index 1d7a965dd26..0ee0121e35e 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -264,8 +264,8 @@ get_named_terminal (const char *name)
264static struct terminal * 264static struct terminal *
265allocate_terminal (void) 265allocate_terminal (void)
266{ 266{
267 return ALLOCATE_ZEROED_PSEUDOVECTOR 267 return ALLOCATE_ZEROED_PSEUDOVECTOR (struct terminal, glyph_code_table,
268 (struct terminal, next_terminal, PVEC_TERMINAL); 268 PVEC_TERMINAL);
269} 269}
270 270
271/* Create a new terminal object of TYPE and add it to the terminal list. RIF 271/* Create a new terminal object of TYPE and add it to the terminal list. RIF
diff --git a/src/thread.c b/src/thread.c
index e51d6144347..670680f2b0d 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -267,7 +267,7 @@ informational only. */)
267 if (!NILP (name)) 267 if (!NILP (name))
268 CHECK_STRING (name); 268 CHECK_STRING (name);
269 269
270 mutex = ALLOCATE_PSEUDOVECTOR (struct Lisp_Mutex, mutex, PVEC_MUTEX); 270 mutex = ALLOCATE_PSEUDOVECTOR (struct Lisp_Mutex, name, PVEC_MUTEX);
271 memset ((char *) mutex + offsetof (struct Lisp_Mutex, mutex), 271 memset ((char *) mutex + offsetof (struct Lisp_Mutex, mutex),
272 0, sizeof (struct Lisp_Mutex) - offsetof (struct Lisp_Mutex, 272 0, sizeof (struct Lisp_Mutex) - offsetof (struct Lisp_Mutex,
273 mutex)); 273 mutex));
@@ -386,7 +386,7 @@ informational only. */)
386 if (!NILP (name)) 386 if (!NILP (name))
387 CHECK_STRING (name); 387 CHECK_STRING (name);
388 388
389 condvar = ALLOCATE_PSEUDOVECTOR (struct Lisp_CondVar, cond, PVEC_CONDVAR); 389 condvar = ALLOCATE_PSEUDOVECTOR (struct Lisp_CondVar, name, PVEC_CONDVAR);
390 memset ((char *) condvar + offsetof (struct Lisp_CondVar, cond), 390 memset ((char *) condvar + offsetof (struct Lisp_CondVar, cond),
391 0, sizeof (struct Lisp_CondVar) - offsetof (struct Lisp_CondVar, 391 0, sizeof (struct Lisp_CondVar) - offsetof (struct Lisp_CondVar,
392 cond)); 392 cond));
@@ -805,7 +805,7 @@ If NAME is given, it must be a string; it names the new thread. */)
805 if (!NILP (name)) 805 if (!NILP (name))
806 CHECK_STRING (name); 806 CHECK_STRING (name);
807 807
808 new_thread = ALLOCATE_PSEUDOVECTOR (struct thread_state, m_stack_bottom, 808 new_thread = ALLOCATE_PSEUDOVECTOR (struct thread_state, event_object,
809 PVEC_THREAD); 809 PVEC_THREAD);
810 memset ((char *) new_thread + offset, 0, 810 memset ((char *) new_thread + offset, 0,
811 sizeof (struct thread_state) - offset); 811 sizeof (struct thread_state) - offset);
@@ -1064,7 +1064,7 @@ static void
1064init_main_thread (void) 1064init_main_thread (void)
1065{ 1065{
1066 main_thread.s.header.size 1066 main_thread.s.header.size
1067 = PSEUDOVECSIZE (struct thread_state, m_stack_bottom); 1067 = PSEUDOVECSIZE (struct thread_state, event_object);
1068 XSETPVECTYPE (&main_thread.s, PVEC_THREAD); 1068 XSETPVECTYPE (&main_thread.s, PVEC_THREAD);
1069 main_thread.s.m_last_thing_searched = Qnil; 1069 main_thread.s.m_last_thing_searched = Qnil;
1070 main_thread.s.m_saved_last_thing_searched = Qnil; 1070 main_thread.s.m_saved_last_thing_searched = Qnil;
diff --git a/src/thread.h b/src/thread.h
index 50f8f5cbe0a..0514669a87d 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -61,8 +61,8 @@ struct thread_state
61 /* If we are waiting for some event, this holds the object we are 61 /* If we are waiting for some event, this holds the object we are
62 waiting on. */ 62 waiting on. */
63 Lisp_Object event_object; 63 Lisp_Object event_object;
64 /* event_object must be the last Lisp field. */
64 65
65 /* m_stack_bottom must be the first non-Lisp field. */
66 /* An address near the bottom of the stack. 66 /* An address near the bottom of the stack.
67 Tells GC how to save a copy of the stack. */ 67 Tells GC how to save a copy of the stack. */
68 char const *m_stack_bottom; 68 char const *m_stack_bottom;
diff --git a/src/w32term.c b/src/w32term.c
index 7dbeda7a716..bb1f0bad018 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -3896,7 +3896,7 @@ x_scroll_bar_create (struct window *w, int left, int top, int width, int height,
3896 HWND hwnd; 3896 HWND hwnd;
3897 SCROLLINFO si; 3897 SCROLLINFO si;
3898 struct scroll_bar *bar 3898 struct scroll_bar *bar
3899 = ALLOCATE_PSEUDOVECTOR (struct scroll_bar, top, PVEC_OTHER); 3899 = ALLOCATE_PSEUDOVECTOR (struct scroll_bar, w32_widget_high, PVEC_OTHER);
3900 Lisp_Object barobj; 3900 Lisp_Object barobj;
3901 3901
3902 block_input (); 3902 block_input ();
diff --git a/src/window.c b/src/window.c
index be338c2af61..f911c0c7d44 100644
--- a/src/window.c
+++ b/src/window.c
@@ -4170,8 +4170,8 @@ temp_output_buffer_show (register Lisp_Object buf)
4170static struct window * 4170static struct window *
4171allocate_window (void) 4171allocate_window (void)
4172{ 4172{
4173 return ALLOCATE_ZEROED_PSEUDOVECTOR 4173 return ALLOCATE_ZEROED_PSEUDOVECTOR (struct window, mode_line_help_echo,
4174 (struct window, current_matrix, PVEC_WINDOW); 4174 PVEC_WINDOW);
4175} 4175}
4176 4176
4177/* Make new window, have it replace WINDOW in window-tree, and make 4177/* Make new window, have it replace WINDOW in window-tree, and make
@@ -6710,7 +6710,8 @@ struct save_window_data
6710 Lisp_Object saved_windows; 6710 Lisp_Object saved_windows;
6711 6711
6712 /* All fields above are traced by the GC. 6712 /* All fields above are traced by the GC.
6713 From `frame-cols' down, the fields are ignored by the GC. */ 6713 After saved_windows, the fields are ignored by the GC. */
6714
6714 /* We should be able to do without the following two. */ 6715 /* We should be able to do without the following two. */
6715 int frame_cols, frame_lines; 6716 int frame_cols, frame_lines;
6716 /* These two should get eventually replaced by their pixel 6717 /* These two should get eventually replaced by their pixel
@@ -7383,15 +7384,11 @@ redirection (see `redirect-frame-focus'). The variable
7383saved by this function. */) 7384saved by this function. */)
7384 (Lisp_Object frame) 7385 (Lisp_Object frame)
7385{ 7386{
7386 Lisp_Object tem;
7387 ptrdiff_t i, n_windows;
7388 struct save_window_data *data;
7389 struct frame *f = decode_live_frame (frame); 7387 struct frame *f = decode_live_frame (frame);
7390 7388 ptrdiff_t n_windows = count_windows (XWINDOW (FRAME_ROOT_WINDOW (f)));
7391 n_windows = count_windows (XWINDOW (FRAME_ROOT_WINDOW (f))); 7389 struct save_window_data *data
7392 data = ALLOCATE_PSEUDOVECTOR (struct save_window_data, frame_cols, 7390 = ALLOCATE_PSEUDOVECTOR (struct save_window_data, saved_windows,
7393 PVEC_WINDOW_CONFIGURATION); 7391 PVEC_WINDOW_CONFIGURATION);
7394
7395 data->frame_cols = FRAME_COLS (f); 7392 data->frame_cols = FRAME_COLS (f);
7396 data->frame_lines = FRAME_LINES (f); 7393 data->frame_lines = FRAME_LINES (f);
7397 data->frame_menu_bar_lines = FRAME_MENU_BAR_LINES (f); 7394 data->frame_menu_bar_lines = FRAME_MENU_BAR_LINES (f);
@@ -7407,9 +7404,9 @@ saved by this function. */)
7407 data->minibuf_selected_window = minibuf_level > 0 ? minibuf_selected_window : Qnil; 7404 data->minibuf_selected_window = minibuf_level > 0 ? minibuf_selected_window : Qnil;
7408 data->root_window = FRAME_ROOT_WINDOW (f); 7405 data->root_window = FRAME_ROOT_WINDOW (f);
7409 data->focus_frame = FRAME_FOCUS_FRAME (f); 7406 data->focus_frame = FRAME_FOCUS_FRAME (f);
7410 tem = make_uninit_vector (n_windows); 7407 Lisp_Object tem = make_uninit_vector (n_windows);
7411 data->saved_windows = tem; 7408 data->saved_windows = tem;
7412 for (i = 0; i < n_windows; i++) 7409 for (ptrdiff_t i = 0; i < n_windows; i++)
7413 ASET (tem, i, make_nil_vector (VECSIZE (struct saved_window))); 7410 ASET (tem, i, make_nil_vector (VECSIZE (struct saved_window)));
7414 save_window_save (FRAME_ROOT_WINDOW (f), XVECTOR (tem), 0); 7411 save_window_save (FRAME_ROOT_WINDOW (f), XVECTOR (tem), 0);
7415 XSETWINDOW_CONFIGURATION (tem, data); 7412 XSETWINDOW_CONFIGURATION (tem, data);
diff --git a/src/window.h b/src/window.h
index 4235a6eade2..fdef407041b 100644
--- a/src/window.h
+++ b/src/window.h
@@ -212,9 +212,8 @@ struct window
212 /* The help echo text for this window. Qnil if there's none. */ 212 /* The help echo text for this window. Qnil if there's none. */
213 Lisp_Object mode_line_help_echo; 213 Lisp_Object mode_line_help_echo;
214 214
215 /* No Lisp data may follow below this point without changing 215 /* No Lisp data may follow this point; mode_line_help_echo must be
216 mark_object in alloc.c. The member current_matrix must be the 216 the last Lisp member. */
217 first non-Lisp member. */
218 217
219 /* Glyph matrices. */ 218 /* Glyph matrices. */
220 struct glyph_matrix *current_matrix; 219 struct glyph_matrix *current_matrix;
diff --git a/src/xterm.c b/src/xterm.c
index 2f830afe61b..5aa3e3ff25c 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -6611,8 +6611,8 @@ x_scroll_bar_create (struct window *w, int top, int left,
6611 int width, int height, bool horizontal) 6611 int width, int height, bool horizontal)
6612{ 6612{
6613 struct frame *f = XFRAME (w->frame); 6613 struct frame *f = XFRAME (w->frame);
6614 struct scroll_bar *bar 6614 struct scroll_bar *bar = ALLOCATE_PSEUDOVECTOR (struct scroll_bar, prev,
6615 = ALLOCATE_PSEUDOVECTOR (struct scroll_bar, x_window, PVEC_OTHER); 6615 PVEC_OTHER);
6616 Lisp_Object barobj; 6616 Lisp_Object barobj;
6617 6617
6618 block_input (); 6618 block_input ();
diff --git a/src/xterm.h b/src/xterm.h
index 972a10f4d41..c5ad38650c2 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -897,7 +897,7 @@ struct scroll_bar
897 /* The next and previous in the chain of scroll bars in this frame. */ 897 /* The next and previous in the chain of scroll bars in this frame. */
898 Lisp_Object next, prev; 898 Lisp_Object next, prev;
899 899
900 /* Fields from `x_window' down will not be traced by the GC. */ 900 /* Fields after 'prev' are not traced by the GC. */
901 901
902 /* The X window representing this scroll bar. */ 902 /* The X window representing this scroll bar. */
903 Window x_window; 903 Window x_window;
diff --git a/src/xwidget.c b/src/xwidget.c
index c56284928e3..2486a2d4da8 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -41,14 +41,13 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
41static struct xwidget * 41static struct xwidget *
42allocate_xwidget (void) 42allocate_xwidget (void)
43{ 43{
44 return ALLOCATE_PSEUDOVECTOR (struct xwidget, height, PVEC_XWIDGET); 44 return ALLOCATE_PSEUDOVECTOR (struct xwidget, script_callbacks, PVEC_XWIDGET);
45} 45}
46 46
47static struct xwidget_view * 47static struct xwidget_view *
48allocate_xwidget_view (void) 48allocate_xwidget_view (void)
49{ 49{
50 return ALLOCATE_PSEUDOVECTOR (struct xwidget_view, redisplayed, 50 return ALLOCATE_PSEUDOVECTOR (struct xwidget_view, w, PVEC_XWIDGET_VIEW);
51 PVEC_XWIDGET_VIEW);
52} 51}
53 52
54#define XSETXWIDGET(a, b) XSETPSEUDOVECTOR (a, b, PVEC_XWIDGET) 53#define XSETXWIDGET(a, b) XSETPSEUDOVECTOR (a, b, PVEC_XWIDGET)
diff --git a/src/xwidget.h b/src/xwidget.h
index 8c598efb2e2..1b6368daabf 100644
--- a/src/xwidget.h
+++ b/src/xwidget.h
@@ -49,8 +49,7 @@ struct xwidget
49 49
50 /* Vector of currently executing scripts with callbacks. */ 50 /* Vector of currently executing scripts with callbacks. */
51 Lisp_Object script_callbacks; 51 Lisp_Object script_callbacks;
52 52 /* Here ends the Lisp part. script_callbacks is the marker field. */
53 /* Here ends the Lisp part. "height" is the marker field. */
54 53
55 int height; 54 int height;
56 int width; 55 int width;
@@ -68,8 +67,7 @@ struct xwidget_view
68 union vectorlike_header header; 67 union vectorlike_header header;
69 Lisp_Object model; 68 Lisp_Object model;
70 Lisp_Object w; 69 Lisp_Object w;
71 70 /* Here ends the lisp part. "w" is the marker field. */
72 /* Here ends the lisp part. "redisplayed" is the marker field. */
73 71
74 /* If touched by redisplay. */ 72 /* If touched by redisplay. */
75 bool redisplayed; 73 bool redisplayed;