aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c54
1 files changed, 32 insertions, 22 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 98a35853e02..a7446e6b708 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -6068,6 +6068,30 @@ mark_localized_symbol (struct Lisp_Symbol *ptr)
6068 mark_object (blv->defcell); 6068 mark_object (blv->defcell);
6069} 6069}
6070 6070
6071NO_INLINE /* To reduce stack depth in mark_object. */
6072static void
6073mark_save_value (struct Lisp_Save_Value *ptr)
6074{
6075 /* If `save_type' is zero, `data[0].pointer' is the address
6076 of a memory area containing `data[1].integer' potential
6077 Lisp_Objects. */
6078 if (GC_MARK_STACK && ptr->save_type == SAVE_TYPE_MEMORY)
6079 {
6080 Lisp_Object *p = ptr->data[0].pointer;
6081 ptrdiff_t nelt;
6082 for (nelt = ptr->data[1].integer; nelt > 0; nelt--, p++)
6083 mark_maybe_object (*p);
6084 }
6085 else
6086 {
6087 /* Find Lisp_Objects in `data[N]' slots and mark them. */
6088 int i;
6089 for (i = 0; i < SAVE_VALUE_SLOTS; i++)
6090 if (save_type (ptr, i) == SAVE_OBJECT)
6091 mark_object (ptr->data[i].object);
6092 }
6093}
6094
6071/* Remove killed buffers or items whose car is a killed buffer from 6095/* Remove killed buffers or items whose car is a killed buffer from
6072 LIST, and mark other items. Return changed LIST, which is marked. */ 6096 LIST, and mark other items. Return changed LIST, which is marked. */
6073 6097
@@ -6095,7 +6119,13 @@ mark_discard_killed_buffers (Lisp_Object list)
6095 return list; 6119 return list;
6096} 6120}
6097 6121
6098/* Determine type of generic Lisp_Object and mark it accordingly. */ 6122/* Determine type of generic Lisp_Object and mark it accordingly.
6123
6124 This function implements a straightforward depth-first marking
6125 algorithm and so the recursion depth may be very high (a few
6126 tens of thousands is not uncommon). To minimize stack usage,
6127 a few cold paths are moved out to NO_INLINE functions above.
6128 In general, inlining them doesn't help you to gain more speed. */
6099 6129
6100void 6130void
6101mark_object (Lisp_Object arg) 6131mark_object (Lisp_Object arg)
@@ -6363,27 +6393,7 @@ mark_object (Lisp_Object arg)
6363 6393
6364 case Lisp_Misc_Save_Value: 6394 case Lisp_Misc_Save_Value:
6365 XMISCANY (obj)->gcmarkbit = 1; 6395 XMISCANY (obj)->gcmarkbit = 1;
6366 { 6396 mark_save_value (XSAVE_VALUE (obj));
6367 struct Lisp_Save_Value *ptr = XSAVE_VALUE (obj);
6368 /* If `save_type' is zero, `data[0].pointer' is the address
6369 of a memory area containing `data[1].integer' potential
6370 Lisp_Objects. */
6371 if (GC_MARK_STACK && ptr->save_type == SAVE_TYPE_MEMORY)
6372 {
6373 Lisp_Object *p = ptr->data[0].pointer;
6374 ptrdiff_t nelt;
6375 for (nelt = ptr->data[1].integer; nelt > 0; nelt--, p++)
6376 mark_maybe_object (*p);
6377 }
6378 else
6379 {
6380 /* Find Lisp_Objects in `data[N]' slots and mark them. */
6381 int i;
6382 for (i = 0; i < SAVE_VALUE_SLOTS; i++)
6383 if (save_type (ptr, i) == SAVE_OBJECT)
6384 mark_object (ptr->data[i].object);
6385 }
6386 }
6387 break; 6397 break;
6388 6398
6389 case Lisp_Misc_Overlay: 6399 case Lisp_Misc_Overlay: