aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/alloc.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/alloc.c b/src/alloc.c
index ccd5a847dad..5776a2be927 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -107,10 +107,15 @@ Lisp_Object memory_signal_data;
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. */
@@ -1509,8 +1514,7 @@ mark_object (objptr)
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))
@@ -1523,9 +1527,9 @@ mark_object (objptr)
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;
@@ -2043,7 +2047,7 @@ gc_sweep ()
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;