diff src/alloc.c @ 83461:9b150bc96d33

Merged from miles@gnu.org--gnu-2005 (patch 187, 704) Patches applied: * emacs@sv.gnu.org/emacs--devo--0--base-0 tag of miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-704 * emacs@sv.gnu.org/emacs--devo--0--patch-1 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-2 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-3 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-4 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-5 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-6 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-7 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-8 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-9 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-10 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-11 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-12 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-13 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-14 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-15 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-16 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-17 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-18 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-19 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-20 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-21 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-22 Install ERC. * emacs@sv.gnu.org/emacs--devo--0--patch-23 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-24 Fix ERC compiler warnings. * emacs@sv.gnu.org/emacs--devo--0--patch-25 Use utf-8 encoding in ERC ChangeLogs. * emacs@sv.gnu.org/emacs--devo--0--patch-26 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-27 Merge ERC-related Viper hacks into Viper. * emacs@sv.gnu.org/emacs--devo--0--patch-28 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-29 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-30 Merge from erc--main--0 * emacs@sv.gnu.org/gnus--rel--5.10--base-0 tag of miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-187 * emacs@sv.gnu.org/gnus--rel--5.10--patch-1 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-2 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-3 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-4 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-5 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-6 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-7 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-704 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-187 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-501
author Karoly Lorentey <lorentey@elte.hu>
date Mon, 30 Jan 2006 18:06:22 +0000
parents 76396de7f50a 47782d80f30b
children b98066f4aa10
line wrap: on
line diff
--- a/src/alloc.c	Sun Jan 29 00:17:11 2006 +0000
+++ b/src/alloc.c	Mon Jan 30 18:06:22 2006 +0000
@@ -1,6 +1,6 @@
 /* Storage allocation and gc for GNU Emacs Lisp interpreter.
    Copyright (C) 1985, 1986, 1988, 1993, 1994, 1995, 1997, 1998, 1999,
-      2000, 2001, 2002, 2003, 2004, 2005  Free Software Foundation, Inc.
+      2000, 2001, 2002, 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -1107,6 +1107,9 @@
 	}
       eassert ((aligned & 1) == aligned);
       eassert (i == (aligned ? ABLOCKS_SIZE : ABLOCKS_SIZE - 1));
+#ifdef HAVE_POSIX_MEMALIGN
+      eassert ((unsigned long)ABLOCKS_BASE (abase) % BLOCK_ALIGN == 0);
+#endif
       free (ABLOCKS_BASE (abase));
     }
   UNBLOCK_INPUT;
@@ -1421,6 +1424,12 @@
 {
   INTERVAL val;
 
+  /* eassert (!handling_signal); */
+
+#ifndef SYNC_INPUT
+  BLOCK_INPUT;
+#endif
+
   if (interval_free_list)
     {
       val = interval_free_list;
@@ -1442,6 +1451,11 @@
 	}
       val = &interval_block->intervals[interval_block_index++];
     }
+
+#ifndef SYNC_INPUT
+  UNBLOCK_INPUT;
+#endif
+
   consing_since_gc += sizeof (struct interval);
   intervals_consed++;
   RESET_INTERVAL (val);
