]> gitweb.factorcode.org Git - factor.git/blob - vm/code_heap.hpp
vm: replace block comments /**/ with line comments //
[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   cell 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   void free(code_block* compiled);
41   void flush_icache();
42   void set_safepoint_guard(bool locked);
43   void verify_all_blocks_set();
44   void initialize_all_blocks_set();
45
46   void sweep();
47
48   code_block* code_block_for_address(cell address);
49   cell frame_predecessor(cell frame_top);
50
51   bool safepoint_p(cell addr) {
52     cell page_mask = ~(getpagesize() - 1);
53     return (addr & page_mask) == safepoint_page;
54   }
55 };
56
57 }