remove asynchronous input processing
authorBT Templeton <bpt@hcoop.net>
Wed, 30 May 2012 16:22:35 +0000 (12:22 -0400)
committerRobin Templeton <robin@terpri.org>
Mon, 9 Feb 2015 18:04:17 +0000 (13:04 -0500)
* configure.in (SYNC_INPUT): Remove this macro definition and its
  associated configure option. All references changed to assume that
  SYNC_INPUT is enabled.
* src/alloc.c (_bytes_used, __malloc_extra_blocks, _malloc_internal)
  (_free_internal, malloc_hysteresis): Remove variables which aren't
  used when SYNC_INPUT is enabled.

Conflicts:

src/alloc.c

src/alloc.c

index e2213db..b4a8ca6 100644 (file)
@@ -677,42 +677,6 @@ overrun_check_free (void *block)
 #define free overrun_check_free
 #endif
 
-/* If compiled with XMALLOC_BLOCK_INPUT_CHECK, define a symbol
-   BLOCK_INPUT_IN_MEMORY_ALLOCATORS that is visible to the debugger.
-   If that variable is set, block input while in one of Emacs's memory
-   allocation functions.  There should be no need for this debugging
-   option, since signal handlers do not allocate memory, but Emacs
-   formerly allocated memory in signal handlers and this compile-time
-   option remains as a way to help debug the issue should it rear its
-   ugly head again.  */
-#ifdef XMALLOC_BLOCK_INPUT_CHECK
-bool block_input_in_memory_allocators EXTERNALLY_VISIBLE;
-static void
-malloc_block_input (void)
-{
-  if (block_input_in_memory_allocators)
-    block_input ();
-}
-static void
-malloc_unblock_input (void)
-{
-  if (block_input_in_memory_allocators)
-    unblock_input ();
-}
-# define MALLOC_BLOCK_INPUT malloc_block_input ()
-# define MALLOC_UNBLOCK_INPUT malloc_unblock_input ()
-#else
-# define MALLOC_BLOCK_INPUT ((void) 0)
-# define MALLOC_UNBLOCK_INPUT ((void) 0)
-#endif
-
-#define MALLOC_PROBE(size)                     \
-  do {                                         \
-    if (profiler_memory_running)               \
-      malloc_probe (size);                     \
-  } while (0)
-
-
 /* Like malloc but check for no memory and block interrupt input..  */
 
 void *
@@ -720,13 +684,10 @@ xmalloc (size_t size)
 {
   void *val;
 
-  MALLOC_BLOCK_INPUT;
   val = malloc (size);
-  MALLOC_UNBLOCK_INPUT;
 
   if (!val && size)
     memory_full (size);
-  MALLOC_PROBE (size);
   return val;
 }
 
@@ -737,14 +698,11 @@ xzalloc (size_t size)
 {
   void *val;
 
-  MALLOC_BLOCK_INPUT;
   val = malloc (size);
-  MALLOC_UNBLOCK_INPUT;
 
   if (!val && size)
     memory_full (size);
   memset (val, 0, size);
-  MALLOC_PROBE (size);
   return val;
 }
 
@@ -755,18 +713,15 @@ xrealloc (void *block, size_t size)
 {
   void *val;
 
-  MALLOC_BLOCK_INPUT;
   /* We must call malloc explicitly when BLOCK is 0, since some
      reallocs don't do this.  */
   if (! block)
     val = malloc (size);
   else
     val = realloc (block, size);
-  MALLOC_UNBLOCK_INPUT;
 
   if (!val && size)
     memory_full (size);
-  MALLOC_PROBE (size);
   return val;
 }
 
@@ -778,9 +733,9 @@ xfree (void *block)
 {
   if (!block)
     return;
-  MALLOC_BLOCK_INPUT;
+
   free (block);
-  MALLOC_UNBLOCK_INPUT;
+
   /* We don't call refill_memory_reserve here
      because in practice the call in r_alloc_free seems to suffice.  */
 }
