Lisp_Object
make_misc_ptr (void *a)
{
- struct Lisp_Misc_Ptr *p = ALLOCATE_PSEUDOVECTOR (struct Lisp_Misc_Ptr, pointer,
- PVEC_MISC_PTR);
+ struct Lisp_Misc_Ptr *p = ALLOCATE_PLAIN_PSEUDOVECTOR (struct Lisp_Misc_Ptr,
+ PVEC_MISC_PTR);
p->pointer = a;
return make_lisp_ptr (p, Lisp_Vectorlike);
}
Lisp_Object
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);
Lisp_Object overlay = make_lisp_ptr (p, Lisp_Vectorlike);
OVERLAY_START (overlay) = start;
doc: /* Return a newly allocated marker which does not point at any place. */)
(void)
{
- struct Lisp_Marker *p = ALLOCATE_PSEUDOVECTOR (struct Lisp_Marker, buffer,
- PVEC_MARKER);
+ struct Lisp_Marker *p = ALLOCATE_PLAIN_PSEUDOVECTOR (struct Lisp_Marker,
+ PVEC_MARKER);
p->buffer = 0;
p->bytepos = 0;
p->charpos = 0;
/* Every character is at least one byte. */
eassert (charpos <= bytepos);
- struct Lisp_Marker *m = ALLOCATE_PSEUDOVECTOR (struct Lisp_Marker, buffer,
- PVEC_MARKER);
+ struct Lisp_Marker *m = ALLOCATE_PLAIN_PSEUDOVECTOR (struct Lisp_Marker,
+ PVEC_MARKER);
m->buffer = buf;
m->charpos = charpos;
m->bytepos = bytepos;
Lisp_Object
make_user_ptr (void (*finalizer) (void *), void *p)
{
- struct Lisp_User_Ptr *uptr = ALLOCATE_PSEUDOVECTOR (struct Lisp_User_Ptr,
- finalizer, PVEC_USER_PTR);
+ struct Lisp_User_Ptr *uptr
+ = ALLOCATE_PLAIN_PSEUDOVECTOR (struct Lisp_User_Ptr, PVEC_USER_PTR);
uptr->finalizer = finalizer;
uptr->p = p;
return make_lisp_ptr (uptr, Lisp_Vectorlike);
(Lisp_Object function)
{
struct Lisp_Finalizer *finalizer
- = ALLOCATE_PSEUDOVECTOR (struct Lisp_Finalizer, prev, PVEC_FINALIZER);
+ = ALLOCATE_PSEUDOVECTOR (struct Lisp_Finalizer, function, PVEC_FINALIZER);
finalizer->function = function;
finalizer->prev = finalizer->next = NULL;
finalizer_insert (&finalizers, finalizer);
if (integer_width < bits)
overflow_error ();
- struct Lisp_Bignum *b = ALLOCATE_PSEUDOVECTOR (struct Lisp_Bignum, value,
- PVEC_BIGNUM);
+ struct Lisp_Bignum *b = ALLOCATE_PLAIN_PSEUDOVECTOR (struct Lisp_Bignum,
+ PVEC_BIGNUM);
mpz_init (b->value);
mpz_swap (b->value, mpz[0]);
return make_lisp_ptr (b, Lisp_Vectorlike);
Lisp_Object
make_bignum_str (char const *num, int base)
{
- struct Lisp_Bignum *b = ALLOCATE_PSEUDOVECTOR (struct Lisp_Bignum, value,
- PVEC_BIGNUM);
+ struct Lisp_Bignum *b = ALLOCATE_PLAIN_PSEUDOVECTOR (struct Lisp_Bignum,
+ PVEC_BIGNUM);
mpz_init (b->value);
int check = mpz_set_str (b->value, num, base);
eassert (check == 0);
See `cursor-type' for other values. */
Lisp_Object cursor_in_non_selected_windows_;
- /* No more Lisp_Object beyond this point. Except undo_list,
- which is handled specially in Fgarbage_collect. */
+ /* No more Lisp_Object beyond cursor_in_non_selected_windows_.
+ Except undo_list, which is handled specially in Fgarbage_collect. */
/* This structure holds the coordinates of the buffer contents
in ordinary buffers. In indirect buffers, this is not used. */
structure, make sure that this is still correct. */
#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
- units. Rounding is needed for --with-wide-int configuration. */
+/* Allocated size of the struct buffer part beyond leading
+ Lisp_Objects, in word_size units. */
-#define BUFFER_REST_SIZE \
- ((((sizeof (struct buffer) - offsetof (struct buffer, own_text)) \
- + (word_size - 1)) & ~(word_size - 1)) / word_size)
+#define BUFFER_REST_SIZE (VECSIZE (struct buffer) - 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
allocate_module_function (void)
{
return ALLOCATE_PSEUDOVECTOR (struct Lisp_Module_Function,
- min_arity, PVEC_MODULE_FUNCTION);
+ documentation, PVEC_MODULE_FUNCTION);
}
#define XSET_MODULE_FUNCTION(var, ptr) \
allocate_hash_table (void)
{
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
static struct frame *
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 *
Lisp_Object current_tool_bar_string;
#endif
- /* Desired and current tool-bar items. */
- Lisp_Object tool_bar_items;
-
#ifdef USE_GTK
/* Where tool bar is, can be left, right, top or bottom.
Except with GTK, the only supported position is `top'. */
Lisp_Object font_data;
#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. */
struct face_cache *face_cache;
at the end and we need to compute the number of Lisp_Object fields (the
ones that the GC needs to trace). */
-#define PSEUDOVECSIZE(type, nonlispfield) \
- (offsetof (type, nonlispfield) < header_size \
- ? 0 : (offsetof (type, nonlispfield) - header_size) / word_size)
+#define PSEUDOVECSIZE(type, lastlispfield) \
+ (offsetof (type, lastlispfield) + word_size < header_size \
+ ? 0 : (offsetof (type, lastlispfield) + word_size - header_size) / word_size)
/* Compute A OP B, using the unsigned comparison operator OP. A and B
should be integer expressions. This is not the same as
/* This is the number of slots that every char table must have. This
counts the ordinary slots and the top, defalt, parent, and purpose
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. */
- 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. */
hash table size to reduce collisions. */
Lisp_Object index;
- /* Only the fields above are traced normally by the GC. The ones below
- `count' are special and are either ignored by the GC or traced in
+ /* Only the fields above are traced normally by the GC. The ones after
+ 'index' are special and are either ignored by the GC or traced in
a special way (e.g. because of weakness). */
/* Number of key/value entries in the table. */
extern struct Lisp_Vector *allocate_pseudovector (int, int, int,
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
slots are set to Qnil but the rest (if any) is left uninitialized. */
Lisp_Object object,
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."
#endif
const struct Lisp_Hash_Table *hash_in = XHASH_TABLE (object);
static dump_off
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."
#endif
struct buffer munged_buffer = *in_buffer;
static struct Lisp_Process *
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
/* The thread a process is linked to, or nil for any thread. */
Lisp_Object thread;
-
- /* After this point, there are no Lisp_Objects any more. */
- /* alloc.c assumes that `pid' is the first such non-Lisp slot. */
+ /* After this point, there are no Lisp_Objects. */
/* Process ID. A positive value is a child process ID.
Zero is for pseudo-processes such as network or serial connections,
whether the mapping is available. */
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. */
/* Chain of all terminal devices. */
static struct terminal *
allocate_terminal (void)
{
- return ALLOCATE_ZEROED_PSEUDOVECTOR
- (struct terminal, next_terminal, PVEC_TERMINAL);
+ return ALLOCATE_ZEROED_PSEUDOVECTOR (struct terminal, glyph_code_table,
+ PVEC_TERMINAL);
}
/* Create a new terminal object of TYPE and add it to the terminal list. RIF
if (!NILP (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),
0, sizeof (struct Lisp_Mutex) - offsetof (struct Lisp_Mutex,
mutex));
if (!NILP (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),
0, sizeof (struct Lisp_CondVar) - offsetof (struct Lisp_CondVar,
cond));
if (!NILP (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);
memset ((char *) new_thread + offset, 0,
sizeof (struct thread_state) - offset);
init_main_thread (void)
{
main_thread.s.header.size
- = PSEUDOVECSIZE (struct thread_state, m_stack_bottom);
+ = PSEUDOVECSIZE (struct thread_state, event_object);
XSETPVECTYPE (&main_thread.s, PVEC_THREAD);
main_thread.s.m_last_thing_searched = Qnil;
main_thread.s.m_saved_last_thing_searched = Qnil;
/* If we are waiting for some event, this holds the object we are
waiting on. */
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.
Tells GC how to save a copy of the stack. */
char const *m_stack_bottom;
HWND hwnd;
SCROLLINFO si;
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;
block_input ();
static struct window *
allocate_window (void)
{
- return ALLOCATE_ZEROED_PSEUDOVECTOR
- (struct window, current_matrix, PVEC_WINDOW);
+ return ALLOCATE_ZEROED_PSEUDOVECTOR (struct window, mode_line_help_echo,
+ PVEC_WINDOW);
}
/* Make new window, have it replace WINDOW in window-tree, and make
Lisp_Object saved_windows;
/* 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. */
int frame_cols, frame_lines;
/* These two should get eventually replaced by their pixel
saved by this function. */)
(Lisp_Object frame)
{
- Lisp_Object tem;
- ptrdiff_t i, n_windows;
- struct save_window_data *data;
struct frame *f = decode_live_frame (frame);
-
- n_windows = count_windows (XWINDOW (FRAME_ROOT_WINDOW (f)));
- data = ALLOCATE_PSEUDOVECTOR (struct save_window_data, frame_cols,
- PVEC_WINDOW_CONFIGURATION);
-
+ ptrdiff_t n_windows = count_windows (XWINDOW (FRAME_ROOT_WINDOW (f)));
+ struct save_window_data *data
+ = ALLOCATE_PSEUDOVECTOR (struct save_window_data, saved_windows,
+ PVEC_WINDOW_CONFIGURATION);
data->frame_cols = FRAME_COLS (f);
data->frame_lines = FRAME_LINES (f);
data->frame_menu_bar_lines = FRAME_MENU_BAR_LINES (f);
data->minibuf_selected_window = minibuf_level > 0 ? minibuf_selected_window : Qnil;
data->root_window = FRAME_ROOT_WINDOW (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;
- 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)));
save_window_save (FRAME_ROOT_WINDOW (f), XVECTOR (tem), 0);
XSETWINDOW_CONFIGURATION (tem, data);
/* The help echo text for this window. Qnil if there's none. */
Lisp_Object mode_line_help_echo;
- /* No Lisp data may follow below this point without changing
- mark_object in alloc.c. The member current_matrix must be the
- first non-Lisp member. */
+ /* No Lisp data may follow this point; mode_line_help_echo must be
+ the last Lisp member. */
/* Glyph matrices. */
struct glyph_matrix *current_matrix;
int width, int height, bool horizontal)
{
struct frame *f = XFRAME (w->frame);
- struct scroll_bar *bar
- = ALLOCATE_PSEUDOVECTOR (struct scroll_bar, x_window, PVEC_OTHER);
+ struct scroll_bar *bar = ALLOCATE_PSEUDOVECTOR (struct scroll_bar, prev,
+ PVEC_OTHER);
Lisp_Object barobj;
block_input ();
/* The next and previous in the chain of scroll bars in this frame. */
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. */
Window x_window;
static struct xwidget *
allocate_xwidget (void)
{
- return ALLOCATE_PSEUDOVECTOR (struct xwidget, height, PVEC_XWIDGET);
+ return ALLOCATE_PSEUDOVECTOR (struct xwidget, script_callbacks, PVEC_XWIDGET);
}
static struct xwidget_view *
allocate_xwidget_view (void)
{
- return ALLOCATE_PSEUDOVECTOR (struct xwidget_view, redisplayed,
- PVEC_XWIDGET_VIEW);
+ return ALLOCATE_PSEUDOVECTOR (struct xwidget_view, w, PVEC_XWIDGET_VIEW);
}
#define XSETXWIDGET(a, b) XSETPSEUDOVECTOR (a, b, PVEC_XWIDGET)
/* Vector of currently executing scripts with callbacks. */
Lisp_Object script_callbacks;
-
- /* Here ends the Lisp part. "height" is the marker field. */
+ /* Here ends the Lisp part. script_callbacks is the marker field. */
int height;
int width;
union vectorlike_header header;
Lisp_Object model;
Lisp_Object w;
-
- /* Here ends the lisp part. "redisplayed" is the marker field. */
+ /* Here ends the lisp part. "w" is the marker field. */
/* If touched by redisplay. */
bool redisplayed;