2 * Generational Conservative Garbage Collector for SBCL x86
6 * This software is part of the SBCL system. See the README file for
9 * This software is derived from the CMU CL system, which was
10 * written at Carnegie Mellon University and released into the
11 * public domain. The software is in the public domain and is
12 * provided with absolutely no warranty. See the COPYING and CREDITS
13 * files for more information.
19 void gc_free_heap(void);
20 inline int find_page_index(void *);
21 inline void *page_address(int);
22 int gencgc_handle_wp_violation(void *);
23 lispobj *search_dynamic_space(lispobj *);
28 /* This is set when the page is write-protected. This should
29 * always reflect the actual write_protect status of a page.
30 * (If the page is written into, we catch the exception, make
31 * the page writable, and clear this flag.) */
33 /* This flag is set when the above write_protected flag is
34 * cleared by the SIGBUS handler (or SIGSEGV handler, for some
35 * OSes). This is useful for re-scavenging pages that are
36 * written during a GC. */
37 write_protected_cleared :1,
38 /* the region the page is allocated to: 0 for a free page; 1
39 * for boxed objects; 2 for unboxed objects. If the page is
40 * free the following slots are invalid (well the bytes_used
43 /* If this page should not be moved during a GC then this flag
44 * is set. It's only valid during a GC for allocated pages. */
46 /* If the page is part of a large object then this flag is
47 * set. No other objects should be allocated to these pages.
48 * This is only valid when the page is allocated. */
51 /* the generation that this page belongs to. This should be valid
52 * for all pages that may have objects allocated, even current
53 * allocation region pages - this allows the space of an object to
54 * be easily determined. */
57 /* the number of bytes of this page that are used. This may be less
58 * than the actual bytes used for pages within the current
59 * allocation regions. It should be 0 for all unallocated pages (not
60 * hard to achieve). */
63 /* It is important to know the offset to the first object in the
64 * page. Currently it's only important to know if an object starts
65 * at the beginning of the page in which case the offset would be 0. */
66 int first_object_offset;
69 /* values for the page.allocated field */
72 #define UNBOXED_PAGE 2
74 /* values for the *_alloc_* parameters */
76 #define ALLOC_UNBOXED 1
80 /* the number of pages needed for the dynamic space - rounding up */
81 #define NUM_PAGES ((DYNAMIC_SPACE_SIZE+4095)/4096)
82 extern struct page page_table[NUM_PAGES];
84 /* Abstract out the data for an allocation region allowing a single
85 * routine to be used for allocation and closing. */
88 /* These two are needed for quick allocation. */
90 void *end_addr; /* pointer to the byte after the last usable byte */
92 /* These are needed when closing the region. */
98 extern struct alloc_region boxed_region;
99 extern struct alloc_region unboxed_region;
101 void gencgc_pickup_dynamic(void);
103 void sniff_code_object(struct code *code, unsigned displacement);
105 int update_x86_dynamic_space_free_pointer(void);
106 void gc_alloc_update_page_tables(int unboxed,
107 struct alloc_region *alloc_region);