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) \ |
1544 |
|
|
1545 |
#define NEXT_DATA_CELL(ptr, span) \ |
#define NEXT_DATA_CELL(ptr, span) \ |
1546 |
do { \ |
do { \ |
1547 |
scm_cell *nxt__ = CELL_UP ((char *) (ptr) + 1, (span)); \ |
scm_t_cell *nxt__ = CELL_UP ((char *) (ptr) + 1, (span)); \ |
1548 |
(ptr) = (SCM_GC_IN_CARD_HEADERP (nxt__) ? \ |
(ptr) = (SCM_GC_IN_CARD_HEADERP (nxt__) ? \ |
1549 |
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) \ |
1550 |
: nxt__); \ |
: nxt__); \ |
2201 |
NEXT_DATA_CELL (ptr, span); |
NEXT_DATA_CELL (ptr, span); |
2202 |
while (ptr < seg_end) |
while (ptr < seg_end) |
2203 |
{ |
{ |
2204 |
scm_cell *nxt = ptr; |
scm_t_cell *nxt = ptr; |
2205 |
scm_cell *prv = NULL; |
scm_t_cell *prv = NULL; |
2206 |
scm_cell *last_card = NULL; |
scm_t_cell *last_card = NULL; |
2207 |
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; |
2208 |
NEXT_DATA_CELL(nxt, span); |
NEXT_DATA_CELL(nxt, span); |
2209 |
|
|
2216 |
|
|
2217 |
while (n_data_cells--) |
while (n_data_cells--) |
2218 |
{ |
{ |
2219 |
scm_cell *card = SCM_GC_CELL_CARD (ptr); |
scm_t_cell *card = SCM_GC_CELL_CARD (ptr); |
2220 |
SCM scmptr = PTR2SCM (ptr); |
SCM scmptr = PTR2SCM (ptr); |
2221 |
nxt = ptr; |
nxt = ptr; |
2222 |
NEXT_DATA_CELL (nxt, span); |
NEXT_DATA_CELL (nxt, span); |
2239 |
|
|
2240 |
/* sanity check */ |
/* sanity check */ |
2241 |
{ |
{ |
2242 |
scm_cell *ref = seg_end; |
scm_t_cell *ref = seg_end; |
2243 |
NEXT_DATA_CELL (ref, span); |
NEXT_DATA_CELL (ref, span); |
2244 |
if (ref != ptr) |
if (ref != ptr) |
2245 |
/* [cmm] looks like the segment size doesn't divide cleanly by |
/* [cmm] looks like the segment size doesn't divide cleanly by |
2344 |
#endif |
#endif |
2345 |
if (len < min_cells) |
if (len < min_cells) |
2346 |
len = min_cells + freelist->cluster_size; |
len = min_cells + freelist->cluster_size; |
2347 |
len *= sizeof (scm_cell); |
len *= sizeof (scm_t_cell); |
2348 |
/* force new sampling */ |
/* force new sampling */ |
2349 |
freelist->collected = LONG_MAX; |
freelist->collected = LONG_MAX; |
2350 |
} |
} |
2831 |
scm_deprecated_newcell (void) |
scm_deprecated_newcell (void) |
2832 |
{ |
{ |
2833 |
scm_c_issue_deprecation_warning |
scm_c_issue_deprecation_warning |
2834 |
("SCM_NEWCELL is deprecated. Use `scm_alloc_cell' instead.\n"); |
("SCM_NEWCELL is deprecated. Use `scm_cell' instead.\n"); |
2835 |
|
|
2836 |
return scm_alloc_cell (scm_tc16_allocated, 0); |
return scm_cell (scm_tc16_allocated, 0); |
2837 |
} |
} |
2838 |
|
|
2839 |
SCM |
SCM |
2840 |
scm_deprecated_newcell2 (void) |
scm_deprecated_newcell2 (void) |
2841 |
{ |
{ |
2842 |
scm_c_issue_deprecation_warning |
scm_c_issue_deprecation_warning |
2843 |
("SCM_NEWCELL2 is deprecated. Use `scm_alloc_double_cell' instead.\n"); |
("SCM_NEWCELL2 is deprecated. Use `scm_double_cell' instead.\n"); |
2844 |
|
|
2845 |
return scm_alloc_double_cell (scm_tc16_allocated, 0, 0, 0); |
return scm_double_cell (scm_tc16_allocated, 0, 0, 0); |
2846 |
} |
} |
2847 |
|
|
2848 |
#endif /* SCM_ENABLE_DEPRECATED == 1 */ |
#endif /* SCM_ENABLE_DEPRECATED == 1 */ |