emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r108841: * alloc.c (allocate_vector_b


From: Dmitry Antipov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r108841: * alloc.c (allocate_vector_block): Remove redundant
Date: Tue, 03 Jul 2012 15:09:36 +0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 108841
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Tue 2012-07-03 15:09:36 +0400
message:
  * alloc.c (allocate_vector_block): Remove redundant
  calls to mallopt if DOUG_LEA_MALLOC is defined.
  (allocate_vectorlike): If DOUG_LEA_MALLOC is defined,
  avoid calls to mallopt if zero_vector is returned.
modified:
  src/ChangeLog
  src/alloc.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-07-03 10:21:01 +0000
+++ b/src/ChangeLog     2012-07-03 11:09:36 +0000
@@ -1,5 +1,12 @@
 2012-07-03  Dmitry Antipov  <address@hidden>
 
+       * alloc.c (allocate_vector_block): Remove redundant
+       calls to mallopt if DOUG_LEA_MALLOC is defined.
+       (allocate_vectorlike): If DOUG_LEA_MALLOC is defined,
+       avoid calls to mallopt if zero_vector is returned.
+
+2012-07-03  Dmitry Antipov  <address@hidden>
+
        * alloc.c (check_string_bytes): If GC_CHECK_STRING_BYTES
        is enabled, avoid dereferencing NULL current_sblock if
        running undumped.

=== modified file 'src/alloc.c'
--- a/src/alloc.c       2012-07-03 10:21:01 +0000
+++ b/src/alloc.c       2012-07-03 11:09:36 +0000
@@ -2958,17 +2958,7 @@
 static struct vector_block *
 allocate_vector_block (void)
 {
-  struct vector_block *block;
-
-#ifdef DOUG_LEA_MALLOC
-  mallopt (M_MMAP_MAX, 0);
-#endif
-
-  block = xmalloc (sizeof (struct vector_block));
-
-#ifdef DOUG_LEA_MALLOC
-  mallopt (M_MMAP_MAX, MMAP_MAX_AREAS);
-#endif
+  struct vector_block *block = xmalloc (sizeof (struct vector_block));
 
 #if GC_MARK_STACK && !defined GC_MALLOC_CHECK
   mem_insert (block->data, block->data + VECTOR_BLOCK_BYTES,
@@ -3166,45 +3156,43 @@
 allocate_vectorlike (ptrdiff_t len)
 {
   struct Lisp_Vector *p;
-  size_t nbytes;
 
   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
-
   /* This gets triggered by code which I haven't bothered to fix.  --Stef  */
   /* eassert (!handling_signal); */
 
   if (len == 0)
-    {
-      MALLOC_UNBLOCK_INPUT;
-      return zero_vector;
-    }
-
-  nbytes = header_size + len * word_size;
-
-  if (nbytes <= VBLOCK_BYTES_MAX)
-    p = allocate_vector_from_block (vroundup (nbytes));
+    p = zero_vector;
   else
     {
-      p = (struct Lisp_Vector *) lisp_malloc (nbytes, MEM_TYPE_VECTORLIKE);
-      p->header.next.vector = large_vectors;
-      large_vectors = p;
+      size_t nbytes = header_size + len * word_size;
+
+#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 (nbytes <= VBLOCK_BYTES_MAX)
+       p = allocate_vector_from_block (vroundup (nbytes));
+      else
+       {
+         p = (struct Lisp_Vector *) lisp_malloc (nbytes, MEM_TYPE_VECTORLIKE);
+         p->header.next.vector = large_vectors;
+         large_vectors = p;
+       }
+
+#ifdef DOUG_LEA_MALLOC
+      /* Back to a reasonable maximum of mmap'ed areas.  */
+      mallopt (M_MMAP_MAX, MMAP_MAX_AREAS);
+#endif
+
+      consing_since_gc += nbytes;
+      vector_cells_consed += len;
     }
 
-#ifdef DOUG_LEA_MALLOC
-  /* Back to a reasonable maximum of mmap'ed areas.  */
-  mallopt (M_MMAP_MAX, MMAP_MAX_AREAS);
-#endif
-
-  consing_since_gc += nbytes;
-  vector_cells_consed += len;
-
   MALLOC_UNBLOCK_INPUT;
 
   return p;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]