mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-16 16:50:21 +02:00
* struct.h: change scm_structs_to_free to scm_i_structs_to_free
* gc-malloc.c (scm_gc_register_collectable_memory): use floats; these won't ever wrap around with high memory usage. * gc-malloc.c: add DEBUGINFO for mtrigger GCs.
This commit is contained in:
parent
5bd4a949e8
commit
ffd724008b
7 changed files with 40 additions and 14 deletions
|
@ -1,5 +1,10 @@
|
||||||
2002-09-05 Han-Wen Nienhuys <hanwen@cs.uu.nl>
|
2002-09-05 Han-Wen Nienhuys <hanwen@cs.uu.nl>
|
||||||
|
|
||||||
|
* struct.h: change scm_structs_to_free to scm_i_structs_to_free
|
||||||
|
|
||||||
|
* gc-malloc.c (scm_gc_register_collectable_memory): use floats;
|
||||||
|
these won't ever wrap around with high memory usage.
|
||||||
|
|
||||||
* gc-freelist.c: include <stdio.h>
|
* gc-freelist.c: include <stdio.h>
|
||||||
|
|
||||||
* gc-malloc.c: add DEBUGINFO for mtrigger GCs.
|
* gc-malloc.c: add DEBUGINFO for mtrigger GCs.
|
||||||
|
|
|
@ -68,6 +68,11 @@
|
||||||
long int scm_i_deprecated_memory_return;
|
long int scm_i_deprecated_memory_return;
|
||||||
|
|
||||||
|
|
||||||
|
/* During collection, this accumulates structures which are to be freed.
|
||||||
|
*/
|
||||||
|
SCM scm_i_structs_to_free;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Init all the free cells in CARD, prepending to *FREE_LIST.
|
Init all the free cells in CARD, prepending to *FREE_LIST.
|
||||||
|
|
||||||
|
@ -109,8 +114,8 @@ scm_i_sweep_card (scm_t_cell * p, SCM *free_list, scm_t_heap_segment*seg)
|
||||||
/* Structs need to be freed in a special order.
|
/* Structs need to be freed in a special order.
|
||||||
* This is handled by GC C hooks in struct.c.
|
* This is handled by GC C hooks in struct.c.
|
||||||
*/
|
*/
|
||||||
SCM_SET_STRUCT_GC_CHAIN (p, scm_structs_to_free);
|
SCM_SET_STRUCT_GC_CHAIN (p, scm_i_structs_to_free);
|
||||||
scm_structs_to_free = scmptr;
|
scm_i_structs_to_free = scmptr;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -200,13 +200,15 @@ scm_gc_register_collectable_memory (void *mem, size_t size, const char *what)
|
||||||
*/
|
*/
|
||||||
if (scm_mallocated > scm_mtrigger)
|
if (scm_mallocated > scm_mtrigger)
|
||||||
{
|
{
|
||||||
long prev_alloced = scm_mallocated;
|
unsigned long prev_alloced = scm_mallocated;
|
||||||
float yield;
|
float yield;
|
||||||
|
|
||||||
scm_igc (what);
|
scm_igc (what);
|
||||||
scm_i_sweep_all_segments("mtrigger");
|
scm_i_sweep_all_segments("mtrigger");
|
||||||
|
|
||||||
yield = (prev_alloced - scm_mallocated) / (float) prev_alloced;
|
yield = ((float)prev_alloced - (float) scm_mallocated)
|
||||||
|
/ (float) prev_alloced;
|
||||||
|
|
||||||
scm_gc_malloc_yield_percentage = (int) (100 * yield);
|
scm_gc_malloc_yield_percentage = (int) (100 * yield);
|
||||||
|
|
||||||
#ifdef DEBUGINFO
|
#ifdef DEBUGINFO
|
||||||
|
|
|
@ -296,7 +296,7 @@ scm_i_insert_segment (scm_t_heap_segment * seg)
|
||||||
highest_cell = SCM_MAX (highest_cell, seg->bounds[1]);
|
highest_cell = SCM_MAX (highest_cell, seg->bounds[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int j = 0;
|
int j = 0;
|
||||||
|
@ -304,6 +304,17 @@ scm_i_insert_segment (scm_t_heap_segment * seg)
|
||||||
while (i < scm_i_heap_segment_table_size
|
while (i < scm_i_heap_segment_table_size
|
||||||
&& scm_i_heap_segment_table[i]->bounds[0] <= seg->bounds[0])
|
&& scm_i_heap_segment_table[i]->bounds[0] <= seg->bounds[0])
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
|
/*
|
||||||
|
We insert a new entry; if that happens to be before the
|
||||||
|
"current" segment of a freelist, we must move the freelist index
|
||||||
|
as well.
|
||||||
|
*/
|
||||||
|
if (scm_i_master_freelist.heap_segment_idx >= i)
|
||||||
|
scm_i_master_freelist.heap_segment_idx ++;
|
||||||
|
if (scm_i_master_freelist2.heap_segment_idx >= i)
|
||||||
|
scm_i_master_freelist2.heap_segment_idx ++;
|
||||||
|
|
||||||
for (j = scm_i_heap_segment_table_size; j > i; --j)
|
for (j = scm_i_heap_segment_table_size; j > i; --j)
|
||||||
scm_i_heap_segment_table[j] = scm_i_heap_segment_table[j - 1];
|
scm_i_heap_segment_table[j] = scm_i_heap_segment_table[j - 1];
|
||||||
|
|
||||||
|
|
|
@ -120,8 +120,6 @@ int scm_i_cell_validation_already_running ;
|
||||||
periods.
|
periods.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
scm_i_expensive_validation_check (SCM cell)
|
scm_i_expensive_validation_check (SCM cell)
|
||||||
{
|
{
|
||||||
|
@ -277,10 +275,6 @@ int scm_block_gc = 1;
|
||||||
*/
|
*/
|
||||||
SCM scm_weak_vectors;
|
SCM scm_weak_vectors;
|
||||||
|
|
||||||
/* During collection, this accumulates structures which are to be freed.
|
|
||||||
*/
|
|
||||||
SCM scm_structs_to_free;
|
|
||||||
|
|
||||||
/* GC Statistics Keeping
|
/* GC Statistics Keeping
|
||||||
*/
|
*/
|
||||||
unsigned long scm_cells_allocated = 0;
|
unsigned long scm_cells_allocated = 0;
|
||||||
|
@ -608,10 +602,19 @@ scm_igc (const char *what)
|
||||||
|
|
||||||
scm_gc_sweep ();
|
scm_gc_sweep ();
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
TODO: this hook should probably be moved to just before the mark,
|
||||||
|
since that's where the sweep is finished in lazy sweeping.
|
||||||
|
*/
|
||||||
scm_c_hook_run (&scm_after_sweep_c_hook, 0);
|
scm_c_hook_run (&scm_after_sweep_c_hook, 0);
|
||||||
gc_end_stats ();
|
gc_end_stats ();
|
||||||
|
|
||||||
SCM_CRITICAL_SECTION_END;
|
SCM_CRITICAL_SECTION_END;
|
||||||
|
|
||||||
|
/*
|
||||||
|
See above.
|
||||||
|
*/
|
||||||
scm_c_hook_run (&scm_after_gc_c_hook, 0);
|
scm_c_hook_run (&scm_after_gc_c_hook, 0);
|
||||||
--scm_gc_running_p;
|
--scm_gc_running_p;
|
||||||
|
|
||||||
|
|
|
@ -360,7 +360,7 @@ scm_struct_gc_init (void *dummy1 SCM_UNUSED,
|
||||||
void *dummy2 SCM_UNUSED,
|
void *dummy2 SCM_UNUSED,
|
||||||
void *dummy3 SCM_UNUSED)
|
void *dummy3 SCM_UNUSED)
|
||||||
{
|
{
|
||||||
scm_structs_to_free = SCM_EOL;
|
scm_i_structs_to_free = SCM_EOL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,7 +369,7 @@ scm_free_structs (void *dummy1 SCM_UNUSED,
|
||||||
void *dummy2 SCM_UNUSED,
|
void *dummy2 SCM_UNUSED,
|
||||||
void *dummy3 SCM_UNUSED)
|
void *dummy3 SCM_UNUSED)
|
||||||
{
|
{
|
||||||
SCM newchain = scm_structs_to_free;
|
SCM newchain = scm_i_structs_to_free;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
/* Mark vtables in GC chain. GC mark set means delay freeing. */
|
/* Mark vtables in GC chain. GC mark set means delay freeing. */
|
||||||
|
|
|
@ -103,7 +103,7 @@ SCM_API SCM scm_struct_table;
|
||||||
|
|
||||||
#define SCM_STRUCT_GC_CHAIN(X) SCM_CELL_OBJECT_3 (X)
|
#define SCM_STRUCT_GC_CHAIN(X) SCM_CELL_OBJECT_3 (X)
|
||||||
#define SCM_SET_STRUCT_GC_CHAIN(X, Y) SCM_SET_CELL_OBJECT_3 (X, Y)
|
#define SCM_SET_STRUCT_GC_CHAIN(X, Y) SCM_SET_CELL_OBJECT_3 (X, Y)
|
||||||
SCM_API SCM scm_structs_to_free;
|
SCM_API SCM scm_i_structs_to_free;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue