mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-22 11:34:09 +02:00
Remove deprecated variables/macros from the GC headers.
* libguile/deprecated.c (scm_mtrigger, scm_mallocated, scm_max_segment_size): New global variables, from gc.c. (scm_map_free_list, scm_gc_set_debug_check_freelist_x)[GUILE_DEBUG_FREELIST]: New stubs. * libguile/deprecated.h (scm_mallocated, scm_mtrigger, scm_max_segment_size): New declarations. (scm_map_free_list, scm_gc_set_debug_check_freelist_x)[GUILE_DEBUG_FREELIST]: New declarations. * libguile/gc-malloc.c (scm_i_minyield_malloc): Remove. (scm_gc_init_malloc): Remove references to `scm_i_minyield_malloc' and `scm_mtrigger'. * libguile/gc.c (scm_mtrigger, scm_mallocated): Remove. (scm_init_storage): Remove reference to `SCM_HEAP_SEG_SIZE'. * libguile/gc.h (scm_max_segment_size, SCM_SET_FREELIST_LOC, SCM_FREELIST_LOC, scm_i_master_freelist, scm_i_master_freelist2, scm_mallocated, scm_mtrigger): Remove. (scm_map_free_list, scm_gc_set_debug_check_freelist_x)[SCM_ENABLE_DEPRECATED && GUILE_DEBUG_FREELIST]: Remove. * libguile/private-gc.h (SCM_DEFAULT_INIT_HEAP_SIZE_1, SCM_DEFAULT_MIN_YIELD_1, SCM_DEFAULT_MIN_YIELD_2, DEFAULT_SWEEP_AMOUNT, SCM_DEFAULT_MAX_SEGMENT_SIZE, SCM_MIN_HEAP_SEG_SIZE, SCM_HEAP_SEG_SIZE, SCM_GC_CARD_BVEC_SIZE_IN_LONGS, SCM_GC_IN_CARD_HEADERP): Remove. (scm_getenv_int): Made internal. (scm_i_marking, scm_mark_all, scm_i_deprecated_memory_return, scm_i_find_heap_calls, scm_gc_init_malloc, scm_gc_init_freelist, scm_gc_init_segments, scm_gc_init_mark): Remove declarations. * libguile/gc-segment-table.c: Remove, finally.
This commit is contained in:
parent
7af531508c
commit
760fb97d1f
7 changed files with 46 additions and 417 deletions
|
@ -2,7 +2,7 @@
|
||||||
deprecate something, move it here when that is feasible.
|
deprecate something, move it here when that is feasible.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Copyright (C) 2003, 2004, 2006, 2008 Free Software Foundation, Inc.
|
/* Copyright (C) 2003, 2004, 2006, 2008, 2009 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
@ -1503,6 +1503,29 @@ SCM_DEFINE (scm_destroy_guardian_x, "destroy-guardian!", 1, 0, 0,
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
|
||||||
|
|
||||||
|
/* GC-related things. */
|
||||||
|
|
||||||
|
unsigned long scm_mallocated, scm_mtrigger;
|
||||||
|
size_t scm_max_segment_size;
|
||||||
|
|
||||||
|
#if defined (GUILE_DEBUG) || defined (GUILE_DEBUG_FREELIST)
|
||||||
|
SCM
|
||||||
|
scm_map_free_list (void)
|
||||||
|
{
|
||||||
|
return SCM_EOL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (GUILE_DEBUG_FREELIST)
|
||||||
|
SCM
|
||||||
|
scm_gc_set_debug_check_freelist_x (SCM flag)
|
||||||
|
{
|
||||||
|
return SCM_UNSPECIFIED;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
scm_i_init_deprecated ()
|
scm_i_init_deprecated ()
|
||||||
{
|
{
|
||||||
|
|
|
@ -583,6 +583,25 @@ SCM_API SCM scm_destroy_guardian_x (SCM guardian);
|
||||||
SCM_API SCM scm_guardian_greedy_p (SCM guardian);
|
SCM_API SCM scm_guardian_greedy_p (SCM guardian);
|
||||||
SCM_API SCM scm_guardian_destroyed_p (SCM guardian);
|
SCM_API SCM scm_guardian_destroyed_p (SCM guardian);
|
||||||
|
|
||||||
|
|
||||||
|
/* GC-related things deprecated with the move to BDW-GC starting from 1.9.3
|
||||||
|
(2009-09-15). */
|
||||||
|
|
||||||
|
SCM_API unsigned long scm_mallocated;
|
||||||
|
SCM_API unsigned long scm_mtrigger;
|
||||||
|
|
||||||
|
SCM_API size_t scm_max_segment_size;
|
||||||
|
|
||||||
|
#if defined (GUILE_DEBUG) || defined (GUILE_DEBUG_FREELIST)
|
||||||
|
SCM_API SCM scm_map_free_list (void);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (GUILE_DEBUG_FREELIST)
|
||||||
|
SCM_API SCM scm_gc_set_debug_check_freelist_x (SCM flag);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void scm_i_init_deprecated (void);
|
void scm_i_init_deprecated (void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -78,27 +78,6 @@ extern unsigned long * __libc_ia64_register_backing_store_base;
|
||||||
|
|
||||||
/* #define DEBUGINFO */
|
/* #define DEBUGINFO */
|
||||||
|
|
||||||
static int scm_i_minyield_malloc;
|
|
||||||
|
|
||||||
void
|
|
||||||
scm_gc_init_malloc (void)
|
|
||||||
{
|
|
||||||
int mtrigger = scm_getenv_int ("GUILE_INIT_MALLOC_LIMIT",
|
|
||||||
SCM_DEFAULT_INIT_MALLOC_LIMIT);
|
|
||||||
scm_i_minyield_malloc = scm_getenv_int ("GUILE_MIN_YIELD_MALLOC",
|
|
||||||
SCM_DEFAULT_MALLOC_MINYIELD);
|
|
||||||
|
|
||||||
if (scm_i_minyield_malloc >= 100)
|
|
||||||
scm_i_minyield_malloc = 99;
|
|
||||||
if (scm_i_minyield_malloc < 1)
|
|
||||||
scm_i_minyield_malloc = 1;
|
|
||||||
|
|
||||||
if (mtrigger < 0)
|
|
||||||
scm_mtrigger = SCM_DEFAULT_INIT_MALLOC_LIMIT;
|
|
||||||
else
|
|
||||||
scm_mtrigger = mtrigger;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Function for non-cell memory management.
|
/* Function for non-cell memory management.
|
||||||
|
|
|
@ -1,300 +0,0 @@
|
||||||
/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2006, 2008 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 3 of
|
|
||||||
* the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
||||||
* 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
# include <config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "libguile/_scm.h"
|
|
||||||
#include "libguile/pairs.h"
|
|
||||||
#include "libguile/gc.h"
|
|
||||||
#include "libguile/private-gc.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
Heap segment table.
|
|
||||||
|
|
||||||
The table is sorted by the address of the data itself. This makes
|
|
||||||
for easy lookups. This is not portable: according to ANSI C,
|
|
||||||
pointers can only be compared within the same object (i.e. the same
|
|
||||||
block of malloced memory.). For machines with weird architectures,
|
|
||||||
this should be revised.
|
|
||||||
|
|
||||||
(Apparently, for this reason 1.6 and earlier had macros for pointer
|
|
||||||
comparison. )
|
|
||||||
|
|
||||||
perhaps it is worthwhile to remove the 2nd level of indirection in
|
|
||||||
the table, but this certainly makes for cleaner code.
|
|
||||||
*/
|
|
||||||
scm_t_heap_segment **scm_i_heap_segment_table;
|
|
||||||
size_t scm_i_heap_segment_table_size;
|
|
||||||
static scm_t_cell *lowest_cell;
|
|
||||||
static scm_t_cell *highest_cell;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
RETURN: index of inserted segment.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
scm_i_insert_segment (scm_t_heap_segment *seg)
|
|
||||||
{
|
|
||||||
size_t size = (scm_i_heap_segment_table_size + 1) * sizeof (scm_t_heap_segment *);
|
|
||||||
SCM_SYSCALL (scm_i_heap_segment_table
|
|
||||||
= ((scm_t_heap_segment **)
|
|
||||||
realloc ((char *)scm_i_heap_segment_table, size)));
|
|
||||||
|
|
||||||
/*
|
|
||||||
We can't alloc 4 more bytes. This is hopeless.
|
|
||||||
*/
|
|
||||||
if (!scm_i_heap_segment_table)
|
|
||||||
{
|
|
||||||
fprintf (stderr, "scm_i_get_new_heap_segment: Could not grow heap segment table.\n");
|
|
||||||
abort ();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!lowest_cell)
|
|
||||||
{
|
|
||||||
lowest_cell = seg->bounds[0];
|
|
||||||
highest_cell = seg->bounds[1];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
lowest_cell = SCM_MIN (lowest_cell, seg->bounds[0]);
|
|
||||||
highest_cell = SCM_MAX (highest_cell, seg->bounds[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
int j = 0;
|
|
||||||
|
|
||||||
while (i < scm_i_heap_segment_table_size
|
|
||||||
&& scm_i_heap_segment_table[i]->bounds[0] <= seg->bounds[0])
|
|
||||||
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)
|
|
||||||
scm_i_heap_segment_table[j] = scm_i_heap_segment_table[j - 1];
|
|
||||||
|
|
||||||
scm_i_heap_segment_table[i] = seg;
|
|
||||||
scm_i_heap_segment_table_size ++;
|
|
||||||
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
Determine whether the given value does actually represent a cell in
|
|
||||||
some heap segment. If this is the case, the number of the heap
|
|
||||||
segment is returned. Otherwise, -1 is returned. Binary search is
|
|
||||||
used to determine the heap segment that contains the cell.
|
|
||||||
|
|
||||||
I think this function is too long to be inlined. --hwn
|
|
||||||
*/
|
|
||||||
|
|
||||||
int
|
|
||||||
scm_i_find_heap_segment_containing_object (SCM obj)
|
|
||||||
{
|
|
||||||
if (!CELL_P (obj))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
scm_i_find_heap_calls ++;
|
|
||||||
if ((scm_t_cell *) obj < lowest_cell || (scm_t_cell *) obj >= highest_cell)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
{
|
|
||||||
scm_t_cell *ptr = SCM2PTR (obj);
|
|
||||||
unsigned int i = 0;
|
|
||||||
unsigned int j = scm_i_heap_segment_table_size - 1;
|
|
||||||
|
|
||||||
if (ptr < scm_i_heap_segment_table[i]->bounds[0])
|
|
||||||
return -1;
|
|
||||||
else if (scm_i_heap_segment_table[j]->bounds[1] <= ptr)
|
|
||||||
return -1;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
while (i < j)
|
|
||||||
{
|
|
||||||
if (ptr < scm_i_heap_segment_table[i]->bounds[1])
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if (scm_i_heap_segment_table[j]->bounds[0] <= ptr)
|
|
||||||
{
|
|
||||||
i = j;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
unsigned long int k = (i + j) / 2;
|
|
||||||
|
|
||||||
if (k == i)
|
|
||||||
return -1;
|
|
||||||
else if (ptr < scm_i_heap_segment_table[k]->bounds[1])
|
|
||||||
{
|
|
||||||
j = k;
|
|
||||||
++i;
|
|
||||||
if (ptr < scm_i_heap_segment_table[i]->bounds[0])
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else if (scm_i_heap_segment_table[k]->bounds[0] <= ptr)
|
|
||||||
{
|
|
||||||
i = k;
|
|
||||||
--j;
|
|
||||||
if (scm_i_heap_segment_table[j]->bounds[1] <= ptr)
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!SCM_DOUBLECELL_ALIGNED_P (obj) && scm_i_heap_segment_table[i]->span == 2)
|
|
||||||
return -1;
|
|
||||||
else if (SCM_GC_IN_CARD_HEADERP (ptr))
|
|
||||||
return -1;
|
|
||||||
else
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
scm_i_marked_count (void)
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
int c = 0;
|
|
||||||
for (; i < scm_i_heap_segment_table_size; i++)
|
|
||||||
{
|
|
||||||
c += scm_i_heap_segment_marked_count (scm_i_heap_segment_table[i]);
|
|
||||||
}
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
SCM
|
|
||||||
scm_i_sweep_some_segments (scm_t_cell_type_statistics *freelist,
|
|
||||||
scm_t_sweep_statistics *sweep_stats)
|
|
||||||
{
|
|
||||||
int i = freelist->heap_segment_idx;
|
|
||||||
SCM collected = SCM_EOL;
|
|
||||||
|
|
||||||
if (i == -1) /* huh? --hwn */
|
|
||||||
i++;
|
|
||||||
|
|
||||||
for (;
|
|
||||||
i < scm_i_heap_segment_table_size; i++)
|
|
||||||
{
|
|
||||||
if (scm_i_heap_segment_table[i]->freelist != freelist)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
collected = scm_i_sweep_some_cards (scm_i_heap_segment_table[i],
|
|
||||||
sweep_stats,
|
|
||||||
DEFAULT_SWEEP_AMOUNT);
|
|
||||||
|
|
||||||
if (collected != SCM_EOL) /* Don't increment i */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
freelist->heap_segment_idx = i;
|
|
||||||
|
|
||||||
return collected;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
scm_i_reset_segments (void)
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
for (; i < scm_i_heap_segment_table_size; i++)
|
|
||||||
{
|
|
||||||
scm_t_heap_segment *seg = scm_i_heap_segment_table[i];
|
|
||||||
seg->next_free_card = seg->bounds[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
Return a hashtab with counts of live objects, with tags as keys.
|
|
||||||
*/
|
|
||||||
SCM
|
|
||||||
scm_i_all_segments_statistics (SCM tab)
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
for (; i < scm_i_heap_segment_table_size; i++)
|
|
||||||
{
|
|
||||||
scm_t_heap_segment *seg = scm_i_heap_segment_table[i];
|
|
||||||
scm_i_heap_segment_statistics (seg, tab);
|
|
||||||
}
|
|
||||||
|
|
||||||
return tab;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
unsigned long*
|
|
||||||
scm_i_segment_table_info (int* size)
|
|
||||||
{
|
|
||||||
*size = scm_i_heap_segment_table_size;
|
|
||||||
unsigned long *bounds = malloc (sizeof (unsigned long) * *size * 2);
|
|
||||||
int i;
|
|
||||||
if (!bounds)
|
|
||||||
abort ();
|
|
||||||
for (i = *size; i-- > 0; )
|
|
||||||
{
|
|
||||||
bounds[2*i] = (unsigned long)scm_i_heap_segment_table[i]->bounds[0];
|
|
||||||
bounds[2*i+1] = (unsigned long)scm_i_heap_segment_table[i]->bounds[1];
|
|
||||||
}
|
|
||||||
return bounds;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
scm_i_sweep_all_segments (char const *reason,
|
|
||||||
scm_t_sweep_statistics *sweep_stats)
|
|
||||||
{
|
|
||||||
unsigned i= 0;
|
|
||||||
for (i = 0; i < scm_i_heap_segment_table_size; i++)
|
|
||||||
{
|
|
||||||
scm_i_sweep_segment (scm_i_heap_segment_table[i], sweep_stats);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
scm_i_clear_mark_space (void)
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
for (; i < scm_i_heap_segment_table_size; i++)
|
|
||||||
{
|
|
||||||
scm_i_clear_segment_mark_space (scm_i_heap_segment_table[i]);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -208,17 +208,10 @@ scm_t_c_hook scm_after_sweep_c_hook;
|
||||||
scm_t_c_hook scm_after_gc_c_hook;
|
scm_t_c_hook scm_after_gc_c_hook;
|
||||||
|
|
||||||
|
|
||||||
/* scm_mtrigger
|
|
||||||
* is the number of bytes of malloc allocation needed to trigger gc.
|
|
||||||
*/
|
|
||||||
unsigned long scm_mtrigger;
|
|
||||||
|
|
||||||
/* GC Statistics Keeping
|
/* GC Statistics Keeping
|
||||||
*/
|
*/
|
||||||
unsigned long scm_mallocated = 0;
|
|
||||||
unsigned long scm_gc_ports_collected = 0;
|
unsigned long scm_gc_ports_collected = 0;
|
||||||
|
|
||||||
|
|
||||||
static unsigned long protected_obj_count = 0;
|
static unsigned long protected_obj_count = 0;
|
||||||
|
|
||||||
|
|
||||||
|
@ -673,8 +666,6 @@ scm_init_storage ()
|
||||||
while (j)
|
while (j)
|
||||||
scm_sys_protects[--j] = SCM_BOOL_F;
|
scm_sys_protects[--j] = SCM_BOOL_F;
|
||||||
|
|
||||||
j = SCM_HEAP_SEG_SIZE;
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* We can't have a cleanup handler since we have no thread to run it
|
/* We can't have a cleanup handler since we have no thread to run it
|
||||||
in. */
|
in. */
|
||||||
|
|
|
@ -152,17 +152,7 @@ SCM_API size_t scm_default_max_segment_size;
|
||||||
#define scm_default_max_segment_size deprecated
|
#define scm_default_max_segment_size deprecated
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
SCM_API size_t scm_max_segment_size;
|
|
||||||
|
|
||||||
#define SCM_SET_FREELIST_LOC(key,ptr) scm_i_pthread_setspecific ((key), (ptr))
|
|
||||||
#define SCM_FREELIST_LOC(key) ((SCM *) scm_i_pthread_getspecific (key))
|
|
||||||
SCM_API struct scm_t_cell_type_statistics scm_i_master_freelist;
|
|
||||||
SCM_API struct scm_t_cell_type_statistics scm_i_master_freelist2;
|
|
||||||
|
|
||||||
SCM_API unsigned long scm_mallocated;
|
|
||||||
SCM_API unsigned long scm_gc_ports_collected;
|
SCM_API unsigned long scm_gc_ports_collected;
|
||||||
SCM_API unsigned long scm_mtrigger;
|
|
||||||
|
|
||||||
SCM_API SCM scm_after_gc_hook;
|
SCM_API SCM scm_after_gc_hook;
|
||||||
|
|
||||||
|
@ -172,18 +162,6 @@ SCM_API scm_t_c_hook scm_before_sweep_c_hook;
|
||||||
SCM_API scm_t_c_hook scm_after_sweep_c_hook;
|
SCM_API scm_t_c_hook scm_after_sweep_c_hook;
|
||||||
SCM_API scm_t_c_hook scm_after_gc_c_hook;
|
SCM_API scm_t_c_hook scm_after_gc_c_hook;
|
||||||
|
|
||||||
#if defined (GUILE_DEBUG) || defined (GUILE_DEBUG_FREELIST)
|
|
||||||
#if (SCM_ENABLE_DEPRECATED == 1)
|
|
||||||
SCM scm_map_free_list (void);
|
|
||||||
#else
|
|
||||||
#define scm_map_free_list deprecated
|
|
||||||
#define scm_free_list_length deprecated
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (SCM_ENABLE_DEPRECATED == 1) && defined (GUILE_DEBUG_FREELIST)
|
|
||||||
SCM_API SCM scm_gc_set_debug_check_freelist_x (SCM flag);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if (SCM_DEBUG_CELL_ACCESSES == 1)
|
#if (SCM_DEBUG_CELL_ACCESSES == 1)
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
* 02110-1301 USA
|
* 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef PRIVATE_GC
|
#ifndef SCM_PRIVATE_GC
|
||||||
#define PRIVATE_GC
|
#define SCM_PRIVATE_GC
|
||||||
|
|
||||||
#include "_scm.h"
|
#include "_scm.h"
|
||||||
|
|
||||||
|
@ -32,54 +32,15 @@
|
||||||
* Each heap cell is 8 bytes on a 32 bit machine and 16 bytes on a
|
* Each heap cell is 8 bytes on a 32 bit machine and 16 bytes on a
|
||||||
* 64 bit machine. The units of the _SIZE parameters are bytes.
|
* 64 bit machine. The units of the _SIZE parameters are bytes.
|
||||||
* Cons pairs and object headers occupy one heap cell.
|
* Cons pairs and object headers occupy one heap cell.
|
||||||
*
|
|
||||||
* SCM_MIN_HEAP_SEG_SIZE is minimum size of heap to accept when more heap
|
|
||||||
* is needed.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Heap size 45000 and 40% min yield gives quick startup and no extra
|
|
||||||
* heap allocation. Having higher values on min yield may lead to
|
|
||||||
* large heaps, especially if code behaviour is varying its
|
|
||||||
* maximum consumption between different freelists.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
These values used to be global C variables. However, they're also
|
|
||||||
available through the environment, and having a double interface is
|
|
||||||
confusing. Now they're #defines --hwn.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define SCM_DEFAULT_INIT_HEAP_SIZE_1 256*1024
|
|
||||||
#define SCM_DEFAULT_MIN_YIELD_1 40
|
|
||||||
#define SCM_DEFAULT_INIT_HEAP_SIZE_2 32*1024
|
#define SCM_DEFAULT_INIT_HEAP_SIZE_2 32*1024
|
||||||
|
|
||||||
/*
|
|
||||||
How many cells to collect during one sweep call. This is the pool
|
|
||||||
size of each thread.
|
|
||||||
*/
|
|
||||||
#define DEFAULT_SWEEP_AMOUNT 512
|
|
||||||
|
|
||||||
/* The following value may seem large, but note that if we get to GC at
|
|
||||||
* all, this means that we have a numerically intensive application
|
|
||||||
*/
|
|
||||||
#define SCM_DEFAULT_MIN_YIELD_2 40
|
|
||||||
|
|
||||||
#define SCM_DEFAULT_MAX_SEGMENT_SIZE (20*1024*1024L)
|
|
||||||
|
|
||||||
#define SCM_MIN_HEAP_SEG_SIZE (8 * SCM_GC_SIZEOF_CARD)
|
|
||||||
#define SCM_HEAP_SEG_SIZE (16384L * sizeof (scm_t_cell))
|
|
||||||
|
|
||||||
#define SCM_DOUBLECELL_ALIGNED_P(x) (((2 * sizeof (scm_t_cell) - 1) & SCM_UNPACK (x)) == 0)
|
#define SCM_DOUBLECELL_ALIGNED_P(x) (((2 * sizeof (scm_t_cell) - 1) & SCM_UNPACK (x)) == 0)
|
||||||
|
|
||||||
|
|
||||||
#define SCM_GC_CARD_BVEC_SIZE_IN_LONGS \
|
SCM_INTERNAL int scm_getenv_int (const char *var, int def);
|
||||||
((SCM_GC_CARD_N_CELLS + SCM_C_BVEC_LONG_BITS - 1) / SCM_C_BVEC_LONG_BITS)
|
|
||||||
#define SCM_GC_IN_CARD_HEADERP(x) \
|
|
||||||
(scm_t_cell *) (x) < SCM_GC_CELL_CARD (x) + SCM_GC_CARD_N_HEADER_CELLS
|
|
||||||
|
|
||||||
int scm_getenv_int (const char *var, int def);
|
|
||||||
|
|
||||||
|
|
||||||
typedef enum { return_on_error, abort_on_error } policy_on_error;
|
typedef enum { return_on_error, abort_on_error } policy_on_error;
|
||||||
|
@ -100,28 +61,6 @@ typedef enum { return_on_error, abort_on_error } policy_on_error;
|
||||||
*/
|
*/
|
||||||
#define CELL_P(x) ((SCM_UNPACK(x) & (sizeof(scm_t_cell)-1)) == scm_tc3_cons)
|
#define CELL_P(x) ((SCM_UNPACK(x) & (sizeof(scm_t_cell)-1)) == scm_tc3_cons)
|
||||||
|
|
||||||
/*
|
|
||||||
gc-mark
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Non-zero while in the mark phase. */
|
|
||||||
SCM_INTERNAL int scm_i_marking;
|
|
||||||
|
|
||||||
SCM_INTERNAL void scm_mark_all (void);
|
|
||||||
|
|
||||||
extern long int scm_i_deprecated_memory_return;
|
|
||||||
extern long int scm_i_find_heap_calls;
|
|
||||||
|
|
||||||
SCM_INTERNAL char const *scm_i_tag_name (scm_t_bits tag); /* MOVEME */
|
SCM_INTERNAL char const *scm_i_tag_name (scm_t_bits tag); /* MOVEME */
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
global init funcs.
|
|
||||||
*/
|
|
||||||
void scm_gc_init_malloc (void);
|
|
||||||
void scm_gc_init_freelist (void);
|
|
||||||
void scm_gc_init_segments (void);
|
|
||||||
void scm_gc_init_mark (void);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue