aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1995-01-11 01:19:09 +0000
committerRichard M. Stallman1995-01-11 01:19:09 +0000
commit155ffe9c93bb796e6ce7688de3fbf366a4bf4159 (patch)
tree7ffc59050ae9e424063a1012fc69bc3b5678e28a
parent99e372cd359b9ec8b2db58f1dad7ffc6f17b777e (diff)
downloademacs-155ffe9c93bb796e6ce7688de3fbf366a4bf4159.tar.gz
emacs-155ffe9c93bb796e6ce7688de3fbf366a4bf4159.zip
(DONT_COPY_FLAG): New bit flag.
(mark_object, gc_sweep, compact_strings): Use it.
-rw-r--r--src/alloc.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 044356914e5..64b7a11e3f2 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -107,6 +107,12 @@ 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
111 in the low bit of the size field when marking small strings. */
112#ifndef DONT_COPY_FLAG
113#define DONT_COPY_FLAG PSEUDO_VECTOR_FLAG
114#endif /* no DONT_COPY_FLAG */
115
110/* Buffer in which we save a copy of the C stack at each GC. */ 116/* Buffer in which we save a copy of the C stack at each GC. */
111 117
112char *stack_copy; 118char *stack_copy;
@@ -1514,10 +1520,12 @@ mark_object (objptr)
1514 } 1520 }
1515 else 1521 else
1516 XSETFASTINT (*objptr, ptr->size); 1522 XSETFASTINT (*objptr, ptr->size);
1517 if ((EMACS_INT) objptr & 1) abort (); 1523
1524 if ((EMACS_INT) objptr & DONT_COPY_FLAG)
1525 abort ();
1518 ptr->size = (EMACS_INT) objptr & ~MARKBIT; 1526 ptr->size = (EMACS_INT) objptr & ~MARKBIT;
1519 if ((EMACS_INT) objptr & MARKBIT) 1527 if ((EMACS_INT) objptr & MARKBIT)
1520 ptr->size ++; 1528 ptr->size |= DONT_COPY_FLAG;
1521 } 1529 }
1522 } 1530 }
1523 break; 1531 break;
@@ -2035,7 +2043,7 @@ gc_sweep ()
2035 if (s->size & ARRAY_MARK_FLAG) 2043 if (s->size & ARRAY_MARK_FLAG)
2036 { 2044 {
2037 ((struct Lisp_String *)(&sb->chars[0]))->size 2045 ((struct Lisp_String *)(&sb->chars[0]))->size
2038 &= ~ARRAY_MARK_FLAG & ~MARKBIT; 2046 &= ~ARRAY_MARK_FLAG & ~MARKBIT & ~DONT_COPY_FLAG;
2039 UNMARK_BALANCE_INTERVALS (s->intervals); 2047 UNMARK_BALANCE_INTERVALS (s->intervals);
2040 total_string_size += ((struct Lisp_String *)(&sb->chars[0]))->size; 2048 total_string_size += ((struct Lisp_String *)(&sb->chars[0]))->size;
2041 prev = sb, sb = sb->next; 2049 prev = sb, sb = sb->next;
@@ -2085,13 +2093,14 @@ compact_strings ()
2085 2093
2086 /* NEXTSTR is the old address of the next string. 2094 /* NEXTSTR is the old address of the next string.
2087 Just skip it if it isn't marked. */ 2095 Just skip it if it isn't marked. */
2088 if ((EMACS_UINT) size > STRING_BLOCK_SIZE) 2096 if (((EMACS_UINT) size & ~DONT_COPY_FLAG) > STRING_BLOCK_SIZE)
2089 { 2097 {
2090 /* It is marked, so its size field is really a chain of refs. 2098 /* It is marked, so its size field is really a chain of refs.
2091 Find the end of the chain, where the actual size lives. */ 2099 Find the end of the chain, where the actual size lives. */
2092 while ((EMACS_UINT) size > STRING_BLOCK_SIZE) 2100 while (((EMACS_UINT) size & ~DONT_COPY_FLAG) > STRING_BLOCK_SIZE)
2093 { 2101 {
2094 if (size & 1) size ^= MARKBIT | 1; 2102 if (size & DONT_COPY_FLAG)
2103 size ^= MARKBIT | DONT_COPY_FLAG;
2095 size = *(EMACS_INT *)size & ~MARKBIT; 2104 size = *(EMACS_INT *)size & ~MARKBIT;
2096 } 2105 }
2097 2106
@@ -2125,10 +2134,11 @@ compact_strings ()
2125 and make each slot in the chain point to 2134 and make each slot in the chain point to
2126 the new address of this string. */ 2135 the new address of this string. */
2127 size = newaddr->size; 2136 size = newaddr->size;
2128 while ((EMACS_UINT) size > STRING_BLOCK_SIZE) 2137 while (((EMACS_UINT) size & ~DONT_COPY_FLAG) > STRING_BLOCK_SIZE)
2129 { 2138 {
2130 register Lisp_Object *objptr; 2139 register Lisp_Object *objptr;
2131 if (size & 1) size ^= MARKBIT | 1; 2140 if (size & DONT_COPY_FLAG)
2141 size ^= MARKBIT | DONT_COPY_FLAG;
2132 objptr = (Lisp_Object *)size; 2142 objptr = (Lisp_Object *)size;
2133 2143
2134 size = XFASTINT (*objptr) & ~MARKBIT; 2144 size = XFASTINT (*objptr) & ~MARKBIT;