emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r109902: Explicitly mark buffer_defau


From: Dmitry Antipov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109902: Explicitly mark buffer_defaults and buffer_local_symbols.
Date: Thu, 06 Sep 2012 13:15:44 +0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109902
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Thu 2012-09-06 13:15:44 +0400
message:
  Explicitly mark buffer_defaults and buffer_local_symbols.
  * alloc.c (Fgarbage_collect): Mark buffer_defaults and
  mark_local_symbols here.
  (mark_object): If GC_CHECK_MARKED_OBJECTS, simplify checking
  since special buffers aren't marked here any more.
  (allocate_buffer): Chain new buffer with all_buffers here...
  * buffer.c (Fget_buffer_create, Fmake_indirect_buffer): ...and
  not here.
  (Vbuffer_defaults, Vbuffer_local_symbols): Remove.
  (syms_of_buffer): Remove staticpro of the above.
  (init_buffer_once): Set names for buffer_defaults and
  buffer_local_symbols.
modified:
  src/ChangeLog
  src/alloc.c
  src/buffer.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-09-06 08:04:49 +0000
+++ b/src/ChangeLog     2012-09-06 09:15:44 +0000
@@ -1,3 +1,18 @@
+2012-09-06  Dmitry Antipov  <address@hidden>
+
+       Explicitly mark buffer_defaults and buffer_local_symbols.
+       * alloc.c (Fgarbage_collect): Mark buffer_defaults and
+       mark_local_symbols here.
+       (mark_object): If GC_CHECK_MARKED_OBJECTS, simplify checking
+       since special buffers aren't marked here any more.
+       (allocate_buffer): Chain new buffer with all_buffers here...
+       * buffer.c (Fget_buffer_create, Fmake_indirect_buffer): ...and
+       not here.
+       (Vbuffer_defaults, Vbuffer_local_symbols): Remove.
+       (syms_of_buffer): Remove staticpro of the above.
+       (init_buffer_once): Set names for buffer_defaults and
+       buffer_local_symbols.
+
 2012-09-06  Paul Eggert  <address@hidden>
 
        Use bool for booleans in font-related modules.

=== modified file 'src/alloc.c'
--- a/src/alloc.c       2012-09-06 07:10:25 +0000
+++ b/src/alloc.c       2012-09-06 09:15:44 +0000
@@ -278,6 +278,7 @@
 static Lisp_Object make_pure_vector (ptrdiff_t);
 static void mark_glyph_matrix (struct glyph_matrix *);
 static void mark_face_cache (struct face_cache *);
+static void mark_buffer (struct buffer *);
 
 #if !defined REL_ALLOC || defined SYSTEM_MALLOC
 static void refill_memory_reserve (void);
@@ -3281,7 +3282,10 @@
 
   XSETPVECTYPESIZE (b, PVEC_BUFFER, (offsetof (struct buffer, own_text)
                                     - header_size) / word_size);
-  /* Note that the fields of B are not initialized.  */
+  /* Put B on the chain of all buffers including killed ones.  */
+  b->header.next.buffer = all_buffers;
+  all_buffers = b;
+  /* Note that the rest fields of B are not initialized.  */
   return b;
 }
 
@@ -5473,6 +5477,9 @@
 
   /* Mark all the special slots that serve as the roots of accessibility.  */
 
+  mark_buffer (&buffer_defaults);
+  mark_buffer (&buffer_local_symbols);
+
   for (i = 0; i < staticidx; i++)
     mark_object (*staticvec[i]);
 
@@ -5950,9 +5957,7 @@
 
 #ifdef GC_CHECK_MARKED_OBJECTS
        m = mem_find (po);
-       if (m == MEM_NIL && !SUBRP (obj)
-           && po != &buffer_defaults
-           && po != &buffer_local_symbols)
+       if (m == MEM_NIL && !SUBRP (obj))
          emacs_abort ();
 #endif /* GC_CHECK_MARKED_OBJECTS */
 
