Mercurial > emacs
comparison src/alloc.c @ 10413:bfe591f66299
(DONT_COPY_FLAG): Default this to 1.
(mark_object): Use the same XOR expression as elsewhere.
(gc_sweep): Don't touch DONT_COPY_FLAG here; this one is a real size field,
not a mangled pointer.
| author | Karl Heuer <kwzh@gnu.org> |
|---|---|
| date | Fri, 13 Jan 1995 00:00:23 +0000 |
| parents | 4a9bc1042dbc |
| children | f4a1838db0bf |
comparison
equal
deleted
inserted
replaced
| 10412:ff0b2d5848be | 10413:bfe591f66299 |
|---|---|
| 105 | 105 |
| 106 #ifndef MAX_SAVE_STACK | 106 #ifndef MAX_SAVE_STACK |
| 107 #define MAX_SAVE_STACK 16000 | 107 #define MAX_SAVE_STACK 16000 |
| 108 #endif | 108 #endif |
| 109 | 109 |
| 110 /* Define DONT_COPY_FLAG to be the bit in a small string that was placed | 110 /* Define DONT_COPY_FLAG to be some bit which will always be zero in a |
| 111 in the low bit of the size field when marking small strings. */ | 111 pointer to a Lisp_Object, when that pointer is viewed as an integer. |
| 112 (On most machines, pointers are even, so we can use the low bit. | |
| 113 Word-addressible architectures may need to override this in the m-file.) | |
| 114 When linking references to small strings through the size field, we | |
| 115 use this slot to hold the bit that would otherwise be interpreted as | |
| 116 the GC mark bit. */ | |
| 112 #ifndef DONT_COPY_FLAG | 117 #ifndef DONT_COPY_FLAG |
| 113 #define DONT_COPY_FLAG PSEUDOVECTOR_FLAG | 118 #define DONT_COPY_FLAG 1 |
| 114 #endif /* no DONT_COPY_FLAG */ | 119 #endif /* no DONT_COPY_FLAG */ |
| 115 | 120 |
| 116 /* Buffer in which we save a copy of the C stack at each GC. */ | 121 /* Buffer in which we save a copy of the C stack at each GC. */ |
| 117 | 122 |
| 118 char *stack_copy; | 123 char *stack_copy; |
| 1507 ptr->size |= ARRAY_MARK_FLAG; | 1512 ptr->size |= ARRAY_MARK_FLAG; |
| 1508 else | 1513 else |
| 1509 { | 1514 { |
| 1510 /* A small string. Put this reference | 1515 /* A small string. Put this reference |
| 1511 into the chain of references to it. | 1516 into the chain of references to it. |
| 1512 The address OBJPTR is even, so if the address | 1517 If the address includes MARKBIT, put that bit elsewhere |
| 1513 includes MARKBIT, put it in the low bit | |
| 1514 when we store OBJPTR into the size field. */ | 1518 when we store OBJPTR into the size field. */ |
| 1515 | 1519 |
| 1516 if (XMARKBIT (*objptr)) | 1520 if (XMARKBIT (*objptr)) |
| 1517 { | 1521 { |
| 1518 XSETFASTINT (*objptr, ptr->size); | 1522 XSETFASTINT (*objptr, ptr->size); |
| 1521 else | 1525 else |
| 1522 XSETFASTINT (*objptr, ptr->size); | 1526 XSETFASTINT (*objptr, ptr->size); |
| 1523 | 1527 |
| 1524 if ((EMACS_INT) objptr & DONT_COPY_FLAG) | 1528 if ((EMACS_INT) objptr & DONT_COPY_FLAG) |
| 1525 abort (); | 1529 abort (); |
| 1526 ptr->size = (EMACS_INT) objptr & ~MARKBIT; | 1530 ptr->size = (EMACS_INT) objptr; |
| 1527 if ((EMACS_INT) objptr & MARKBIT) | 1531 if (ptr->size & MARKBIT) |
| 1528 ptr->size |= DONT_COPY_FLAG; | 1532 ptr->size ^= MARKBIT | DONT_COPY_FLAG; |
| 1529 } | 1533 } |
| 1530 } | 1534 } |
| 1531 break; | 1535 break; |
| 1532 | 1536 |
| 1533 case Lisp_Vectorlike: | 1537 case Lisp_Vectorlike: |
| 2041 { | 2045 { |
| 2042 s = (struct Lisp_String *) &sb->chars[0]; | 2046 s = (struct Lisp_String *) &sb->chars[0]; |
| 2043 if (s->size & ARRAY_MARK_FLAG) | 2047 if (s->size & ARRAY_MARK_FLAG) |
| 2044 { | 2048 { |
| 2045 ((struct Lisp_String *)(&sb->chars[0]))->size | 2049 ((struct Lisp_String *)(&sb->chars[0]))->size |
| 2046 &= ~ARRAY_MARK_FLAG & ~MARKBIT & ~DONT_COPY_FLAG; | 2050 &= ~ARRAY_MARK_FLAG & ~MARKBIT; |
| 2047 UNMARK_BALANCE_INTERVALS (s->intervals); | 2051 UNMARK_BALANCE_INTERVALS (s->intervals); |
| 2048 total_string_size += ((struct Lisp_String *)(&sb->chars[0]))->size; | 2052 total_string_size += ((struct Lisp_String *)(&sb->chars[0]))->size; |
| 2049 prev = sb, sb = sb->next; | 2053 prev = sb, sb = sb->next; |
| 2050 } | 2054 } |
| 2051 else | 2055 else |
