mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
* gc.h, gc.c (SCM_FREECELL_P): Removed for good.
(scm_block_gc, scm_gc_heap_lock): Removed. Removed all uses. (scm_gc_running_p): Now a macro that refers to the scm_i_thread field. (scm_i_sweep_mutex): Now a non-recursive mutex. GC can not happen recursively. (scm_igc, scm_i_gc): Renamed former to latter. Changed all uses. Do not lock scm_i_sweep_mutex, which is now non-recursive, or set scm_gc_running_p. Do not run the scm_after_gc_c_hook. (scm_gc): Lock scm_i_sweep_mutex, set scm_gc_running_p and run the scm_after_gc_c_hook here. (scm_gc_for_new_cell): Set scm_gc_running_p here and run the scm_after_gc_c_hook when a full GC has in fact been performed. (scm_i_expensive_validation_check): Call scm_gc, not scm_i_gc. * gc-segment.c (scm_i_get_new_heap_segment): Do not check scm_gc_heap_lock. * gc-malloc.c (scm_realloc, increase_mtrigger): Set scm_gc_running_p while the scm_i_sweep_mutex is locked.
This commit is contained in:
parent
94d375b5a7
commit
b17e0ac397
4 changed files with 85 additions and 107 deletions
|
@ -111,19 +111,22 @@ scm_realloc (void *mem, size_t size)
|
|||
return ptr;
|
||||
|
||||
scm_i_scm_pthread_mutex_lock (&scm_i_sweep_mutex);
|
||||
|
||||
scm_gc_running_p = 1;
|
||||
|
||||
scm_i_sweep_all_segments ("realloc");
|
||||
|
||||
SCM_SYSCALL (ptr = realloc (mem, size));
|
||||
if (ptr)
|
||||
{
|
||||
scm_gc_running_p = 0;
|
||||
scm_i_pthread_mutex_unlock (&scm_i_sweep_mutex);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
scm_igc ("realloc");
|
||||
scm_i_gc ("realloc");
|
||||
scm_i_sweep_all_segments ("realloc");
|
||||
|
||||
scm_gc_running_p = 0;
|
||||
scm_i_pthread_mutex_unlock (&scm_i_sweep_mutex);
|
||||
|
||||
SCM_SYSCALL (ptr = realloc (mem, size));
|
||||
|
@ -219,9 +222,10 @@ increase_mtrigger (size_t size, const char *what)
|
|||
float yield;
|
||||
|
||||
scm_i_scm_pthread_mutex_lock (&scm_i_sweep_mutex);
|
||||
scm_gc_running_p = 1;
|
||||
|
||||
prev_alloced = mallocated;
|
||||
scm_igc (what);
|
||||
scm_i_gc (what);
|
||||
scm_i_sweep_all_segments ("mtrigger");
|
||||
|
||||
yield = (((float) prev_alloced - (float) scm_mallocated)
|
||||
|
@ -262,7 +266,8 @@ increase_mtrigger (size_t size, const char *what)
|
|||
scm_mtrigger);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
scm_gc_running_p = 0;
|
||||
scm_i_pthread_mutex_unlock (&scm_i_sweep_mutex);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue