aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorKenichi Handa2012-09-06 10:49:15 +0900
committerKenichi Handa2012-09-06 10:49:15 +0900
commitfca81a8d405cd4c825e144099c54dd163636aa3b (patch)
treeee09be4b0e079b9c8863c8b570496a169227b218 /src/alloc.c
parentf41d6f9db69ce77fe9b3a637de407e8b589e0dc4 (diff)
parent067b39d4296765e83f9530eca456168f6cda95fc (diff)
downloademacs-fca81a8d405cd4c825e144099c54dd163636aa3b.tar.gz
emacs-fca81a8d405cd4c825e144099c54dd163636aa3b.zip
merge trunk
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c72
1 files changed, 48 insertions, 24 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 157d3a1d799..e90cca637df 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -4981,7 +4981,8 @@ valid_pointer_p (void *p)
4981#endif 4981#endif
4982} 4982}
4983 4983
4984/* Return 1 if OBJ is a valid lisp object. 4984/* Return 2 if OBJ is a killed or special buffer object.
4985 Return 1 if OBJ is a valid lisp object.
4985 Return 0 if OBJ is NOT a valid lisp object. 4986 Return 0 if OBJ is NOT a valid lisp object.
4986 Return -1 if we cannot validate OBJ. 4987 Return -1 if we cannot validate OBJ.
4987 This function can be quite slow, 4988 This function can be quite slow,
@@ -5002,6 +5003,9 @@ valid_lisp_object_p (Lisp_Object obj)
5002 if (PURE_POINTER_P (p)) 5003 if (PURE_POINTER_P (p))
5003 return 1; 5004 return 1;
5004 5005
5006 if (p == &buffer_defaults || p == &buffer_local_symbols)
5007 return 2;
5008
5005#if !GC_MARK_STACK 5009#if !GC_MARK_STACK
5006 return valid_pointer_p (p); 5010 return valid_pointer_p (p);
5007#else 5011#else
@@ -5027,7 +5031,7 @@ valid_lisp_object_p (Lisp_Object obj)
5027 return 0; 5031 return 0;
5028 5032
5029 case MEM_TYPE_BUFFER: 5033 case MEM_TYPE_BUFFER:
5030 return live_buffer_p (m, p); 5034 return live_buffer_p (m, p) ? 1 : 2;
5031 5035
5032 case MEM_TYPE_CONS: 5036 case MEM_TYPE_CONS:
5033 return live_cons_p (m, p); 5037 return live_cons_p (m, p);
@@ -5834,23 +5838,29 @@ mark_overlay (struct Lisp_Overlay *ptr)
5834static void 5838static void
5835mark_buffer (struct buffer *buffer) 5839mark_buffer (struct buffer *buffer)
5836{ 5840{
5837 /* This is handled much like other pseudovectors... */ 5841 if (NILP (BVAR (buffer, name)))
5838 mark_vectorlike ((struct Lisp_Vector *) buffer); 5842 /* If the buffer is killed, mark just the buffer itself. */
5843 VECTOR_MARK (buffer);
5844 else
5845 {
5846 /* This is handled much like other pseudovectors... */
5847 mark_vectorlike ((struct Lisp_Vector *) buffer);
5839 5848
5840 /* ...but there are some buffer-specific things. */ 5849 /* ...but there are some buffer-specific things. */
5841 5850
5842 MARK_INTERVAL_TREE (buffer_intervals (buffer)); 5851 MARK_INTERVAL_TREE (buffer_intervals (buffer));
5843 5852
5844 /* For now, we just don't mark the undo_list. It's done later in 5853 /* For now, we just don't mark the undo_list. It's done later in
5845 a special way just before the sweep phase, and after stripping 5854 a special way just before the sweep phase, and after stripping
5846 some of its elements that are not needed any more. */ 5855 some of its elements that are not needed any more. */
5847 5856
5848 mark_overlay (buffer->overlays_before); 5857 mark_overlay (buffer->overlays_before);
5849 mark_overlay (buffer->overlays_after); 5858 mark_overlay (buffer->overlays_after);
5850 5859
5851 /* If this is an indirect buffer, mark its base buffer. */ 5860 /* If this is an indirect buffer, mark its base buffer. */
5852 if (buffer->base_buffer && !VECTOR_MARKED_P (buffer->base_buffer)) 5861 if (buffer->base_buffer && !VECTOR_MARKED_P (buffer->base_buffer))
5853 mark_buffer (buffer->base_buffer); 5862 mark_buffer (buffer->base_buffer);
5863 }
5854} 5864}
5855 5865
5856/* Determine type of generic Lisp_Object and mark it accordingly. */ 5866/* Determine type of generic Lisp_Object and mark it accordingly. */
@@ -5993,24 +6003,38 @@ mark_object (Lisp_Object arg)
5993 6003
5994 case PVEC_FRAME: 6004 case PVEC_FRAME:
5995 { 6005 {
5996 mark_vectorlike (ptr); 6006 struct frame *f = (struct frame *) ptr;
5997 mark_face_cache (((struct frame *) ptr)->face_cache); 6007
6008 if (FRAME_LIVE_P (f))
6009 {
6010 mark_vectorlike (ptr);
6011 mark_face_cache (f->face_cache);
6012 }
6013 else
6014 /* If the frame is deleted, mark just the frame itself. */
6015 VECTOR_MARK (ptr);
5998 } 6016 }
5999 break; 6017 break;
6000 6018
6001 case PVEC_WINDOW: 6019 case PVEC_WINDOW:
6002 { 6020 {
6003 struct window *w = (struct window *) ptr; 6021 struct window *w = (struct window *) ptr;
6022 bool leaf = NILP (w->hchild) && NILP (w->vchild);
6004 6023
6005 mark_vectorlike (ptr); 6024 if (leaf && NILP (w->buffer))
6006 /* Mark glyphs for leaf windows. Marking window 6025 /* If the window is deleted, mark just the window itself. */
6007 matrices is sufficient because frame matrices 6026 VECTOR_MARK (ptr);
6008 use the same glyph memory. */ 6027 else
6009 if (NILP (w->hchild) && NILP (w->vchild)
6010 && w->current_matrix)
6011 { 6028 {
6012 mark_glyph_matrix (w->current_matrix); 6029 mark_vectorlike (ptr);
6013 mark_glyph_matrix (w->desired_matrix); 6030 /* Mark glyphs for leaf windows. Marking window
6031 matrices is sufficient because frame matrices
6032 use the same glyph memory. */
6033 if (leaf && w->current_matrix)
6034 {
6035 mark_glyph_matrix (w->current_matrix);
6036 mark_glyph_matrix (w->desired_matrix);
6037 }
6014 } 6038 }
6015 } 6039 }
6016 break; 6040 break;