3 // gc_info should be kept in sync with:
4 // basis/compiler/codegen/gc-maps/gc-maps.factor
7 uint32_t scrub_d_count;
8 uint32_t scrub_r_count;
9 uint32_t gc_root_count;
10 uint32_t derived_root_count;
11 uint32_t return_address_count;
13 cell callsite_bitmap_size() {
14 return scrub_d_count + scrub_r_count + gc_root_count;
17 cell total_bitmap_size() {
18 return return_address_count * callsite_bitmap_size();
21 cell total_bitmap_bytes() { return ((total_bitmap_size() + 7) / 8); }
23 uint32_t* return_addresses() {
24 return (uint32_t*)this - return_address_count;
27 uint32_t* base_pointer_map() {
28 return return_addresses() - return_address_count * derived_root_count;
31 uint8_t* gc_info_bitmap() {
32 return (uint8_t*)base_pointer_map() - total_bitmap_bytes();
35 cell callsite_scrub_d(cell index) {
37 return base + index * scrub_d_count;
40 cell callsite_scrub_r(cell index) {
41 cell base = return_address_count * scrub_d_count;
42 return base + index * scrub_r_count;
45 cell callsite_gc_roots(cell index) {
47 return_address_count * scrub_d_count +
48 return_address_count * scrub_r_count;
49 return base + index * gc_root_count;
52 uint32_t lookup_base_pointer(cell index, cell derived_root) {
53 return base_pointer_map()[index * derived_root_count + derived_root];
56 cell return_address_index(cell return_address);