@@ -5969,15 +5974,14 @@
          {
          case PVEC_BUFFER:
 #ifdef GC_CHECK_MARKED_OBJECTS
-           if (po != &buffer_defaults && po != &buffer_local_symbols)
-             {
-               struct buffer *b;
-               FOR_EACH_BUFFER (b)
-                 if (b == po)
-                   break;
-               if (b == NULL)
-                 emacs_abort ();
-             }
+           {
+             struct buffer *b;
+             FOR_EACH_BUFFER (b)
+               if (b == po)
+                 break;
+             if (b == NULL)
+               emacs_abort ();
+           }
 #endif /* GC_CHECK_MARKED_OBJECTS */
            mark_buffer ((struct buffer *) ptr);
            break;

=== modified file 'src/buffer.c'
--- a/src/buffer.c      2012-09-04 17:34:54 +0000
+++ b/src/buffer.c      2012-09-06 09:15:44 +0000
@@ -60,10 +60,6 @@
 
 struct buffer alignas (GCALIGNMENT) buffer_defaults;
 
-/* A Lisp_Object pointer to the above, used for staticpro */
-
-static Lisp_Object Vbuffer_defaults;
-
 /* This structure marks which slots in a buffer have corresponding
    default values in buffer_defaults.
    Each such slot has a nonzero value in this structure.
@@ -87,9 +83,6 @@
 
 struct buffer alignas (GCALIGNMENT) buffer_local_symbols;
 
-/* A Lisp_Object pointer to the above, used for staticpro */
-static Lisp_Object Vbuffer_local_symbols;
-
 /* Return the symbol of the per-buffer variable at offset OFFSET in
    the buffer structure.  */
 
@@ -595,10 +588,6 @@
   bset_width_table (b, Qnil);
   b->prevent_redisplay_optimizations_p = 1;
 
-  /* Put this on the chain of all buffers including killed ones.  */
-  b->header.next.buffer = all_buffers;
-  all_buffers = b;
-
   /* An ordinary buffer normally doesn't need markers
      to handle BEGV and ZV.  */
   bset_pt_marker (b, Qnil);
@@ -819,10 +808,6 @@
   b->width_run_cache = 0;
   bset_width_table (b, Qnil);
 
-  /* Put this on the chain of all buffers including killed ones.  */
-  b->header.next.buffer = all_buffers;
-  all_buffers = b;
-
   name = Fcopy_sequence (name);
   set_string_intervals (name, NULL);
   bset_name (b, name);
@@ -5145,10 +5130,11 @@
   buffer_local_symbols.indirections = 0;
   set_buffer_intervals (&buffer_defaults, NULL);
   set_buffer_intervals (&buffer_local_symbols, NULL);
+  /* This is not strictly necessary, but let's make them initialized.  */
+  bset_name (&buffer_defaults, build_pure_c_string (" *buffer-defaults*"));
+  bset_name (&buffer_local_symbols, build_pure_c_string (" 
*buffer-local-symbols*"));
   XSETPVECTYPESIZE (&buffer_defaults, PVEC_BUFFER, pvecsize);
-  XSETBUFFER (Vbuffer_defaults, &buffer_defaults);
   XSETPVECTYPESIZE (&buffer_local_symbols, PVEC_BUFFER, pvecsize);
-  XSETBUFFER (Vbuffer_local_symbols, &buffer_local_symbols);
 
   /* Set up the default values of various buffer slots.  */
   /* Must do these before making the first buffer! */
@@ -5430,8 +5416,6 @@
   last_overlay_modification_hooks
     = Fmake_vector (make_number (10), Qnil);
 
-  staticpro (&Vbuffer_defaults);
-  staticpro (&Vbuffer_local_symbols);
   staticpro (&Qfundamental_mode);
   staticpro (&Qmode_class);
   staticpro (&QSFundamental);


reply via email to

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