aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2003-11-17 23:29:30 +0000
committerStefan Monnier2003-11-17 23:29:30 +0000
commit7ad435540618ebfe42e1e3361065ba5a77077a4d (patch)
tree6e4a11fd340d4a3bb791bd1c627022a977cd9dc4 /src
parent316d4bf9e2fc5ec04f5187ace82c84eb9c6c934e (diff)
downloademacs-7ad435540618ebfe42e1e3361065ba5a77077a4d.tar.gz
emacs-7ad435540618ebfe42e1e3361065ba5a77077a4d.zip
(VALMASK): Only define for non-union type.
(MARKBIT): Remove. (ARRAY_MARK_FLAG): Use previous value of MARKBIT. (XTYPE): Define unconditionally. (XSETTYPE): Remove one more remnant. (EQ): Define differently for the union and non-union cases. (INTMASK): New bit mask. (struct Lisp_Marker): Move down to prepare for upcoming patch. (GC_EQ): Delegate to EQ.
Diffstat (limited to 'src')
-rw-r--r--src/lisp.h57
1 files changed, 23 insertions, 34 deletions
diff --git a/src/lisp.h b/src/lisp.h
index e038f97e13f..4694078195e 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -250,24 +250,13 @@ LISP_MAKE_RVALUE (Lisp_Object o)
250#define LISP_MAKE_RVALUE(o) (0+(o)) 250#define LISP_MAKE_RVALUE(o) (0+(o))
251#endif /* NO_UNION_TYPE */ 251#endif /* NO_UNION_TYPE */
252 252
253#ifndef VALMASK
254#define VALMASK ((((EMACS_INT) 1)<<VALBITS) - 1)
255#endif
256
257/* Two flags that are set during GC. On some machines, these flags 253/* Two flags that are set during GC. On some machines, these flags
258 are defined differently by the m- file. */ 254 are defined differently by the m- file. */
259 255
260/* This is set in the car of a cons to indicate it is marked.
261 Likewise in the type slot of a float and in the size slot of strings. */
262
263#ifndef MARKBIT
264#define MARKBIT ((EMACS_INT) ((EMACS_UINT) 1 << (VALBITS + GCTYPEBITS - 1)))
265#endif /*MARKBIT */
266
267/* In the size word of a vector, this bit means the vector has been marked. */ 256/* In the size word of a vector, this bit means the vector has been marked. */
268 257
269#ifndef ARRAY_MARK_FLAG 258#ifndef ARRAY_MARK_FLAG
270#define ARRAY_MARK_FLAG ((MARKBIT >> 1) & ~MARKBIT) 259#define ARRAY_MARK_FLAG ((EMACS_INT) ((EMACS_UINT) 1 << (VALBITS + GCTYPEBITS - 1)))
271#endif /* no ARRAY_MARK_FLAG */ 260#endif /* no ARRAY_MARK_FLAG */
272 261
273/* In the size word of a struct Lisp_Vector, this bit means it's really 262/* In the size word of a struct Lisp_Vector, this bit means it's really
@@ -310,20 +299,17 @@ enum pvec_type
310 299
311#ifdef NO_UNION_TYPE 300#ifdef NO_UNION_TYPE
312 301
302#define VALMASK ((((EMACS_INT) 1) << VALBITS) - 1)
303
313/* One need to override this if there must be high bits set in data space 304/* One need to override this if there must be high bits set in data space
314 (doing the result of the below & ((1 << (GCTYPE + 1)) - 1) would work 305 (doing the result of the below & ((1 << (GCTYPE + 1)) - 1) would work
315 on all machines, but would penalize machines which don't need it) 306 on all machines, but would penalize machines which don't need it)
316 */ 307 */
317#ifndef XTYPE
318#define XTYPE(a) ((enum Lisp_Type) (((EMACS_UINT) (a)) >> VALBITS)) 308#define XTYPE(a) ((enum Lisp_Type) (((EMACS_UINT) (a)) >> VALBITS))
319#endif
320 309
321/* For integers known to be positive, XFASTINT provides fast retrieval 310/* For integers known to be positive, XFASTINT provides fast retrieval
322 and XSETFASTINT provides fast storage. This takes advantage of the 311 and XSETFASTINT provides fast storage. This takes advantage of the
323 fact that Lisp_Int is 0. 312 fact that Lisp_Int is 0. */
324 Beware: XFASTINT applied to a non-positive integer or to something
325 else than an integer should return something that preserves all the
326 info that was in the Lisp_Object, because it is used in EQ. */
327#define XFASTINT(a) ((a) + 0) 313#define XFASTINT(a) ((a) + 0)
328#define XSETFASTINT(a, b) ((a) = (b)) 314#define XSETFASTINT(a, b) ((a) = (b))
329 315
@@ -351,12 +337,11 @@ enum pvec_type
351#define make_number(N) \ 337#define make_number(N) \
352 ((((EMACS_INT) (N)) & VALMASK) | ((EMACS_INT) Lisp_Int) << VALBITS) 338 ((((EMACS_INT) (N)) & VALMASK) | ((EMACS_INT) Lisp_Int) << VALBITS)
353 339
354#endif /* NO_UNION_TYPE */ 340#define EQ(x, y) ((x) == (y))
355 341
356#ifndef NO_UNION_TYPE 342#else /* not NO_UNION_TYPE */
357 343
358#define XTYPE(a) ((enum Lisp_Type) (a).u.type) 344#define XTYPE(a) ((enum Lisp_Type) (a).u.type)
359#define XSETTYPE(a, b) ((a).u.type = (char) (b))
360 345
361/* For integers known to be positive, XFASTINT provides fast retrieval 346/* For integers known to be positive, XFASTINT provides fast retrieval
362 and XSETFASTINT provides fast storage. This takes advantage of the 347 and XSETFASTINT provides fast storage. This takes advantage of the
@@ -384,6 +369,8 @@ enum pvec_type
384extern Lisp_Object make_number (); 369extern Lisp_Object make_number ();
385#endif 370#endif
386 371
372#define EQ(x, y) ((x).s.val == (y).s.val)
373
387#endif /* NO_UNION_TYPE */ 374#endif /* NO_UNION_TYPE */
388 375
389/* During garbage collection, XGCTYPE must be used for extracting types 376/* During garbage collection, XGCTYPE must be used for extracting types
@@ -394,7 +381,7 @@ extern Lisp_Object make_number ();
394 381
395#ifndef XGCTYPE 382#ifndef XGCTYPE
396/* The distinction does not exist now that the MARKBIT has been eliminated. */ 383/* The distinction does not exist now that the MARKBIT has been eliminated. */
397#define XGCTYPE(a) XTYPE(a) 384#define XGCTYPE(a) XTYPE (a)
398#endif 385#endif
399 386
400#ifndef XPNTR 387#ifndef XPNTR
@@ -422,6 +409,9 @@ extern size_t pure_size;
422 409
423#define MOST_NEGATIVE_FIXNUM - ((EMACS_INT) 1 << (VALBITS - 1)) 410#define MOST_NEGATIVE_FIXNUM - ((EMACS_INT) 1 << (VALBITS - 1))
424#define MOST_POSITIVE_FIXNUM (((EMACS_INT) 1 << (VALBITS - 1)) - 1) 411#define MOST_POSITIVE_FIXNUM (((EMACS_INT) 1 << (VALBITS - 1)) - 1)
412/* Mask indicating the significant bits of a Lisp_Int.
413 I.e. (x & INTMASK) == XUINT (make_number (x)). */
414#define INTMASK ((((EMACS_INT) 1) << VALBITS) - 1)
425 415
426/* Value is non-zero if C integer I doesn't fit into a Lisp fixnum. */ 416/* Value is non-zero if C integer I doesn't fit into a Lisp fixnum. */
427 417
@@ -989,15 +979,6 @@ struct Lisp_Hash_Table
989 979
990/* These structures are used for various misc types. */ 980/* These structures are used for various misc types. */
991 981
992/* A miscellaneous object, when it's on the free list. */
993struct Lisp_Free
994 {
995 int type : 16; /* = Lisp_Misc_Free */
996 unsigned gcmarkbit : 1;
997 int spacer : 15;
998 union Lisp_Misc *chain;
999 };
1000
1001struct Lisp_Marker 982struct Lisp_Marker
1002{ 983{
1003 int type : 16; /* = Lisp_Misc_Marker */ 984 int type : 16; /* = Lisp_Misc_Marker */
@@ -1162,6 +1143,15 @@ struct Lisp_Save_Value
1162 }; 1143 };
1163 1144
1164 1145
1146/* A miscellaneous object, when it's on the free list. */
1147struct Lisp_Free
1148 {
1149 int type : 16; /* = Lisp_Misc_Free */
1150 unsigned gcmarkbit : 1;
1151 int spacer : 15;
1152 union Lisp_Misc *chain;
1153 };
1154
1165/* To get the type field of a union Lisp_Misc, use XMISCTYPE. 1155/* To get the type field of a union Lisp_Misc, use XMISCTYPE.
1166 It uses one of these struct subtypes to get the type field. */ 1156 It uses one of these struct subtypes to get the type field. */
1167 1157
@@ -1321,7 +1311,7 @@ typedef unsigned char UCHAR;
1321#define GC_NATNUMP(x) (GC_INTEGERP (x) && XINT (x) >= 0) 1311#define GC_NATNUMP(x) (GC_INTEGERP (x) && XINT (x) >= 0)
1322 1312
1323#define INTEGERP(x) (XTYPE ((x)) == Lisp_Int) 1313#define INTEGERP(x) (XTYPE ((x)) == Lisp_Int)
1324#define GC_INTEGERP(x) (XGCTYPE ((x)) == Lisp_Int) 1314#define GC_INTEGERP(x) INTEGERP (x)
1325#define SYMBOLP(x) (XTYPE ((x)) == Lisp_Symbol) 1315#define SYMBOLP(x) (XTYPE ((x)) == Lisp_Symbol)
1326#define GC_SYMBOLP(x) (XGCTYPE ((x)) == Lisp_Symbol) 1316#define GC_SYMBOLP(x) (XGCTYPE ((x)) == Lisp_Symbol)
1327#define MISCP(x) (XTYPE ((x)) == Lisp_Misc) 1317#define MISCP(x) (XTYPE ((x)) == Lisp_Misc)
@@ -1392,8 +1382,7 @@ typedef unsigned char UCHAR;
1392 1382
1393#define SUB_CHAR_TABLE_P(x) (CHAR_TABLE_P (x) && NILP (XCHAR_TABLE (x)->top)) 1383#define SUB_CHAR_TABLE_P(x) (CHAR_TABLE_P (x) && NILP (XCHAR_TABLE (x)->top))
1394 1384
1395#define EQ(x, y) (XFASTINT (x) == XFASTINT (y)) 1385#define GC_EQ(x, y) EQ (x, y)
1396#define GC_EQ(x, y) (XGCTYPE (x) == XGCTYPE (y) && XPNTR (x) == XPNTR (y))
1397 1386
1398#define CHECK_LIST(x) \ 1387#define CHECK_LIST(x) \
1399 do { if (!CONSP ((x)) && !NILP (x)) x = wrong_type_argument (Qlistp, (x)); } while (0) 1388 do { if (!CONSP ((x)) && !NILP (x)) x = wrong_type_argument (Qlistp, (x)); } while (0)