aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2007-10-02 20:57:49 +0000
committerStefan Monnier2007-10-02 20:57:49 +0000
commit539b8c1c07f0b4b307f8559353fce7955a602e77 (patch)
treeac4c803b3613a8ab5dfad9209550f02875ed56fc /src
parentd6aa1876eb29c086ef190c46d488d391db062f50 (diff)
downloademacs-539b8c1c07f0b4b307f8559353fce7955a602e77.tar.gz
emacs-539b8c1c07f0b4b307f8559353fce7955a602e77.zip
(ARRAY_MARK_FLAG, PSEUDOVECTOR_FLAG): Don't allow definition in m/*.h files.
(XCHAR_TABLE, XBOOL_VECTOR): Add assertion checking. (XSETPVECTYPE): New macro. (XSETPSEUDOVECTOR): Use it.
Diffstat (limited to 'src')
-rw-r--r--src/lisp.h19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/lisp.h b/src/lisp.h
index 69ef17f7b85..5917e918b31 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -306,25 +306,21 @@ typedef EMACS_INT Lisp_Object;
306#define LISP_MAKE_RVALUE(o) (0+(o)) 306#define LISP_MAKE_RVALUE(o) (0+(o))
307#endif /* NO_UNION_TYPE */ 307#endif /* NO_UNION_TYPE */
308 308
309/* Two flags that are set during GC. On some machines, these flags
310 are defined differently by the m- file. */
311
312/* In the size word of a vector, this bit means the vector has been marked. */ 309/* In the size word of a vector, this bit means the vector has been marked. */
313 310
314#ifndef ARRAY_MARK_FLAG
315#define ARRAY_MARK_FLAG ((EMACS_INT) ((EMACS_UINT) 1 << (VALBITS + GCTYPEBITS - 1))) 311#define ARRAY_MARK_FLAG ((EMACS_INT) ((EMACS_UINT) 1 << (VALBITS + GCTYPEBITS - 1)))
316#endif /* no ARRAY_MARK_FLAG */
317 312
318/* In the size word of a struct Lisp_Vector, this bit means it's really 313/* In the size word of a struct Lisp_Vector, this bit means it's really
319 some other vector-like object. */ 314 some other vector-like object. */
320#ifndef PSEUDOVECTOR_FLAG
321#define PSEUDOVECTOR_FLAG ((ARRAY_MARK_FLAG >> 1) & ~ARRAY_MARK_FLAG) 315#define PSEUDOVECTOR_FLAG ((ARRAY_MARK_FLAG >> 1) & ~ARRAY_MARK_FLAG)
322#endif
323 316
324/* In a pseudovector, the size field actually contains a word with one 317/* In a pseudovector, the size field actually contains a word with one
325 PSEUDOVECTOR_FLAG bit set, and exactly one of the following bits to 318 PSEUDOVECTOR_FLAG bit set, and exactly one of the following bits to
326 indicate the actual type. 319 indicate the actual type.
327 FIXME: Why a bitset if only one of the bits can ever be set at a time? */ 320 We use a bitset, even tho only one of the bits can be set at any
321 particular time just so as to be able to use micro-optimizations such as
322 testing membership of a particular subset of pseudovectors in Fequal.
323 It is not crucial, but there are plenty of bits here, so why not do it? */
328enum pvec_type 324enum pvec_type
329{ 325{
330 PVEC_NORMAL_VECTOR = 0, 326 PVEC_NORMAL_VECTOR = 0,
@@ -544,8 +540,8 @@ extern size_t pure_size;
544#define XTERMINAL(a) (eassert (GC_TERMINALP(a)),(struct terminal *) XPNTR(a)) 540#define XTERMINAL(a) (eassert (GC_TERMINALP(a)),(struct terminal *) XPNTR(a))
545#define XSUBR(a) (eassert (GC_SUBRP(a)),(struct Lisp_Subr *) XPNTR(a)) 541#define XSUBR(a) (eassert (GC_SUBRP(a)),(struct Lisp_Subr *) XPNTR(a))
546#define XBUFFER(a) (eassert (GC_BUFFERP(a)),(struct buffer *) XPNTR(a)) 542#define XBUFFER(a) (eassert (GC_BUFFERP(a)),(struct buffer *) XPNTR(a))
547#define XCHAR_TABLE(a) ((struct Lisp_Char_Table *) XPNTR(a)) 543#define XCHAR_TABLE(a) (eassert (GC_CHAR_TABLE_P (a)), (struct Lisp_Char_Table *) XPNTR(a))
548#define XBOOL_VECTOR(a) ((struct Lisp_Bool_Vector *) XPNTR(a)) 544#define XBOOL_VECTOR(a) (eassert (GC_BOOL_VECTOR_P (a)), (struct Lisp_Bool_Vector *) XPNTR(a))
549 545
550/* Construct a Lisp_Object from a value or address. */ 546/* Construct a Lisp_Object from a value or address. */
551 547
@@ -563,8 +559,9 @@ extern size_t pure_size;
563 559
564/* Pseudovector types. */ 560/* Pseudovector types. */
565 561
562#define XSETPVECTYPE(v,code) ((v)->size |= PSEUDOVECTOR_FLAG | (code))
566#define XSETPSEUDOVECTOR(a, b, code) \ 563#define XSETPSEUDOVECTOR(a, b, code) \
567 (XSETVECTOR (a, b), XVECTOR (a)->size |= PSEUDOVECTOR_FLAG | (code)) 564 (XSETVECTOR (a, b), XSETPVECTYPE (XVECTOR (a), code))
568#define XSETWINDOW_CONFIGURATION(a, b) \ 565#define XSETWINDOW_CONFIGURATION(a, b) \
569 (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW_CONFIGURATION)) 566 (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW_CONFIGURATION))
570#define XSETPROCESS(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_PROCESS)) 567#define XSETPROCESS(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_PROCESS))