@@ -945,8 +900,6 @@ lisp_malloc (size_t nbytes, enum mem_type type)
 {
   register void *val;
 
-  MALLOC_BLOCK_INPUT;
-
 #ifdef GC_MALLOC_CHECK
   allocated_mem_type = type;
 #endif
@@ -975,10 +928,8 @@ lisp_malloc (size_t nbytes, enum mem_type type)
     mem_insert (val, (char *) val + nbytes, type);
 #endif
 
-  MALLOC_UNBLOCK_INPUT;
   if (!val && nbytes)
     memory_full (nbytes);
-  MALLOC_PROBE (nbytes);
   return val;
 }
 
@@ -988,12 +939,10 @@ lisp_malloc (size_t nbytes, enum mem_type type)
 static void
 lisp_free (void *block)
 {
-  MALLOC_BLOCK_INPUT;
   free (block);
 #if GC_MARK_STACK && !defined GC_MALLOC_CHECK
   mem_delete (mem_find (block));
 #endif
-  MALLOC_UNBLOCK_INPUT;
 }
 
 /*****  Allocation of aligned blocks of memory to store Lisp data.  *****/
@@ -1108,8 +1057,6 @@ lisp_align_malloc (size_t nbytes, enum mem_type type)
 
   eassert (nbytes <= BLOCK_BYTES);
 
-  MALLOC_BLOCK_INPUT;
-
 #ifdef GC_MALLOC_CHECK
   allocated_mem_type = type;
 #endif
@@ -1132,10 +1079,7 @@ lisp_align_malloc (size_t nbytes, enum mem_type type)
 #endif
 
       if (base == 0)
-       {
-         MALLOC_UNBLOCK_INPUT;
-         memory_full (ABLOCKS_BYTES);
-       }
+        memory_full (ABLOCKS_BYTES);
 
       aligned = (base == abase);
       if (!aligned)
@@ -1159,7 +1103,6 @@ lisp_align_malloc (size_t nbytes, enum mem_type type)
            {
              lisp_malloc_loser = base;
              free (base);
-             MALLOC_UNBLOCK_INPUT;
              memory_full (SIZE_MAX);
            }
        }
@@ -1193,10 +1136,6 @@ lisp_align_malloc (size_t nbytes, enum mem_type type)
     mem_insert (val, (char *) val + nbytes, type);
 #endif
 
-  MALLOC_UNBLOCK_INPUT;
-
-  MALLOC_PROBE (nbytes);
-
   eassert (0 == ((uintptr_t) val) % BLOCK_ALIGN);
   return val;
 }
@@ -1207,10 +1146,10 @@ lisp_align_free (void *block)
   struct ablock *ablock = block;
   struct ablocks *abase = ABLOCK_ABASE (ablock);
 
-  MALLOC_BLOCK_INPUT;
 #if GC_MARK_STACK && !defined GC_MALLOC_CHECK
   mem_delete (mem_find (block));
 #endif
+
   /* Put on free list.  */
   ablock->x.next_free = free_ablock;
   free_ablock = ablock;
@@ -1241,9 +1180,7 @@ lisp_align_free (void *block)
 #endif
       free (ABLOCKS_BASE (abase));
     }
-  MALLOC_UNBLOCK_INPUT;
 }