@@ -1839,6 +1853,12 @@
 {
   struct Lisp_String *s;
 
+  /* eassert (!handling_signal); */
+
+#ifndef SYNC_INPUT
+  BLOCK_INPUT;
+#endif
+
   /* If the free-list is empty, allocate a new string_block, and
      add all the Lisp_Strings in it to the free-list.  */
   if (string_free_list == NULL)
@@ -1868,6 +1888,10 @@
   s = string_free_list;
   string_free_list = NEXT_FREE_LISP_STRING (s);
 
+#ifndef SYNC_INPUT
+  UNBLOCK_INPUT;
+#endif
+
   /* Probably not strictly necessary, but play it safe.  */
   bzero (s, sizeof *s);
 
@@ -1915,6 +1939,12 @@
   /* Determine the number of bytes needed to store NBYTES bytes
      of string data.  */
   needed = SDATA_SIZE (nbytes);
+  old_data = s->data ? SDATA_OF_STRING (s) : NULL;
+  old_nbytes = GC_STRING_BYTES (s);
+
+#ifndef SYNC_INPUT
+  BLOCK_INPUT;
+#endif
 
   if (nbytes > LARGE_STRING_BYTES)
     {
@@ -1969,10 +1999,13 @@
   else
     b = current_sblock;
 
-  old_data = s->data ? SDATA_OF_STRING (s) : NULL;
-  old_nbytes = GC_STRING_BYTES (s);
-
   data = b->next_free;
+  b->next_free = (struct sdata *) ((char *) data + needed + GC_STRING_EXTRA);
+
+#ifndef SYNC_INPUT
+  UNBLOCK_INPUT;
+#endif
+
   data->string = s;
   s->data = SDATA_DATA (data);
 #ifdef GC_CHECK_STRING_BYTES
@@ -1985,7 +2018,6 @@
   bcopy (string_overrun_cookie, (char *) data + needed,
 	 GC_STRING_OVERRUN_COOKIE_SIZE);
 #endif
-  b->next_free = (struct sdata *) ((char *) data + needed + GC_STRING_EXTRA);
 
   /* If S had already data assigned, mark that as free by setting its
      string back-pointer to null, and recording the size of the data
@@ -2554,6 +2586,12 @@
 {
   register Lisp_Object val;
 
+  /* eassert (!handling_signal); */
+
+#ifndef SYNC_INPUT
+  BLOCK_INPUT;
+#endif
+
   if (float_free_list)
     {
       /* We use the data field for chaining the free list
@@ -2579,6 +2617,10 @@
       float_block_index++;
     }
 
+#ifndef SYNC_INPUT
+  UNBLOCK_INPUT;
+#endif
+
   XFLOAT_DATA (val) = float_value;
   eassert (!FLOAT_MARKED_P (XFLOAT (val)));
   consing_since_gc += sizeof (struct Lisp_Float);
@@ -2673,6 +2715,12 @@
 {
   register Lisp_Object val;
 
+  /* eassert (!handling_signal); */
+
+#ifndef SYNC_INPUT
+  BLOCK_INPUT;
+#endif
+
   if (cons_free_list)
     {
       /* We use the cdr for chaining the free list
@@ -2697,6 +2745,10 @@
       cons_block_index++;
     }
 
+#ifndef SYNC_INPUT
+  UNBLOCK_INPUT;
+#endif
+
   XSETCAR (val, car);
   XSETCDR (val, cdr);
   eassert (!CONS_MARKED_P (XCONS (val)));
@@ -2854,6 +2906,9 @@
   UNBLOCK_INPUT;
 #endif
 
+  /* This gets triggered by code which I haven't bothered to fix.  --Stef  */
+  /* eassert (!handling_signal); */
+
   nbytes = sizeof *p + (len - 1) * sizeof p->contents[0];
   p = (struct Lisp_Vector *) lisp_malloc (nbytes, type);
 
@@ -2867,8 +2922,17 @@
   consing_since_gc += nbytes;
   vector_cells_consed += len;
 
+#ifndef SYNC_INPUT
+  BLOCK_INPUT;
+#endif
+
   p->next = all_vectors;
   all_vectors = p;
+
+#ifndef SYNC_INPUT
+  UNBLOCK_INPUT;
+#endif
+
   ++n_vectors;
   return p;
 }
@@ -3147,6 +3211,12 @@
 
   CHECK_STRING (name);
 
+  eassert (!handling_signal);
+
+#ifndef SYNC_INPUT
+  BLOCK_INPUT;
+#endif
+
   if (symbol_free_list)
     {
       XSETSYMBOL (val, symbol_free_list);
@@ -3168,6 +3238,10 @@
       symbol_block_index++;
     }
 
+#ifndef SYNC_INPUT
+  UNBLOCK_INPUT;
+#endif
+
   p = XSYMBOL (val);
   p->xname = name;
   p->plist = Qnil;
@@ -3227,6 +3301,12 @@
 {
   Lisp_Object val;
 
+  /* eassert (!handling_signal); */
+
+#ifndef SYNC_INPUT
+  BLOCK_INPUT;
+#endif
+
   if (marker_free_list)
     {
       XSETMISC (val, marker_free_list);
@@ -3249,6 +3329,10 @@
       marker_block_index++;
     }
 
+#ifndef SYNC_INPUT
+  UNBLOCK_INPUT;
+#endif
+
   --total_free_markers;
   consing_since_gc += sizeof (union Lisp_Misc);
   misc_objects_consed++;
@@ -4642,7 +4726,7 @@
 check_pure_size ()
 {
   if (pure_bytes_used_before_overflow)
-    message ("Pure Lisp storage overflow (approx. %d bytes needed)",
+    message ("emacs:0:Pure Lisp storage overflow (approx. %d bytes needed)",
 	     (int) (pure_bytes_used + pure_bytes_used_before_overflow));
 }