diff options
| author | Dmitry Antipov | 2012-09-06 13:15:44 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2012-09-06 13:15:44 +0400 |
| commit | c752cfa916879f7415990855b52862dd585242ec (patch) | |
| tree | 01e45e518004fb11b795072e060b2336847080dc /src | |
| parent | 826b32357739a0ce755a5a2cadb3552b6914f4b3 (diff) | |
| download | emacs-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')
| -rw-r--r-- | src/ChangeLog | 15 | ||||
| -rw-r--r-- | src/alloc.c | 30 | ||||
| -rw-r--r-- | src/buffer.c | 22 |
3 files changed, 35 insertions, 32 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 2ca75d416af..a017ef7fdab 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,18 @@ | |||
| 1 | 2012-09-06 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 2 | |||
| 3 | Explicitly mark buffer_defaults and buffer_local_symbols. | ||
| 4 | * alloc.c (Fgarbage_collect): Mark buffer_defaults and | ||
| 5 | mark_local_symbols here. | ||
| 6 | (mark_object): If GC_CHECK_MARKED_OBJECTS, simplify checking | ||
| 7 | since special buffers aren't marked here any more. | ||
| 8 | (allocate_buffer): Chain new buffer with all_buffers here... | ||
| 9 | * buffer.c (Fget_buffer_create, Fmake_indirect_buffer): ...and | ||
| 10 | not here. | ||
| 11 | (Vbuffer_defaults, Vbuffer_local_symbols): Remove. | ||
| 12 | (syms_of_buffer): Remove staticpro of the above. | ||
| 13 | (init_buffer_once): Set names for buffer_defaults and | ||
| 14 | buffer_local_symbols. | ||
| 15 | |||
| 1 | 2012-09-06 Paul Eggert <eggert@cs.ucla.edu> | 16 | 2012-09-06 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 17 | ||
| 3 | Use bool for booleans in font-related modules. | 18 | Use bool for booleans in font-related modules. |
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); | |||
| 278 | static Lisp_Object make_pure_vector (ptrdiff_t); | 278 | static Lisp_Object make_pure_vector (ptrdiff_t); |
| 279 | static void mark_glyph_matrix (struct glyph_matrix *); | 279 | static void mark_glyph_matrix (struct glyph_matrix *); |
| 280 | static void mark_face_cache (struct face_cache *); | 280 | static void mark_face_cache (struct face_cache *); |
| 281 | static void mark_buffer (struct buffer *); | ||
| 281 | 282 | ||
| 282 | #if !defined REL_ALLOC || defined SYSTEM_MALLOC | 283 | #if !defined REL_ALLOC || defined SYSTEM_MALLOC |
| 283 | static void refill_memory_reserve (void); | 284 | static 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; |
diff --git a/src/buffer.c b/src/buffer.c index 7698b72a3c6..187277d663b 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -60,10 +60,6 @@ struct buffer *all_buffers; | |||
| 60 | 60 | ||
| 61 | struct buffer alignas (GCALIGNMENT) buffer_defaults; | 61 | struct buffer alignas (GCALIGNMENT) buffer_defaults; |
| 62 | 62 | ||
| 63 | /* A Lisp_Object pointer to the above, used for staticpro */ | ||
| 64 | |||
| 65 | static Lisp_Object Vbuffer_defaults; | ||
| 66 | |||
| 67 | /* This structure marks which slots in a buffer have corresponding | 63 | /* This structure marks which slots in a buffer have corresponding |
| 68 | default values in buffer_defaults. | 64 | default values in buffer_defaults. |
| 69 | Each such slot has a nonzero value in this structure. | 65 | Each such slot has a nonzero value in this structure. |
| @@ -87,9 +83,6 @@ struct buffer buffer_local_flags; | |||
| 87 | 83 | ||
| 88 | struct buffer alignas (GCALIGNMENT) buffer_local_symbols; | 84 | struct buffer alignas (GCALIGNMENT) buffer_local_symbols; |
| 89 | 85 | ||
| 90 | /* A Lisp_Object pointer to the above, used for staticpro */ | ||
| 91 | static Lisp_Object Vbuffer_local_symbols; | ||
| 92 | |||
| 93 | /* Return the symbol of the per-buffer variable at offset OFFSET in | 86 | /* Return the symbol of the per-buffer variable at offset OFFSET in |
| 94 | the buffer structure. */ | 87 | the buffer structure. */ |
| 95 | 88 | ||
| @@ -595,10 +588,6 @@ even if it is dead. The return value is never nil. */) | |||
| 595 | bset_width_table (b, Qnil); | 588 | bset_width_table (b, Qnil); |
| 596 | b->prevent_redisplay_optimizations_p = 1; | 589 | b->prevent_redisplay_optimizations_p = 1; |
| 597 | 590 | ||
| 598 | /* Put this on the chain of all buffers including killed ones. */ | ||
| 599 | b->header.next.buffer = all_buffers; | ||
| 600 | all_buffers = b; | ||
| 601 | |||
| 602 | /* An ordinary buffer normally doesn't need markers | 591 | /* An ordinary buffer normally doesn't need markers |
| 603 | to handle BEGV and ZV. */ | 592 | to handle BEGV and ZV. */ |
| 604 | bset_pt_marker (b, Qnil); | 593 | bset_pt_marker (b, Qnil); |
| @@ -819,10 +808,6 @@ CLONE nil means the indirect buffer's state is reset to default values. */) | |||
| 819 | b->width_run_cache = 0; | 808 | b->width_run_cache = 0; |
| 820 | bset_width_table (b, Qnil); | 809 | bset_width_table (b, Qnil); |
| 821 | 810 | ||
| 822 | /* Put this on the chain of all buffers including killed ones. */ | ||
| 823 | b->header.next.buffer = all_buffers; | ||
| 824 | all_buffers = b; | ||
| 825 | |||
| 826 | name = Fcopy_sequence (name); | 811 | name = Fcopy_sequence (name); |
| 827 | set_string_intervals (name, NULL); | 812 | set_string_intervals (name, NULL); |
| 828 | bset_name (b, name); | 813 | bset_name (b, name); |
| @@ -5145,10 +5130,11 @@ init_buffer_once (void) | |||
| 5145 | buffer_local_symbols.indirections = 0; | 5130 | buffer_local_symbols.indirections = 0; |
| 5146 | set_buffer_intervals (&buffer_defaults, NULL); | 5131 | set_buffer_intervals (&buffer_defaults, NULL); |
| 5147 | set_buffer_intervals (&buffer_local_symbols, NULL); | 5132 | set_buffer_intervals (&buffer_local_symbols, NULL); |
| 5133 | /* This is not strictly necessary, but let's make them initialized. */ | ||
| 5134 | bset_name (&buffer_defaults, build_pure_c_string (" *buffer-defaults*")); | ||
| 5135 | bset_name (&buffer_local_symbols, build_pure_c_string (" *buffer-local-symbols*")); | ||
| 5148 | XSETPVECTYPESIZE (&buffer_defaults, PVEC_BUFFER, pvecsize); | 5136 | XSETPVECTYPESIZE (&buffer_defaults, PVEC_BUFFER, pvecsize); |
| 5149 | XSETBUFFER (Vbuffer_defaults, &buffer_defaults); | ||
| 5150 | XSETPVECTYPESIZE (&buffer_local_symbols, PVEC_BUFFER, pvecsize); | 5137 | XSETPVECTYPESIZE (&buffer_local_symbols, PVEC_BUFFER, pvecsize); |
| 5151 | XSETBUFFER (Vbuffer_local_symbols, &buffer_local_symbols); | ||
| 5152 | 5138 | ||
| 5153 | /* Set up the default values of various buffer slots. */ | 5139 | /* Set up the default values of various buffer slots. */ |
| 5154 | /* Must do these before making the first buffer! */ | 5140 | /* Must do these before making the first buffer! */ |
| @@ -5430,8 +5416,6 @@ syms_of_buffer (void) | |||
| 5430 | last_overlay_modification_hooks | 5416 | last_overlay_modification_hooks |
| 5431 | = Fmake_vector (make_number (10), Qnil); | 5417 | = Fmake_vector (make_number (10), Qnil); |
| 5432 | 5418 | ||
| 5433 | staticpro (&Vbuffer_defaults); | ||
| 5434 | staticpro (&Vbuffer_local_symbols); | ||
| 5435 | staticpro (&Qfundamental_mode); | 5419 | staticpro (&Qfundamental_mode); |
| 5436 | staticpro (&Qmode_class); | 5420 | staticpro (&Qmode_class); |
| 5437 | staticpro (&QSFundamental); | 5421 | staticpro (&QSFundamental); |