... |
... |
@@ -35,13 +35,39 @@ int gc_write_barrier(void *); |
35
|
35
|
*/
|
36
|
36
|
#define PAGE_NEEDS_ZEROING_MARKER 0xdead0000
|
37
|
37
|
|
|
38
|
+/*
|
|
39
|
+ * The various fields packed into the struct page flags member.
|
|
40
|
+ */
|
|
41
|
+
|
|
42
|
+/*
|
|
43
|
+ * The generation that this page belongs to. This should be valid for
|
|
44
|
+ * all pages that may have objects allocated, even current allocation
|
|
45
|
+ * region pages - this allows the space of an object to be easily
|
|
46
|
+ * determined.
|
|
47
|
+ */
|
|
48
|
+
|
|
49
|
+#define PAGE_GENERATION_MASK 0x0000000f
|
|
50
|
+#define PAGE_GENERATION(page) \
|
|
51
|
+ (page_table[page].flags & PAGE_GENERATION_MASK)
|
|
52
|
+
|
|
53
|
+#define PAGE_FLAGS(page, mask) (page_table[page].flags & (mask))
|
|
54
|
+#define PAGE_FLAGS_UPDATE(page, mmask, mflags) \
|
|
55
|
+ (page_table[page].flags = (page_table[page].flags & ~(mmask)) | (mflags))
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+/*
|
|
59
|
+ * After the generation, we have a set of bits. This defines the
|
|
60
|
+ * location of the first of the bit fields.
|
|
61
|
+ */
|
|
62
|
+#define PAGE_BASE_BIT_SHIFT 4
|
|
63
|
+
|
38
|
64
|
/*
|
39
|
65
|
* Set when the page is write protected. If it is writen into it is
|
40
|
66
|
* made writable and this flag is cleared. This should always reflect
|
41
|
67
|
* the actual write_protect status of a page.
|
42
|
68
|
*/
|
43
|
69
|
|
44
|
|
-#define PAGE_WRITE_PROTECTED_MASK 0x00000010
|
|
70
|
+#define PAGE_WRITE_PROTECTED_MASK (1 << PAGE_BASE_BIT_SHIFT)
|
45
|
71
|
#define PAGE_WRITE_PROTECTED(page) \
|
46
|
72
|
(page_table[page].flags & PAGE_WRITE_PROTECTED_MASK)
|
47
|
73
|
|
... |
... |
@@ -51,14 +77,14 @@ int gc_write_barrier(void *); |
51
|
77
|
* the bytes_used must be 0.
|
52
|
78
|
*/
|
53
|
79
|
|
54
|
|
-#define PAGE_ALLOCATED_MASK 0x00000040
|
|
80
|
+#define PAGE_ALLOCATED_MASK (1 << (PAGE_BASE_BIT_SHIFT + 1))
|
55
|
81
|
#define PAGE_ALLOCATED(page) (page_table[page].flags & PAGE_ALLOCATED_MASK)
|
56
|
82
|
|
57
|
83
|
/*
|
58
|
84
|
* Unboxed region flag: 1 for unboxed objects, 0 for boxed objects.
|
59
|
85
|
*/
|
60
|
|
-#define PAGE_UNBOXED_MASK 0x00000080
|
61
|
|
-#define PAGE_UNBOXED_SHIFT 7
|
|
86
|
+#define PAGE_UNBOXED_SHIFT (PAGE_BASE_BIT_SHIFT + 2)
|
|
87
|
+#define PAGE_UNBOXED_MASK (1 << PAGE_UNBOXED_SHIFT)
|
62
|
88
|
#define PAGE_UNBOXED(page) (page_table[page].flags & PAGE_UNBOXED_MASK)
|
63
|
89
|
#define PAGE_UNBOXED_VAL(page) (PAGE_UNBOXED(page) >> PAGE_UNBOXED_SHIFT)
|
64
|
90
|
|
... |
... |
@@ -67,7 +93,7 @@ int gc_write_barrier(void *); |
67
|
93
|
* set. It's only valid during a GC for allocated pages.
|
68
|
94
|
*/
|
69
|
95
|
|
70
|
|
-#define PAGE_DONT_MOVE_MASK 0x00000100
|
|
96
|
+#define PAGE_DONT_MOVE_MASK (1 << (PAGE_BASE_BIT_SHIFT + 3))
|
71
|
97
|
#define PAGE_DONT_MOVE(page) \
|
72
|
98
|
(page_table[page].flags & PAGE_DONT_MOVE_MASK)
|
73
|
99
|
|
... |
... |
@@ -77,28 +103,13 @@ int gc_write_barrier(void *); |
77
|
103
|
* valid when the page is allocated.
|
78
|
104
|
*/
|
79
|
105
|
|
80
|
|
-#define PAGE_LARGE_OBJECT_MASK 0x00000200
|
81
|
|
-#define PAGE_LARGE_OBJECT_SHIFT 9
|
|
106
|
+#define PAGE_LARGE_OBJECT_SHIFT (PAGE_BASE_BIT_SHIFT + 4)
|
|
107
|
+#define PAGE_LARGE_OBJECT_MASK (1 << PAGE_LARGE_OBJECT_SHIFT)
|
82
|
108
|
#define PAGE_LARGE_OBJECT(page) \
|
83
|
109
|
(page_table[page].flags & PAGE_LARGE_OBJECT_MASK)
|
84
|
110
|
#define PAGE_LARGE_OBJECT_VAL(page) \
|
85
|
111
|
(PAGE_LARGE_OBJECT(page) >> PAGE_LARGE_OBJECT_SHIFT)
|
86
|
112
|
|
87
|
|
-/*
|
88
|
|
- * The generation that this page belongs to. This should be valid for
|
89
|
|
- * all pages that may have objects allocated, even current allocation
|
90
|
|
- * region pages - this allows the space of an object to be easily
|
91
|
|
- * determined.
|
92
|
|
- */
|
93
|
|
-
|
94
|
|
-#define PAGE_GENERATION_MASK 0x0000000f
|
95
|
|
-#define PAGE_GENERATION(page) \
|
96
|
|
- (page_table[page].flags & PAGE_GENERATION_MASK)
|
97
|
|
-
|
98
|
|
-#define PAGE_FLAGS(page, mask) (page_table[page].flags & (mask))
|
99
|
|
-#define PAGE_FLAGS_UPDATE(page, mmask, mflags) \
|
100
|
|
- (page_table[page].flags = (page_table[page].flags & ~(mmask)) | (mflags))
|
101
|
|
-
|
102
|
113
|
struct page {
|
103
|
114
|
/*
|
104
|
115
|
* Page flags.
|