4 /* Set by the -securegc command line argument */
7 /* generational copying GC divides memory into zones */
9 /* allocation pointer is 'here'; its offset is hardcoded in the
30 cell *allot_markers_end;
38 /* the 0th generation is where new objects are allocated. */
39 cell nursery() { return 0; }
41 /* where objects hang around */
42 cell aging() { return gen_count - 2; }
44 /* the oldest generation */
45 cell tenured() { return gen_count - 1; }
47 bool have_aging_p() { return gen_count > 2; }
50 extern data_heap *data;
52 static const cell max_gen_count = 3;
54 inline static bool in_zone(zone *z, object *pointer)
56 return (cell)pointer >= z->start && (cell)pointer < z->end;
59 cell init_zone(zone *z, cell size, cell base);
61 void init_card_decks();
63 data_heap *grow_data_heap(data_heap *data, cell requested_bytes);
65 void dealloc_data_heap(data_heap *data);
67 void clear_cards(cell from, cell to);
68 void clear_decks(cell from, cell to);
69 void clear_allot_markers(cell from, cell to);
70 void reset_generation(cell i);
71 void reset_generations(cell from, cell to);
73 void set_data_heap(data_heap *data_heap_);
75 void init_data_heap(cell gens,
81 /* set up guard pages to check for under/overflow.
82 size must be a multiple of the page size */
83 segment *alloc_segment(cell size);
84 void dealloc_segment(segment *block);
86 cell untagged_object_size(object *pointer);
87 cell unaligned_object_size(object *pointer);
88 cell binary_payload_start(object *pointer);
89 cell object_size(cell tagged);
98 PRIMITIVE(begin_scan);
99 PRIMITIVE(next_object);
102 /* GC is off during heap walking */
105 cell find_all_words();
107 /* Every object has a regular representation in the runtime, which makes GC
108 much simpler. Every slot of the object until binary_payload_start is a pointer
109 to some other object. */
110 inline static void do_slots(cell obj, void (* iter)(cell *))
113 cell payload_start = binary_payload_start((object *)obj);
114 cell end = obj + payload_start;
116 scan += sizeof(cell);
121 scan += sizeof(cell);
127 /* new objects are allocated here */
128 VM_C_API factor::zone nursery;