]> gitweb.factorcode.org Git - factor.git/blob - vm/code_heap.hpp
78ffa6c76a19cd06926c002f8031daca7aba8337
[factor.git] / vm / code_heap.hpp
1 namespace factor
2 {
3
4 struct code_heap {
5         /* The actual memory area */
6         segment *seg;
7
8         /* Memory allocator */
9         free_list_allocator<code_block> *allocator;
10
11         /* Keys are blocks which need to be initialized by initialize_code_block().
12         Values are literal tables. Literal table arrays are GC roots until the
13         time the block is initialized, after which point they are discarded. */
14         std::map<code_block *, cell> uninitialized_blocks;
15
16         /* Code blocks which may reference objects in the nursery */
17         std::set<code_block *> points_to_nursery;
18
19         /* Code blocks which may reference objects in aging space or the nursery */
20         std::set<code_block *> points_to_aging;
21
22         explicit code_heap(cell size);
23         ~code_heap();
24         void write_barrier(code_block *compiled);
25         void clear_remembered_set();
26         bool uninitialized_p(code_block *compiled);
27         bool marked_p(code_block *compiled);
28         void set_marked_p(code_block *compiled);
29         void clear_mark_bits();
30         void free(code_block *compiled);
31         void flush_icache();
32 };
33
34 struct code_heap_room {
35         cell size;
36         cell occupied_space;
37         cell total_free;
38         cell contiguous_free;
39         cell free_block_count;
40 };
41
42 }