| version 1.1, 1999/12/03 07:39:09 |
version 1.3, 2001/04/20 07:39:18 |
|
|
| * level tree. |
* level tree. |
| */ |
*/ |
| |
|
| # include "gc_priv.h" |
# include "private/gc_priv.h" |
| |
|
| bottom_index * GC_all_bottom_indices = 0; |
bottom_index * GC_all_bottom_indices = 0; |
| /* Pointer to first (lowest addr) */ |
/* Pointer to first (lowest addr) */ |
|
|
| |
|
| static ptr_t scratch_free_ptr = 0; |
static ptr_t scratch_free_ptr = 0; |
| |
|
| ptr_t GC_scratch_end_ptr = 0; |
/* GC_scratch_last_end_ptr is end point of last obtained scratch area. */ |
| |
/* GC_scratch_end_ptr is end point of current scratch area. */ |
| ptr_t GC_scratch_last_end_ptr = 0; |
|
| /* End point of last obtained scratch area */ |
|
| |
|
| ptr_t GC_scratch_alloc(bytes) |
ptr_t GC_scratch_alloc(bytes) |
| register word bytes; |
register word bytes; |
|
|
| hhdr -> hb_next = (struct hblk *) hdr_free_list; |
hhdr -> hb_next = (struct hblk *) hdr_free_list; |
| hdr_free_list = hhdr; |
hdr_free_list = hhdr; |
| } |
} |
| |
|
| |
hdr * GC_invalid_header; |
| |
|
| |
#ifdef USE_HDR_CACHE |
| |
word GC_hdr_cache_hits = 0; |
| |
word GC_hdr_cache_misses = 0; |
| |
#endif |
| |
|
| void GC_init_headers() |
void GC_init_headers() |
| { |
{ |
| Line 138 void GC_init_headers() |
|
| Line 143 void GC_init_headers() |
|
| for (i = 0; i < TOP_SZ; i++) { |
for (i = 0; i < TOP_SZ; i++) { |
| GC_top_index[i] = GC_all_nils; |
GC_top_index[i] = GC_all_nils; |
| } |
} |
| |
GC_invalid_header = alloc_hdr(); |
| |
GC_invalidate_map(GC_invalid_header); |
| } |
} |
| |
|
| /* Make sure that there is a bottom level index block for address addr */ |
/* Make sure that there is a bottom level index block for address addr */ |
|
|
| return(TRUE); |
return(TRUE); |
| } |
} |
| |
|
| /* Install a header for block h. */ |
/* Install a header for block h. */ |
| /* The header is uninitialized. */ |
/* The header is uninitialized. */ |
| /* Returns FALSE on failure. */ |
/* Returns the header or 0 on failure. */ |
| GC_bool GC_install_header(h) |
struct hblkhdr * GC_install_header(h) |
| register struct hblk * h; |
register struct hblk * h; |
| { |
{ |
| hdr * result; |
hdr * result; |
| Line 205 register struct hblk * h; |
|
| Line 212 register struct hblk * h; |
|
| # ifdef USE_MUNMAP |
# ifdef USE_MUNMAP |
| result -> hb_last_reclaimed = GC_gc_no; |
result -> hb_last_reclaimed = GC_gc_no; |
| # endif |
# endif |
| return(result != 0); |
return(result); |
| } |
} |
| |
|
| /* Set up forwarding counts for block h of size sz */ |
/* Set up forwarding counts for block h of size sz */ |
| Line 253 register word sz; /* bytes */ |
|
| Line 260 register word sz; /* bytes */ |
|
| /* Apply fn to all allocated blocks */ |
/* Apply fn to all allocated blocks */ |
| /*VARARGS1*/ |
/*VARARGS1*/ |
| void GC_apply_to_all_blocks(fn, client_data) |
void GC_apply_to_all_blocks(fn, client_data) |
| void (*fn)(/* struct hblk *h, word client_data */); |
void (*fn) GC_PROTO((struct hblk *h, word client_data)); |
| word client_data; |
word client_data; |
| { |
{ |
| register int j; |
register int j; |