aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorDmitry Antipov2012-09-06 13:15:44 +0400
committerDmitry Antipov2012-09-06 13:15:44 +0400
commitc752cfa916879f7415990855b52862dd585242ec (patch)
tree01e45e518004fb11b795072e060b2336847080dc /src/alloc.c
parent826b32357739a0ce755a5a2cadb3552b6914f4b3 (diff)
downloademacs-c752cfa916879f7415990855b52862dd585242ec.tar.gz
emacs-c752cfa916879f7415990855b52862dd585242ec.zip
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.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/alloc.c b/src/alloc.c
index aca0a82d1b5..1a9718bcb25 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -278,6 +278,7 @@ static void gc_sweep (void);
278static Lisp_Object make_pure_vector (ptrdiff_t); 278static Lisp_Object make_pure_vector (ptrdiff_t);
279static void mark_glyph_matrix (struct glyph_matrix *); 279static void mark_glyph_matrix (struct glyph_matrix *);
280static void mark_face_cache (struct face_cache *); 280static void mark_face_cache (struct face_cache *);
281static void mark_buffer (struct buffer *);
281 282
282#if !defined REL_ALLOC || defined SYSTEM_MALLOC 283#if !defined REL_ALLOC || defined SYSTEM_MALLOC
283static void refill_memory_reserve (void); 284static void refill_memory_reserve (void);
@@ -3281,7 +3282,10 @@ allocate_buffer (void)
3281 3282
3282 XSETPVECTYPESIZE (b, PVEC_BUFFER, (offsetof (struct buffer, own_text) 3283 XSETPVECTYPESIZE (b, PVEC_BUFFER, (offsetof (struct buffer, own_text)
3283 - header_size) / word_size); 3284 - header_size) / word_size);
3284 /* Note that the fields of B are not initialized. */ 3285 /* Put B on the chain of all buffers including killed ones. */
3286 b->header.next.buffer = all_buffers;
3287 all_buffers = b;
3288 /* Note that the rest fields of B are not initialized. */
3285 return b; 3289 return b;
3286} 3290}
3287 3291
@@ -5473,6 +5477,9 @@ See Info node `(elisp)Garbage Collection'. */)
5473 5477
5474 /* Mark all the special slots that serve as the roots of accessibility. */ 5478 /* Mark all the special slots that serve as the roots of accessibility. */
5475 5479
5480 mark_buffer (&buffer_defaults);
5481 mark_buffer (&buffer_local_symbols);
5482
5476 for (i = 0; i < staticidx; i++) 5483 for (i = 0; i < staticidx; i++)
5477 mark_object (*staticvec[i]); 5484 mark_object (*staticvec[i]);
5478 5485
@@ -5950,9 +5957,7 @@ mark_object (Lisp_Object arg)
5950 5957
5951#ifdef GC_CHECK_MARKED_OBJECTS 5958#ifdef GC_CHECK_MARKED_OBJECTS
5952 m = mem_find (po); 5959 m = mem_find (po);
5953 if (m == MEM_NIL && !SUBRP (obj) 5960 if (m == MEM_NIL && !SUBRP (obj))
5954 && po != &buffer_defaults
5955 && po != &buffer_local_symbols)
5956 emacs_abort (); 5961 emacs_abort ();
5957#endif /* GC_CHECK_MARKED_OBJECTS */ 5962#endif /* GC_CHECK_MARKED_OBJECTS */
5958 5963
@@ -5969,15 +5974,14 @@ mark_object (Lisp_Object arg)
5969 { 5974 {
5970 case PVEC_BUFFER: 5975 case PVEC_BUFFER:
5971#ifdef GC_CHECK_MARKED_OBJECTS 5976#ifdef GC_CHECK_MARKED_OBJECTS
5972 if (po != &buffer_defaults && po != &buffer_local_symbols) 5977 {
5973 { 5978 struct buffer *b;
5974 struct buffer *b; 5979 FOR_EACH_BUFFER (b)
5975 FOR_EACH_BUFFER (b) 5980 if (b == po)
5976 if (b == po) 5981 break;
5977 break; 5982 if (b == NULL)
5978 if (b == NULL) 5983 emacs_abort ();
5979 emacs_abort (); 5984 }
5980 }
5981#endif /* GC_CHECK_MARKED_OBJECTS */ 5985#endif /* GC_CHECK_MARKED_OBJECTS */
5982 mark_buffer ((struct buffer *) ptr); 5986 mark_buffer ((struct buffer *) ptr);
5983 break; 5987 break;