Merge branch 'master' into boehm-demers-weiser-gc
[bpt/guile.git] / libguile / private-gc.h
index 0e860b0..00bef9d 100644 (file)
 #define SCM_GC_IN_CARD_HEADERP(x) \
   (scm_t_cell *) (x) <  SCM_GC_CELL_CARD (x) + SCM_GC_CARD_N_HEADER_CELLS
 
-int scm_i_uint_bit_count (unsigned int u);
 int scm_getenv_int (const char *var, int def);
 
 
 typedef enum { return_on_error, abort_on_error } policy_on_error;
 
-/* gc-freelist */
-
-/*
-  FREELIST:
-
-  A struct holding GC statistics on a particular type of cells.
-
-  Counts in cells are mainly for heap statistics, and for
-  double-cells, they are still measured in single-cell units.
-*/
-typedef struct scm_t_cell_type_statistics {
-  /*
-    heap segment where the last cell was allocated 
-  */
-  int heap_segment_idx;
-
-  /* defines min_yield as fraction of total heap size
-   */
-  float min_yield_fraction;
-  
-  /* number of cells per object on this list */
-  int span;
-
-  /* number of collected cells during last GC. */
-  unsigned long collected;
-
-  unsigned long swept;
-  
-  /*
-    Total number of cells in heap segments belonging to this list.
-   */
-  unsigned long heap_total_cells;
-} scm_t_cell_type_statistics;
-
-
-/* Sweep statistics.  */
-typedef struct scm_sweep_statistics
-{
-  /* Number of cells "swept", i.e., visited during the sweep operation.  */
-  unsigned swept;
-
-  /* Number of cells collected during the sweep operation.  This number must
-     always be lower than or equal to SWEPT.  */
-  unsigned collected;
-} scm_t_sweep_statistics;
-
-SCM_INTERNAL scm_t_sweep_statistics scm_i_gc_sweep_stats;
-
-\f
-extern scm_t_cell_type_statistics scm_i_master_freelist;
-extern scm_t_cell_type_statistics scm_i_master_freelist2;
-
-SCM_INTERNAL
-void scm_i_adjust_min_yield (scm_t_cell_type_statistics *freelist,
-                            scm_t_sweep_statistics sweep_stats,
-                            scm_t_sweep_statistics sweep_stats_1);
-SCM_INTERNAL
-void scm_i_gc_sweep_freelist_reset (scm_t_cell_type_statistics *freelist);
-SCM_INTERNAL float
-scm_i_gc_heap_size_delta (scm_t_cell_type_statistics * freelist);
-
 
 #define SCM_MAX(A, B) ((A) > (B) ? (A) : (B))
 #define SCM_MIN(A, B) ((A) < (B) ? (A) : (B))
@@ -171,110 +109,8 @@ int scm_i_marking;
 
 void scm_mark_all (void);
 
