emacs-diffs
[Top][All Lists]
Advanced

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

scratch/comp-static-data a6f3188ba1 6/9: Separate marking native comp un


From: Vibhav Pant
Subject: scratch/comp-static-data a6f3188ba1 6/9: Separate marking native comp units into their own function.
Date: Tue, 20 Dec 2022 11:29:41 -0500 (EST)

branch: scratch/comp-static-data
commit a6f3188ba18bd88eeed613a02d7a6f0204263d9d
Author: Vibhav Pant <vibhavp@gmail.com>
Commit: Vibhav Pant <vibhavp@gmail.com>

    Separate marking native comp units into their own function.
    
    * src/alloc.c (mark_native_comp_unit): New function.
    (process_mark_stack): Use it.
---
 src/alloc.c | 60 ++++++++++++++++++++++++++++--------------------------------
 1 file changed, 28 insertions(+), 32 deletions(-)

diff --git a/src/alloc.c b/src/alloc.c
index 3a2ff64b19..0a8c182661 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -6575,6 +6575,33 @@ mark_char_table (struct Lisp_Vector *ptr, enum pvec_type 
pvectype)
     }
 }
 
+static void
+mark_native_comp_unit (struct Lisp_Native_Comp_Unit *comp_u)
+{
+  mark_vectorlike (&comp_u->header);
+
+#ifdef HAVE_STATIC_LISP_GLOBALS
+  if (comp_u->have_static_lisp_data)
+    {
+      eassert (NILP (comp_u->lambda_gc_guard_h));
+      eassert (NILP (comp_u->lambda_c_name_idx_h));
+      eassert (NILP (comp_u->data_vec));
+      eassert (NILP (comp_u->data_impure_vec));
+      eassert (comp_u->data_imp_relocs == NULL);
+
+      Lisp_Object u_staticvec = comp_u->staticpro;
+      if (!NILP (u_staticvec))
+       mark_objects (XVECTOR (u_staticvec)->contents,
+                     ASIZE (u_staticvec));
+
+      Lisp_Object u_ephemeral = comp_u->ephemeral;
+      if (!NILP (u_ephemeral))
+       mark_objects (XVECTOR (u_ephemeral)->contents,
+                     ASIZE (u_ephemeral));
+    }
+#endif
+}
+
 /* Mark the chain of overlays starting at PTR.  */
 
 static void
@@ -7015,40 +7042,9 @@ process_mark_stack (ptrdiff_t base_sp)
 #endif
                break;
 
-#ifdef HAVE_STATIC_LISP_GLOBALS
              case PVEC_NATIVE_COMP_UNIT:
-               {
-                 ptrdiff_t size = ptr->header.size;
-                 eassert (size & PSEUDOVECTOR_FLAG);
-                 set_vector_marked (ptr);
-                 mark_stack_push_values (ptr->contents,
-                                         size
-                                           & PSEUDOVECTOR_SIZE_MASK);
-                 struct Lisp_Native_Comp_Unit *comp_u
-                   = XNATIVE_COMP_UNIT (obj);
-                 if (comp_u->have_static_lisp_data)
-                   {
-                     eassert (NILP (comp_u->lambda_gc_guard_h)
-                              && NILP (comp_u->lambda_c_name_idx_h)
-                              && NILP (comp_u->data_vec)
-                              && NILP (comp_u->data_impure_vec)
-                              && comp_u->data_imp_relocs == NULL);
-
-                     Lisp_Object staticpro = comp_u->staticpro;
-                     if (!NILP (staticpro))
-                       mark_stack_push_values
-                         (XVECTOR (staticpro)->contents,
-                          ASIZE (staticpro));
-
-                     Lisp_Object ephemeral = comp_u->ephemeral;
-                     if (!NILP (ephemeral))
-                       mark_stack_push_values
-                         (XVECTOR (ephemeral)->contents,
-                          ASIZE (ephemeral));
-                   }
-               }
+               mark_native_comp_unit (XNATIVE_COMP_UNIT (obj));
                break;
-#endif
 
              case PVEC_FREE:
                emacs_abort ();



reply via email to

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