-
 \f
 /***********************************************************************
                         Interval Allocation
@@ -1290,8 +1227,6 @@ make_interval (void)
 {
   INTERVAL val;
 
-  MALLOC_BLOCK_INPUT;
-
   if (interval_free_list)
     {
       val = interval_free_list;
@@ -1312,8 +1247,6 @@ make_interval (void)
       val = &interval_block->intervals[interval_block_index++];
     }
 
-  MALLOC_UNBLOCK_INPUT;
-
   consing_since_gc += sizeof (struct interval);
   intervals_consed++;
   total_free_intervals--;
@@ -1689,8 +1622,6 @@ allocate_string (void)
 {
   struct Lisp_String *s;
 
-  MALLOC_BLOCK_INPUT;
-
   /* 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)
@@ -1719,8 +1650,6 @@ allocate_string (void)
   s = string_free_list;
   string_free_list = NEXT_FREE_LISP_STRING (s);
 
-  MALLOC_UNBLOCK_INPUT;
-
   --total_free_strings;
   ++total_strings;
   ++strings_consed;
@@ -1771,8 +1700,6 @@ allocate_string_data (struct Lisp_String *s,
   else
     old_data = NULL;
 
-  MALLOC_BLOCK_INPUT;
-
   if (nbytes > LARGE_STRING_BYTES)
     {
       size_t size = offsetof (struct sblock, data) + needed;
@@ -1817,8 +1744,6 @@ allocate_string_data (struct Lisp_String *s,
   data = b->next_free;
   b->next_free = (sdata *) ((char *) data + needed + GC_STRING_EXTRA);
 
-  MALLOC_UNBLOCK_INPUT;
-
   data->string = s;
   s->data = SDATA_DATA (data);
 #ifdef GC_CHECK_STRING_BYTES
@@ -2405,8 +2330,6 @@ make_float (double float_value)
 {
   register Lisp_Object val;
 
-  MALLOC_BLOCK_INPUT;
-
   if (float_free_list)
     {
       /* We use the data field for chaining the free list
@@ -2430,8 +2353,6 @@ make_float (double float_value)
       float_block_index++;
     }
 
-  MALLOC_UNBLOCK_INPUT;
-
   XFLOAT_INIT (val, float_value);
   eassert (!FLOAT_MARKED_P (XFLOAT (val)));
   consing_since_gc += sizeof (struct Lisp_Float);
@@ -2512,8 +2433,6 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0,
 {
   register Lisp_Object val;
 
-  MALLOC_BLOCK_INPUT;
-
   if (cons_free_list)
     {
       /* We use the cdr for chaining the free list
@@ -2537,8 +2456,6 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0,
       cons_block_index++;
     }
 
-  MALLOC_UNBLOCK_INPUT;
-
   XSETCAR (val, car);
   XSETCDR (val, cdr);
   eassert (!CONS_MARKED_P (XCONS (val)));
@@ -3105,7 +3022,12 @@ allocate_vectorlike (ptrdiff_t len)
 {
   struct Lisp_Vector *p;
 
-  MALLOC_BLOCK_INPUT;
+#ifdef DOUG_LEA_MALLOC
+  /* Prevent mmap'ing the chunk.  Lisp data may not be mmap'ed
+     because mapped region contents are not preserved in
+     a dumped Emacs.  */
+  mallopt (M_MMAP_MAX, 0);
+#endif
 
   if (len == 0)
     p = XVECTOR (zero_vector);
@@ -3143,8 +3065,6 @@ allocate_vectorlike (ptrdiff_t len)
       vector_cells_consed += len;
     }
 
-  MALLOC_UNBLOCK_INPUT;
-
   return p;
 }
 
@@ -3409,8 +3329,6 @@ Its value is void, and its function definition and property list are nil.  */)
 
   CHECK_STRING (name);
 
-  MALLOC_BLOCK_INPUT;
-
   if (symbol_free_list)
     {
       XSETSYMBOL (val, symbol_free_list);
@@ -3431,8 +3349,6 @@ Its value is void, and its function definition and property list are nil.  */)
       symbol_block_index++;
     }
 
-  MALLOC_UNBLOCK_INPUT;
-
   p = XSYMBOL (val);
   set_symbol_name (val, name);
   set_symbol_plist (val, Qnil);
@@ -3494,8 +3410,6 @@ allocate_misc (enum Lisp_Misc_Type type)
 {
   Lisp_Object val;
 
-  MALLOC_BLOCK_INPUT;
-
   if (marker_free_list)
     {
       XSETMISC (val, marker_free_list);
@@ -3515,8 +3429,6 @@ allocate_misc (enum Lisp_Misc_Type type)
       marker_block_index++;
     }
 
-  MALLOC_UNBLOCK_INPUT;
-
   --total_free_markers;
   consing_since_gc += sizeof (union Lisp_Misc);
   misc_objects_consed++;
@@ -3774,14 +3686,12 @@ memory_full (size_t nbytes)
     {
       void *p;
 
-      MALLOC_BLOCK_INPUT;
       p = malloc (SPARE_MEMORY);
       if (p)
        {
          free (p);
          enough_free_memory = 1;
        }
-      MALLOC_UNBLOCK_INPUT;
     }
 
   if (! enough_free_memory)