277 |
# define SCM_HEAP_SEG_SIZE 32768L |
# define SCM_HEAP_SEG_SIZE 32768L |
278 |
#else |
#else |
279 |
# ifdef sequent |
# ifdef sequent |
280 |
# define SCM_HEAP_SEG_SIZE (7000L * sizeof (scm_cell)) |
# define SCM_HEAP_SEG_SIZE (7000L * sizeof (scm_t_cell)) |
281 |
# else |
# else |
282 |
# define SCM_HEAP_SEG_SIZE (16384L * sizeof (scm_cell)) |
# define SCM_HEAP_SEG_SIZE (16384L * sizeof (scm_t_cell)) |
283 |
# endif |
# endif |
284 |
#endif |
#endif |
285 |
/* Make heap grow with factor 1.5 */ |
/* Make heap grow with factor 1.5 */ |
287 |
#define SCM_INIT_MALLOC_LIMIT 100000 |
#define SCM_INIT_MALLOC_LIMIT 100000 |
288 |
#define SCM_MTRIGGER_HYSTERESIS (SCM_INIT_MALLOC_LIMIT/10) |
#define SCM_MTRIGGER_HYSTERESIS (SCM_INIT_MALLOC_LIMIT/10) |
289 |
|
|
290 |
/* CELL_UP and CELL_DN are used by scm_init_heap_seg to find (scm_cell * span) |
/* CELL_UP and CELL_DN are used by scm_init_heap_seg to find (scm_t_cell * span) |
291 |
aligned inner bounds for allocated storage */ |
aligned inner bounds for allocated storage */ |
292 |
|
|
293 |
#ifdef PROT386 |
#ifdef PROT386 |
299 |
# define CELL_UP(p, span) (SCM_CELLPTR)(~(span) & ((long)(p)+(span))) |
# define CELL_UP(p, span) (SCM_CELLPTR)(~(span) & ((long)(p)+(span))) |
300 |
# define CELL_DN(p, span) (SCM_CELLPTR)(~(span) & (long)(p)) |
# define CELL_DN(p, span) (SCM_CELLPTR)(~(span) & (long)(p)) |
301 |
# else |
# else |
302 |
# define CELL_UP(p, span) (SCM_CELLPTR)(~(sizeof(scm_cell)*(span)-1L) & ((long)(p)+sizeof(scm_cell)*(span)-1L)) |
# define CELL_UP(p, span) (SCM_CELLPTR)(~(sizeof(scm_t_cell)*(span)-1L) & ((long)(p)+sizeof(scm_t_cell)*(span)-1L)) |
303 |
# define CELL_DN(p, span) (SCM_CELLPTR)(~(sizeof(scm_cell)*(span)-1L) & (long)(p)) |
# define CELL_DN(p, span) (SCM_CELLPTR)(~(sizeof(scm_t_cell)*(span)-1L) & (long)(p)) |
304 |
# endif /* UNICOS */ |
# endif /* UNICOS */ |
305 |
#endif /* PROT386 */ |
#endif /* PROT386 */ |
306 |
|
|
307 |
#define DOUBLECELL_ALIGNED_P(x) (((2 * sizeof (scm_cell) - 1) & SCM_UNPACK (x)) == 0) |
#define DOUBLECELL_ALIGNED_P(x) (((2 * sizeof (scm_t_cell) - 1) & SCM_UNPACK (x)) == 0) |
308 |
|
|
309 |
#define ALIGNMENT_SLACK(freelist) (SCM_GC_CARD_SIZE - 1) |
#define ALIGNMENT_SLACK(freelist) (SCM_GC_CARD_SIZE - 1) |
310 |
#define CLUSTER_SIZE_IN_BYTES(freelist) \ |
#define CLUSTER_SIZE_IN_BYTES(freelist) \ |
1644 |
|
|
1645 |
#define NEXT_DATA_CELL(ptr, span) \ |
#define NEXT_DATA_CELL(ptr, span) \ |
1646 |
do { \ |
do { \ |
1647 |
scm_cell *nxt__ = CELL_UP ((char *) (ptr) + 1, (span)); \ |
scm_t_cell *nxt__ = CELL_UP ((char *) (ptr) + 1, (span)); \ |
1648 |
(ptr) = (SCM_GC_IN_CARD_HEADERP (nxt__) ? \ |
(ptr) = (SCM_GC_IN_CARD_HEADERP (nxt__) ? \ |
1649 |
CELL_UP (SCM_GC_CELL_CARD (nxt__) + SCM_GC_CARD_N_HEADER_CELLS, span) \ |
CELL_UP (SCM_GC_CELL_CARD (nxt__) + SCM_GC_CARD_N_HEADER_CELLS, span) \ |
1650 |
: nxt__); \ |
: nxt__); \ |
2272 |
NEXT_DATA_CELL (ptr, span); |
NEXT_DATA_CELL (ptr, span); |
2273 |
while (ptr < seg_end) |
while (ptr < seg_end) |
2274 |
{ |
{ |
2275 |
scm_cell *nxt = ptr; |
scm_t_cell *nxt = ptr; |
2276 |
scm_cell *prv = NULL; |
scm_t_cell *prv = NULL; |
2277 |
scm_cell *last_card = NULL; |
scm_t_cell *last_card = NULL; |
2278 |
int n_data_cells = (SCM_GC_CARD_N_DATA_CELLS / span) * SCM_CARDS_PER_CLUSTER - 1; |
int n_data_cells = (SCM_GC_CARD_N_DATA_CELLS / span) * SCM_CARDS_PER_CLUSTER - 1; |
2279 |
NEXT_DATA_CELL(nxt, span); |
NEXT_DATA_CELL(nxt, span); |
2280 |
|
|
2287 |
|
|
2288 |
while (n_data_cells--) |
while (n_data_cells--) |
2289 |
{ |
{ |
2290 |
scm_cell *card = SCM_GC_CELL_CARD (ptr); |
scm_t_cell *card = SCM_GC_CELL_CARD (ptr); |
2291 |
SCM scmptr = PTR2SCM (ptr); |
SCM scmptr = PTR2SCM (ptr); |
2292 |
nxt = ptr; |
nxt = ptr; |
2293 |
NEXT_DATA_CELL (nxt, span); |
NEXT_DATA_CELL (nxt, span); |
2310 |
|
|
2311 |
/* sanity check */ |
/* sanity check */ |
2312 |
{ |
{ |
2313 |
scm_cell *ref = seg_end; |
scm_t_cell *ref = seg_end; |
2314 |
NEXT_DATA_CELL (ref, span); |
NEXT_DATA_CELL (ref, span); |
2315 |
if (ref != ptr) |
if (ref != ptr) |
2316 |
/* [cmm] looks like the segment size doesn't divide cleanly by |
/* [cmm] looks like the segment size doesn't divide cleanly by |
2415 |
#endif |
#endif |
2416 |
if (len < min_cells) |
if (len < min_cells) |
2417 |
len = min_cells + freelist->cluster_size; |
len = min_cells + freelist->cluster_size; |
2418 |
len *= sizeof (scm_cell); |
len *= sizeof (scm_t_cell); |
2419 |
/* force new sampling */ |
/* force new sampling */ |
2420 |
freelist->collected = LONG_MAX; |
freelist->collected = LONG_MAX; |
2421 |
} |
} |