aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lisp.h26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/lisp.h b/src/lisp.h
index 7e365e8f478..56623a75f74 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1619,7 +1619,16 @@ struct Lisp_Bool_Vector
1619 } GCALIGNED_STRUCT; 1619 } GCALIGNED_STRUCT;
1620 1620
1621/* Some handy constants for calculating sizes 1621/* Some handy constants for calculating sizes
1622 and offsets, mostly of vectorlike objects. */ 1622 and offsets, mostly of vectorlike objects.
1623
1624 The garbage collector assumes that the initial part of any struct
1625 that starts with a union vectorlike_header followed by N
1626 Lisp_Objects (some possibly in arrays and/or a trailing flexible
1627 array) will be laid out like a struct Lisp_Vector with N
1628 Lisp_Objects. This assumption is true in practice on known Emacs
1629 targets even though the C standard does not guarantee it. This
1630 header contains a few sanity checks that should suffice to detect
1631 violations of this assumption on plausible practical hosts. */
1623 1632
1624enum 1633enum
1625 { 1634 {
@@ -1627,7 +1636,6 @@ enum
1627 bool_header_size = offsetof (struct Lisp_Bool_Vector, data), 1636 bool_header_size = offsetof (struct Lisp_Bool_Vector, data),
1628 word_size = sizeof (Lisp_Object) 1637 word_size = sizeof (Lisp_Object)
1629 }; 1638 };
1630verify (header_size == sizeof (union vectorlike_header));
1631 1639
1632/* The number of data words and bytes in a bool vector with SIZE bits. */ 1640/* The number of data words and bytes in a bool vector with SIZE bits. */
1633 1641
@@ -1989,6 +1997,13 @@ enum char_table_specials
1989 SUB_CHAR_TABLE_OFFSET = PSEUDOVECSIZE (struct Lisp_Sub_Char_Table, contents) 1997 SUB_CHAR_TABLE_OFFSET = PSEUDOVECSIZE (struct Lisp_Sub_Char_Table, contents)
1990 }; 1998 };
1991 1999
2000/* Sanity-check pseudovector layout. */
2001verify (offsetof (struct Lisp_Char_Table, defalt) == header_size);
2002verify (offsetof (struct Lisp_Char_Table, extras)
2003 == header_size + CHAR_TABLE_STANDARD_SLOTS * sizeof (Lisp_Object));
2004verify (offsetof (struct Lisp_Sub_Char_Table, contents)
2005 == header_size + SUB_CHAR_TABLE_OFFSET * sizeof (Lisp_Object));
2006
1992/* Return the number of "extra" slots in the char table CT. */ 2007/* Return the number of "extra" slots in the char table CT. */
1993 2008
1994INLINE int 2009INLINE int
@@ -1998,11 +2013,6 @@ CHAR_TABLE_EXTRA_SLOTS (struct Lisp_Char_Table *ct)
1998 - CHAR_TABLE_STANDARD_SLOTS); 2013 - CHAR_TABLE_STANDARD_SLOTS);
1999} 2014}
2000 2015
2001/* Make sure that sub char-table contents slot is where we think it is. */
2002verify (offsetof (struct Lisp_Sub_Char_Table, contents)
2003 == (offsetof (struct Lisp_Vector, contents)
2004 + SUB_CHAR_TABLE_OFFSET * sizeof (Lisp_Object)));
2005
2006 2016
2007/* Save and restore the instruction and environment pointers, 2017/* Save and restore the instruction and environment pointers,
2008 without affecting the signal mask. */ 2018 without affecting the signal mask. */
@@ -2216,6 +2226,8 @@ struct Lisp_Hash_Table
2216 struct Lisp_Hash_Table *next_weak; 2226 struct Lisp_Hash_Table *next_weak;
2217} GCALIGNED_STRUCT; 2227} GCALIGNED_STRUCT;
2218 2228
2229/* Sanity-check pseudovector layout. */
2230verify (offsetof (struct Lisp_Hash_Table, weak) == header_size);
2219 2231
2220INLINE bool 2232INLINE bool
2221HASH_TABLE_P (Lisp_Object a) 2233HASH_TABLE_P (Lisp_Object a)