diff --git a/THANKS b/THANKS index 0c90ca398..6e9ad2a04 100644 --- a/THANKS +++ b/THANKS @@ -12,3 +12,4 @@ For fixes or providing information which led to a fix: Martin Baulig Rob Browning + Christopher Cramer diff --git a/libguile/ChangeLog b/libguile/ChangeLog index d78fd3fe7..b1eec946a 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,9 +1,26 @@ +2001-09-17 Dirk Herrmann + + The following patch partially undoes my patch from 2001-06-30, + where I added the function scm_gc_mark_cell_conservatively. The + function is buggy, since it breaks guile during conservative + marking if a pointer on the stack points directly into the list of + free cells on the heap: With conservative cell marking this will + cause the whole free list to be scanned and marked - boom! + + * gc.c (allocated_mark, MARK, heap_segment, + scm_gc_mark_cell_conservatively, scm_init_storage), gc.h + (scm_gc_mark_cell_conservatively): Remove function + scm_gc_mark_cell_conservatively and update the corresponding + comments and uses accordingly. Thanks to Christopher Cramer for + the patch. (Minor corrections by me.) + 2001-09-15 Gary Houston * root.h (scm_root_state): removed the continuation_stack and continuation_stack_ptr members, which have no apparent purpose. (scm_continuation_stack, scm_continuation_stack_ptr): #defines removed. + * root.c (root_mark), init.c (restart_stack, start_stack), gc (scm_igc): remove all references to contination_stack and continuation_stack_ptr, avoiding allocation of a vector and diff --git a/libguile/gc.c b/libguile/gc.c index f10e33350..3a2aeba22 100644 --- a/libguile/gc.c +++ b/libguile/gc.c @@ -114,19 +114,6 @@ unsigned int scm_debug_cell_accesses_p = 1; 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 @@ -1419,23 +1406,6 @@ gc_mark_loop_first_time: /* 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: @@ -1484,9 +1454,8 @@ gc_mark_loop_first_time: * 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) { @@ -1549,27 +1518,6 @@ heap_segment (SCM obj) } -/* 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) @@ -2737,7 +2685,6 @@ scm_init_storage () #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; diff --git a/libguile/gc.h b/libguile/gc.h index 3b0efff1e..ac0d5c923 100644 --- a/libguile/gc.h +++ b/libguile/gc.h @@ -362,7 +362,6 @@ extern void scm_alloc_cluster (struct scm_t_freelist *master); extern void scm_igc (const char *what); extern void scm_gc_mark (SCM p); extern void scm_gc_mark_dependencies (SCM p); -extern void scm_gc_mark_cell_conservatively (SCM cell); extern void scm_mark_locations (SCM_STACKITEM x[], unsigned long n); extern int scm_cellp (SCM value); extern void scm_gc_sweep (void);