]> gitweb.factorcode.org Git - factor.git/blob - vm/code_heap.hpp
VM: the clear_mark_bits methods are only called once -- make the calls inline instead
[factor.git] / vm / code_heap.hpp
1 namespace factor {
2
3 #if defined(WINDOWS) && defined(FACTOR_64)
4 const cell seh_area_size = 1024;
5 #else
6 const cell seh_area_size = 0;
7 #endif
8
9 struct code_heap {
10   /* The actual memory area */
11   segment* seg;
12
13   /* Memory area reserved for safepoint guard page */
14   void* safepoint_page;
15
16   /* Memory area reserved for SEH. Only used on Windows */
17   char* seh_area;
18
19   /* Memory allocator */
20   free_list_allocator<code_block>* allocator;
21
22   std::set<cell> all_blocks;
23
24   /* Keys are blocks which need to be initialized by initialize_code_block().
25      Values are literal tables. Literal table arrays are GC roots until the
26      time the block is initialized, after which point they are discarded. */
27   std::map<code_block*, cell> uninitialized_blocks;
28
29   /* Code blocks which may reference objects in the nursery */
30   std::set<code_block*> points_to_nursery;
31
32   /* Code blocks which may reference objects in aging space or the nursery */
33   std::set<code_block*> points_to_aging;
34
35   explicit code_heap(cell size);
36   ~code_heap();
37   void write_barrier(code_block* compiled);
38   void clear_remembered_set();
39   bool uninitialized_p(code_block* compiled);
40   bool marked_p(code_block* compiled);
41   void set_marked_p(code_block* compiled);
42   void free(code_block* compiled);
43   void flush_icache();
44   void guard_safepoint();
45   void unguard_safepoint();
46   void verify_all_blocks_set();
47   void initialize_all_blocks_set();
48
49   void sweep();
50
51   code_block* code_block_for_address(cell address);
52
53   bool safepoint_p(cell addr) {
54     cell page_mask = ~(getpagesize() - 1);
55     return (addr & page_mask) == (cell)safepoint_page;
56   }
57 };
58
59 }