-/*
-gc-segment:
-*/
-
-/*
-
- Cells are stored in a heap-segment: it is a contiguous chunk of
- memory, that associated with one freelist. 
-*/
-typedef struct scm_t_heap_segment
-{
-  /*
-    {lower, upper} bounds of the segment
-
-    The upper bound is also the start of the mark space.
-  */
-  scm_t_cell *bounds[2];
-
-  /*
-    If we ever decide to give it back, we could do it with this ptr.
-
-    Note that giving back memory is not very useful; as long we don't
-    touch a chunk of memory, the virtual memory system will keep it
-    swapped out. We could simply forget about a block.
-
-    (not that we do that, but anyway.) 
-   */
-  void *malloced;
-
-  scm_t_cell *next_free_card;
-  
-  /* address of the head-of-freelist pointer for this segment's cells.
-     All segments usually point to the same one, scm_i_freelist.  */
-  scm_t_cell_type_statistics *freelist;
-  
-  /* number of cells per object in this segment */
-  int span;
-
-  /*
-    Is this the first time that the cells are accessed? 
-   */
-  int first_time;
-} scm_t_heap_segment;
-
-/*
-  A table of segment records is kept that records the upper and
-  lower extents of the segment;  this is used during the conservative
-  phase of gc to identify probably gc roots (because they point
-  into valid segments at reasonable offsets).
-*/
-extern scm_t_heap_segment ** scm_i_heap_segment_table;
-extern size_t scm_i_heap_segment_table_size;
-
-
-SCM_INTERNAL int scm_i_init_card_freelist (scm_t_cell * card, SCM *free_list,
-                                          scm_t_heap_segment*);
-SCM_INTERNAL int scm_i_sweep_card (scm_t_cell *card, SCM *free_list,
-                                  scm_t_heap_segment *);
-SCM_INTERNAL int scm_i_card_marked_count (scm_t_cell *card, int span);
-SCM_INTERNAL void scm_i_card_statistics (scm_t_cell *p, SCM hashtab,
-                                        scm_t_heap_segment *seg);
-SCM_INTERNAL char const *scm_i_tag_name (scm_t_bits tag); /* MOVEME */
-
-SCM_INTERNAL int scm_i_initialize_heap_segment_data (scm_t_heap_segment *seg,
-                                                    size_t requested);
-
-SCM_INTERNAL int scm_i_segment_cells_per_card (scm_t_heap_segment *seg);
-SCM_INTERNAL int scm_i_segment_card_number (scm_t_heap_segment *seg,
-                                           scm_t_cell *card);
-SCM_INTERNAL int scm_i_segment_card_count (scm_t_heap_segment *seg);
-SCM_INTERNAL int scm_i_segment_cell_count (scm_t_heap_segment *seg);
-SCM_INTERNAL int scm_i_heap_segment_marked_count (scm_t_heap_segment *seg);
-  
-SCM_INTERNAL void scm_i_clear_segment_mark_space (scm_t_heap_segment *seg);
-SCM_INTERNAL scm_t_heap_segment *
-scm_i_make_empty_heap_segment (scm_t_cell_type_statistics*);
-SCM_INTERNAL SCM scm_i_sweep_for_freelist (scm_t_cell_type_statistics *seg);
-SCM_INTERNAL SCM scm_i_sweep_some_cards (scm_t_heap_segment *seg,
-                                        scm_t_sweep_statistics *sweep_stats,
-                                        int threshold);
-SCM_INTERNAL void scm_i_sweep_segment (scm_t_heap_segment *seg,
-                                      scm_t_sweep_statistics *sweep_stats);
-
-SCM_INTERNAL void scm_i_heap_segment_statistics (scm_t_heap_segment *seg,
-                                                SCM tab);
-
-
-SCM_INTERNAL int scm_i_insert_segment (scm_t_heap_segment *seg);
-SCM_INTERNAL int scm_i_find_heap_segment_containing_object (SCM obj);
-SCM_INTERNAL int scm_i_get_new_heap_segment (scm_t_cell_type_statistics *freelist,
-                                            size_t length, 
-                                            policy_on_error);
-SCM_INTERNAL int scm_i_marked_count (void);
-SCM_INTERNAL void scm_i_clear_mark_space (void);
-SCM_INTERNAL void scm_i_sweep_segments (void);
-SCM_INTERNAL SCM scm_i_sweep_some_segments (scm_t_cell_type_statistics *fl,
-                                           scm_t_sweep_statistics *sweep_stats);
-SCM_INTERNAL void scm_i_reset_segments (void);
-SCM_INTERNAL void scm_i_sweep_all_segments (char const *reason,
-                                           scm_t_sweep_statistics *sweep_stats);
-SCM_INTERNAL SCM scm_i_all_segments_statistics (SCM hashtab);
-SCM_INTERNAL unsigned long *scm_i_segment_table_info(int *size);
-
 extern long int scm_i_deprecated_memory_return;
+extern long int scm_i_find_heap_calls;
 
 /*
   global init funcs.