guile-devel
[Top][All Lists]
Advanced

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

removing scm_gc_mark_conservatively()


From: Chris Cramer
Subject: removing scm_gc_mark_conservatively()
Date: Sun, 16 Sep 2001 13:05:52 -0500
User-agent: Mutt/1.2.5i

This patch (for stable) removes scm_gc_mark_conservatively().
It fixes all the segfault problems I've been having.

Index: libguile/gc.c
===================================================================
RCS file: /cvsroot/guile/guile/guile-core/libguile/gc.c,v
retrieving revision 1.208.2.3
diff -u -r1.208.2.3 gc.c
--- libguile/gc.c       2001/08/26 21:49:32     1.208.2.3
+++ libguile/gc.c       2001/09/16 05:14:58
@@ -100,8 +100,6 @@
 
 #if (SCM_DEBUG_CELL_ACCESSES == 1)
 
-scm_t_bits scm_tc16_allocated;
-
 /* Set this to != 0 if every cell that is accessed shall be checked:
  */
 unsigned int scm_debug_cell_accesses_p = 1;
@@ -111,20 +109,6 @@
  */
 static unsigned int debug_cells_gc_interval = 0;
 
-
-/* If an allocated cell is detected during garbage collection, this means that
- * some code has just obtained the object but was preempted before the
- * initialization of the object was completed.  This meanst that some entries
- * of the allocated cell may already contain SCM objects.  Therefore,
- * allocated cells are scanned conservatively.  */
-static SCM
-allocated_mark (SCM allocated)
-{
-  scm_gc_mark_cell_conservatively (allocated);
-  return SCM_BOOL_F;
-}
-
-
 /* Assert that the given object is a valid reference to a valid cell.  This
  * test involves to determine whether the object is a cell pointer, whether
  * this pointer actually points into a heap segment and whether the cell
@@ -1458,23 +1442,6 @@
          /* We have detected a free cell.  This can happen if non-object data
           * on the C stack points into guile's heap and is scanned during
           * conservative marking.  */
-#if (SCM_DEBUG_CELL_ACCESSES == 0)
-         /* If cell debugging is disabled, there is a second situation in
-          * which a free cell can be encountered, namely if with preemptive
-          * threading one thread has just obtained a fresh cell and was
-          * preempted before the cell initialization was completed.  In this
-          * case, some entries of the cell may already contain objects.
-          * Thus, if cell debugging is disabled, free cells are scanned
-          * conservatively.  */
-         scm_gc_mark_cell_conservatively (ptr);
-#else /* SCM_DEBUG_CELL_ACCESSES == 1 */
-         /* With cell debugging enabled, a freshly obtained but not fully
-          * initialized cell is guaranteed to be of type scm_tc16_allocated.
-          * Thus, no conservative scanning for free cells is necessary, but
-          * instead cells of type scm_tc16_allocated have to be scanned
-          * conservatively.  This is done in the mark function of the
-          * scm_tc16_allocated smob type.  */
-#endif
          break;
        case scm_tc16_big:
        case scm_tc16_real:
@@ -1523,9 +1490,8 @@
  * heap segment.  If this is the case, the number of the heap segment is
  * returned.  Otherwise, -1 is returned.  Binary search is used in order to
  * determine the heap segment that contains the cell.*/
-/* FIXME:  To be used within scm_gc_mark_cell_conservatively,
- * scm_mark_locations and scm_cellp this function should be an inline
- * function.  */
+/* FIXME:  To be used within scm_mark_locations and scm_cellp this function
+ * should be an inline function.  */
 static long int
 heap_segment (SCM obj)
 {
@@ -1588,27 +1554,6 @@
 }
 
 
-/* Mark the entries of a cell conservatively.  The given cell is known to be
- * on the heap.  Still we have to determine its heap segment in order to
- * figure out whether it is a single or a double cell.  Then, each of the cell
- * elements itself is checked and potentially marked. */
-void
-scm_gc_mark_cell_conservatively (SCM cell)
-{
-  unsigned long int cell_segment = heap_segment (cell);
-  unsigned int span = scm_heap_table[cell_segment].span;
-  unsigned int i;
-
-  for (i = 1; i != span * 2; ++i)
-    {
-      SCM obj = SCM_CELL_OBJECT (cell, i);
-      long int obj_segment = heap_segment (obj);
-      if (obj_segment >= 0)
-       scm_gc_mark (obj);
-    }
-}
-
-
 /* Mark a region conservatively */
 void
 scm_mark_locations (SCM_STACKITEM x[], unsigned long n)
@@ -2807,11 +2752,6 @@
   size_t init_heap_size_1;
   size_t init_heap_size_2;
   size_t j;
-
-#if (SCM_DEBUG_CELL_ACCESSES == 1)
-  scm_tc16_allocated = scm_make_smob_type ("allocated cell", 0);
-  scm_set_smob_mark (scm_tc16_allocated, allocated_mark);
-#endif  /* SCM_DEBUG_CELL_ACCESSES == 1 */
 
   j = SCM_NUM_PROTECTS;
   while (j)

-- 
C. Ray C. aka Christopher Cramer
address@hidden
http://www.pyro.net/~crayc/



reply via email to

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