]> gitweb.factorcode.org Git - factor.git/blob - vm/code_heap.hpp
vm: implement frame-based SEH for 64-bit Windows
[factor.git] / vm / code_heap.hpp
1 namespace factor
2 {
3
4 #if defined(WINDOWS) && defined(FACTOR_64)
5         const cell seh_area_size = 1024;
6 #else
7         const cell seh_area_size = 0;
8 #endif
9
10 struct code_heap {
11         /* The actual memory area */
12         segment *seg;
13
14         /* Memory area reserved for SEH. Only used on Windows */
15         char *seh_area;
16
17         /* Memory allocator */
18         free_list_allocator<code_block> *allocator;
19
20         /* Keys are blocks which need to be initialized by initialize_code_block().
21         Values are literal tables. Literal table arrays are GC roots until the
22         time the block is initialized, after which point they are discarded. */
23         std::map<code_block *, cell> uninitialized_blocks;
24
25         /* Code blocks which may reference objects in the nursery */
26         std::set<code_block *> points_to_nursery;
27
28         /* Code blocks which may reference objects in aging space or the nursery */
29         std::set<code_block *> points_to_aging;
30
31         explicit code_heap(cell size);
32         ~code_heap();
33         void write_barrier(code_block *compiled);
34         void clear_remembered_set();
35         bool uninitialized_p(code_block *compiled);
36         bool marked_p(code_block *compiled);
37         void set_marked_p(code_block *compiled);
38         void clear_mark_bits();
39         void free(code_block *compiled);
40         void flush_icache();
41 };
42
43 struct code_heap_room {
44         cell size;
45         cell occupied_space;
46         cell total_free;
47         cell contiguous_free;
48         cell free_block_count;
49 };
50
51 }