Changes from arch/CVS synchronization
[bpt/guile.git] / libguile / private-gc.h
index 7cb1fbf..7c0fd88 100644 (file)
@@ -144,14 +144,13 @@ typedef struct scm_sweep_statistics
    }                                                   \
   while (0)
 
-
 \f
 extern scm_t_cell_type_statistics scm_i_master_freelist;
 extern scm_t_cell_type_statistics scm_i_master_freelist2;
-extern unsigned long scm_gc_cells_collected_1;
 
 void scm_i_adjust_min_yield (scm_t_cell_type_statistics *freelist,
-                            scm_t_sweep_statistics sweep_stats);
+                            scm_t_sweep_statistics sweep_stats,
+                            scm_t_sweep_statistics sweep_stats_1);
 void scm_i_gc_sweep_freelist_reset (scm_t_cell_type_statistics *freelist);
 int scm_i_gc_grow_heap_p (scm_t_cell_type_statistics * freelist);
 
@@ -163,7 +162,17 @@ int scm_i_gc_grow_heap_p (scm_t_cell_type_statistics * freelist);
 #define SCM_MAX(A, B) ((A) > (B) ? (A) : (B))
 #define SCM_MIN(A, B) ((A) < (B) ? (A) : (B))
 
-#define CELL_P(x)  (SCM_ITAG3 (x) == scm_tc3_cons)
+/* CELL_P checks a random word whether it has the right form for a
+   pointer to a cell.  Use scm_i_find_heap_segment_containing_object
+   to find out whether it actually points to a real cell.
+
+   The right form for a cell pointer is this: the low three bits must
+   be scm_tc3_cons, and when the scm_tc3_cons tag is stripped, the
+   resulting pointer must be correctly aligned.
+   scm_i_initialize_heap_segment_data guarantees that the test below
+   works.
+*/
+#define CELL_P(x)  ((SCM_UNPACK(x) & (sizeof(scm_t_cell)-1)) == scm_tc3_cons)
 
 /*
   gc-mark
@@ -260,7 +269,9 @@ void scm_i_heap_segment_statistics (scm_t_heap_segment *seg, SCM tab);
      
 int scm_i_insert_segment (scm_t_heap_segment * seg);
 long int scm_i_find_heap_segment_containing_object (SCM obj);
-int scm_i_get_new_heap_segment (scm_t_cell_type_statistics *, policy_on_error);
+int scm_i_get_new_heap_segment (scm_t_cell_type_statistics *,
+                               scm_t_sweep_statistics,
+                               policy_on_error);
 void scm_i_clear_mark_space (void);
 void scm_i_sweep_segments (void);
 SCM scm_i_sweep_some_segments (scm_t_cell_type_statistics *fl,