changeset 10389:162b3e6c4610

(DONT_COPY_FLAG): New bit flag. (mark_object, gc_sweep, compact_strings): Use it.
author Richard M. Stallman <rms@gnu.org>
date Wed, 11 Jan 1995 01:19:09 +0000
parents 0ae5926bdee7
children a653accbfcbb
files src/alloc.c
diffstat 1 files changed, 18 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/alloc.c	Wed Jan 11 01:18:41 1995 +0000
+++ b/src/alloc.c	Wed Jan 11 01:19:09 1995 +0000
@@ -107,6 +107,12 @@
 #define MAX_SAVE_STACK 16000
 #endif
 
+/* Define DONT_COPY_FLAG to be the bit in a small string that was placed
+   in the low bit of the size field when marking small strings.  */
+#ifndef DONT_COPY_FLAG
+#define DONT_COPY_FLAG PSEUDO_VECTOR_FLAG
+#endif /* no DONT_COPY_FLAG  */
+
 /* Buffer in which we save a copy of the C stack at each GC.  */
 
 char *stack_copy;
@@ -1514,10 +1520,12 @@
 	      }
 	    else
 	      XSETFASTINT (*objptr, ptr->size);
-	    if ((EMACS_INT) objptr & 1) abort ();
+
+	    if ((EMACS_INT) objptr & DONT_COPY_FLAG)
+	      abort ();
 	    ptr->size = (EMACS_INT) objptr & ~MARKBIT;
 	    if ((EMACS_INT) objptr & MARKBIT)
-	      ptr->size ++;
+	      ptr->size |= DONT_COPY_FLAG;
 	  }
       }
       break;
@@ -2035,7 +2043,7 @@
 	if (s->size & ARRAY_MARK_FLAG)
 	  {
 	    ((struct Lisp_String *)(&sb->chars[0]))->size
-	      &= ~ARRAY_MARK_FLAG & ~MARKBIT;
+	      &= ~ARRAY_MARK_FLAG & ~MARKBIT & ~DONT_COPY_FLAG;
 	    UNMARK_BALANCE_INTERVALS (s->intervals);
 	    total_string_size += ((struct Lisp_String *)(&sb->chars[0]))->size;
 	    prev = sb, sb = sb->next;
@@ -2085,13 +2093,14 @@
 
 	  /* NEXTSTR is the old address of the next string.
 	     Just skip it if it isn't marked.  */
-	  if ((EMACS_UINT) size > STRING_BLOCK_SIZE)
+	  if (((EMACS_UINT) size & ~DONT_COPY_FLAG) > STRING_BLOCK_SIZE)
 	    {
 	      /* It is marked, so its size field is really a chain of refs.
 		 Find the end of the chain, where the actual size lives.  */
-	      while ((EMACS_UINT) size > STRING_BLOCK_SIZE)
+	      while (((EMACS_UINT) size & ~DONT_COPY_FLAG) > STRING_BLOCK_SIZE)
 		{
-		  if (size & 1) size ^= MARKBIT | 1;
+		  if (size & DONT_COPY_FLAG)
+		    size ^= MARKBIT | DONT_COPY_FLAG;
 		  size = *(EMACS_INT *)size & ~MARKBIT;
 		}
 
@@ -2125,10 +2134,11 @@
 		 and make each slot in the chain point to
 		 the new address of this string.  */
 	      size = newaddr->size;
-	      while ((EMACS_UINT) size > STRING_BLOCK_SIZE)
+	      while (((EMACS_UINT) size & ~DONT_COPY_FLAG) > STRING_BLOCK_SIZE)
 		{
 		  register Lisp_Object *objptr;
-		  if (size & 1) size ^= MARKBIT | 1;
+		  if (size & DONT_COPY_FLAG)
+		    size ^= MARKBIT | DONT_COPY_FLAG;
 		  objptr = (Lisp_Object *)size;
 
 		  size = XFASTINT (*objptr) & ~MARKBIT;