comparison src/lisp-disunion.h @ 458:c33ae14dd6d0 r21-2-44

Import from CVS: tag r21-2-44
author cvs
date Mon, 13 Aug 2007 11:42:25 +0200
parents 3d3049ae1304
children 0784d089fdc9
comparison
equal deleted inserted replaced
457:4b9290a33024 458:c33ae14dd6d0
36 bit 10987654321098765432109876543210 36 bit 10987654321098765432109876543210
37 -------------------------------- 37 --------------------------------
38 VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVT 38 VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVT
39 39
40 For integral Lisp types, i.e. integers and characters, the value 40 For integral Lisp types, i.e. integers and characters, the value
41 bits are the Lisp object. 41 bits are the Lisp object. Some people call such Lisp_Objects "immediate".
42 42
43 The object is obtained by masking off the type and mark bits. 43 The object is obtained by masking off the type bits.
44 Bit 1 is used as a value bit by splitting the Lisp integer type 44 Bit 1 is used as a value bit by splitting the Lisp integer type
45 into two subtypes, Lisp_Type_Int_Even and Lisp_Type_Int_Odd. By 45 into two subtypes, Lisp_Type_Int_Even and Lisp_Type_Int_Odd.
46 this trickery we get 31 bits for integers instead of 30. 46 By this trickery we get 31 bits for integers instead of 30.
47 47
48 For non-integral types, the value bits of a Lisp_Object contain 48 For non-integral types, the value bits of a Lisp_Object contain
49 a pointer to a structure containing the object. The pointer is 49 a pointer to a structure containing the object. The pointer is
50 obtained by masking off the type and mark bits. 50 obtained by masking off the type and mark bits.
51 51
52 All pointer-based types are coalesced under a single type called 52 All pointer-based types are coalesced under a single type called
53 Lisp_Type_Record. The type bits for this type are required 53 Lisp_Type_Record. The type bits for this type are required by the
54 by the implementation to be 00, just like the least 54 implementation to be 00, just like the least significant bits of
55 significant bits of word-aligned struct pointers on 32-bit 55 word-aligned struct pointers on 32-bit hardware. This requires that
56 hardware. Because of this, Lisp_Object pointers don't have 56 all structs implementing Lisp_Objects have an alignment of at least 4
57 to be masked and are full-sized. 57 bytes. Because of this, Lisp_Object pointers don't have to be masked
58 and are full-sized.
58 59
59 There are no mark bits. 60 There are no mark bits in the Lisp_Object itself (there used to be).
60 Integers and characters don't need to be marked. All other types 61
61 are lrecord-based, which means they get marked by incrementing 62 Integers and characters don't need to be marked. All other types are
62 their ->implementation pointer. 63 lrecord-based, which means they get marked by setting the mark bit in
64 the struct lrecord_header.
63 65
64 Here is a brief description of the following macros: 66 Here is a brief description of the following macros:
65 67
66 XTYPE The type bits of a Lisp_Object 68 XTYPE The type bits of a Lisp_Object
67 XPNTRVAL The value bits of a Lisp_Object storing a pointer 69 XPNTRVAL The value bits of a Lisp_Object storing a pointer
68 XCHARVAL The value bits of a Lisp_Object storing a Emchar 70 XCHARVAL The value bits of a Lisp_Object storing a Emchar
69 XREALINT The value bits of a Lisp_Object storing an integer, signed 71 XREALINT The value bits of a Lisp_Object storing an integer, signed
70 XUINT The value bits of a Lisp_Object storing an integer, unsigned 72 XUINT The value bits of a Lisp_Object storing an integer, unsigned
71 INTP Non-zero if this Lisp_Object an integer? 73 INTP Non-zero if this Lisp_Object is an integer
72 Qzero Lisp Integer 0 74 Qzero Lisp Integer 0
73 EQ Non-zero if two Lisp_Objects are identical */ 75 EQ Non-zero if two Lisp_Objects are identical, not merely equal. */
74 76
75 77
76 typedef EMACS_INT Lisp_Object; 78 typedef EMACS_INT Lisp_Object;
77 79
78 #define Lisp_Type_Int_Bit (Lisp_Type_Int_Even & Lisp_Type_Int_Odd) 80 #define Lisp_Type_Int_Bit (Lisp_Type_Int_Even & Lisp_Type_Int_Odd)