version 1.2, 2000/04/10 08:31:30 |
version 1.3, 2001/04/20 07:39:18 |
|
|
* modified is included with the above copyright notice. |
* modified is included with the above copyright notice. |
*/ |
*/ |
/* Boehm, August 9, 1995 6:09 pm PDT */ |
/* Boehm, August 9, 1995 6:09 pm PDT */ |
# include "gc_priv.h" |
# include "private/gc_priv.h" |
|
|
/* |
/* |
* We maintain several hash tables of hblks that have had false hits. |
* We maintain several hash tables of hblks that have had false hits. |
Line 52 word GC_black_list_spacing = MINHINCR*HBLKSIZE; /* In |
|
Line 52 word GC_black_list_spacing = MINHINCR*HBLKSIZE; /* In |
|
|
|
void GC_clear_bl(); |
void GC_clear_bl(); |
|
|
void GC_default_print_heap_obj_proc(p) |
# if defined(__STDC__) || defined(__cplusplus) |
ptr_t p; |
void GC_default_print_heap_obj_proc(ptr_t p) |
|
# else |
|
void GC_default_print_heap_obj_proc(p) |
|
ptr_t p; |
|
# endif |
{ |
{ |
ptr_t base = GC_base(p); |
ptr_t base = GC_base(p); |
|
|
GC_err_printf2("start: 0x%lx, appr. length: %ld", base, GC_size(base)); |
GC_err_printf2("start: 0x%lx, appr. length: %ld", base, GC_size(base)); |
} |
} |
|
|
void (*GC_print_heap_obj)(/* char * s, ptr_t p */) = |
void (*GC_print_heap_obj) GC_PROTO((ptr_t p)) = |
GC_default_print_heap_obj_proc; |
GC_default_print_heap_obj_proc; |
|
|
void GC_print_source_ptr(p) |
void GC_print_source_ptr(p) |
|
|
|
|
void GC_bl_init() |
void GC_bl_init() |
{ |
{ |
# ifndef ALL_INTERIOR_POINTERS |
if (!GC_all_interior_pointers) { |
GC_old_normal_bl = (word *) |
GC_old_normal_bl = (word *) |
GC_scratch_alloc((word)(sizeof (page_hash_table))); |
GC_scratch_alloc((word)(sizeof (page_hash_table))); |
GC_incomplete_normal_bl = (word *)GC_scratch_alloc |
GC_incomplete_normal_bl = (word *)GC_scratch_alloc |
((word)(sizeof(page_hash_table))); |
((word)(sizeof(page_hash_table))); |
if (GC_old_normal_bl == 0 || GC_incomplete_normal_bl == 0) { |
if (GC_old_normal_bl == 0 || GC_incomplete_normal_bl == 0) { |
GC_err_printf0("Insufficient memory for black list\n"); |
GC_err_printf0("Insufficient memory for black list\n"); |
EXIT(); |
EXIT(); |
|
} |
|
GC_clear_bl(GC_old_normal_bl); |
|
GC_clear_bl(GC_incomplete_normal_bl); |
} |
} |
GC_clear_bl(GC_old_normal_bl); |
|
GC_clear_bl(GC_incomplete_normal_bl); |
|
# endif |
|
GC_old_stack_bl = (word *)GC_scratch_alloc((word)(sizeof(page_hash_table))); |
GC_old_stack_bl = (word *)GC_scratch_alloc((word)(sizeof(page_hash_table))); |
GC_incomplete_stack_bl = (word *)GC_scratch_alloc |
GC_incomplete_stack_bl = (word *)GC_scratch_alloc |
((word)(sizeof(page_hash_table))); |
((word)(sizeof(page_hash_table))); |
Line 127 void GC_promote_black_lists() |
|
Line 131 void GC_promote_black_lists() |
|
|
|
GC_old_normal_bl = GC_incomplete_normal_bl; |
GC_old_normal_bl = GC_incomplete_normal_bl; |
GC_old_stack_bl = GC_incomplete_stack_bl; |
GC_old_stack_bl = GC_incomplete_stack_bl; |
# ifndef ALL_INTERIOR_POINTERS |
if (!GC_all_interior_pointers) { |
GC_clear_bl(very_old_normal_bl); |
GC_clear_bl(very_old_normal_bl); |
# endif |
} |
GC_clear_bl(very_old_stack_bl); |
GC_clear_bl(very_old_stack_bl); |
GC_incomplete_normal_bl = very_old_normal_bl; |
GC_incomplete_normal_bl = very_old_normal_bl; |
GC_incomplete_stack_bl = very_old_stack_bl; |
GC_incomplete_stack_bl = very_old_stack_bl; |
Line 156 void GC_promote_black_lists() |
|
Line 160 void GC_promote_black_lists() |
|
|
|
void GC_unpromote_black_lists() |
void GC_unpromote_black_lists() |
{ |
{ |
# ifndef ALL_INTERIOR_POINTERS |
if (!GC_all_interior_pointers) { |
GC_copy_bl(GC_old_normal_bl, GC_incomplete_normal_bl); |
GC_copy_bl(GC_old_normal_bl, GC_incomplete_normal_bl); |
# endif |
} |
GC_copy_bl(GC_old_stack_bl, GC_incomplete_stack_bl); |
GC_copy_bl(GC_old_stack_bl, GC_incomplete_stack_bl); |
} |
} |
|
|
# ifndef ALL_INTERIOR_POINTERS |
|
/* P is not a valid pointer reference, but it falls inside */ |
/* P is not a valid pointer reference, but it falls inside */ |
/* the plausible heap bounds. */ |
/* the plausible heap bounds. */ |
/* Add it to the normal incomplete black list if appropriate. */ |
/* Add it to the normal incomplete black list if appropriate. */ |
|
|
/* object, and isn't worth black listing. */ |
/* object, and isn't worth black listing. */ |
} |
} |
} |
} |
# endif |
|
|
|
/* And the same for false pointers from the stack. */ |
/* And the same for false pointers from the stack. */ |
#ifdef PRINT_BLACK_LIST |
#ifdef PRINT_BLACK_LIST |
|
|
register word i; |
register word i; |
word nblocks = divHBLKSZ(len); |
word nblocks = divHBLKSZ(len); |
|
|
# ifndef ALL_INTERIOR_POINTERS |
if (!GC_all_interior_pointers) { |
if (get_pht_entry_from_index(GC_old_normal_bl, index) |
if (get_pht_entry_from_index(GC_old_normal_bl, index) |
|| get_pht_entry_from_index(GC_incomplete_normal_bl, index)) { |
|| get_pht_entry_from_index(GC_incomplete_normal_bl, index)) { |
return(h+1); |
return(h+1); |
} |
} |
# endif |
} |
|
|
for (i = 0; ; ) { |
for (i = 0; ; ) { |
if (GC_old_stack_bl[divWORDSZ(index)] == 0 |
if (GC_old_stack_bl[divWORDSZ(index)] == 0 |