[Git][cmucl/cmucl][master] 2 commits: Address #89: Clean up page flags
Raymond Toy (@rtoy)
gitlab at common-lisp.net
Sat May 8 22:13:06 UTC 2021
Raymond Toy pushed to branch master at cmucl / cmucl
Commits:
cb529aaf by Raymond Toy at 2021-05-08T22:12:59+00:00
Address #89: Clean up page flags
- - - - -
2589cd0c by Raymond Toy at 2021-05-08T22:13:00+00:00
Merge branch 'issue-89-update-page-flags' into 'master'
Address #89: Clean up page flags
See merge request cmucl/cmucl!61
- - - - -
1 changed file:
- src/lisp/gencgc.h
Changes:
=====================================
src/lisp/gencgc.h
=====================================
@@ -35,13 +35,39 @@ int gc_write_barrier(void *);
*/
#define PAGE_NEEDS_ZEROING_MARKER 0xdead0000
+/*
+ * The various fields packed into the struct page flags member.
+ */
+
+/*
+ * The generation that this page belongs to. This should be valid for
+ * all pages that may have objects allocated, even current allocation
+ * region pages - this allows the space of an object to be easily
+ * determined.
+ */
+
+#define PAGE_GENERATION_MASK 0x0000000f
+#define PAGE_GENERATION(page) \
+ (page_table[page].flags & PAGE_GENERATION_MASK)
+
+#define PAGE_FLAGS(page, mask) (page_table[page].flags & (mask))
+#define PAGE_FLAGS_UPDATE(page, mmask, mflags) \
+ (page_table[page].flags = (page_table[page].flags & ~(mmask)) | (mflags))
+
+
+/*
+ * After the generation, we have a set of bits. This defines the
+ * location of the first of the bit fields.
+ */
+#define PAGE_BASE_BIT_SHIFT 4
+
/*
* Set when the page is write protected. If it is writen into it is
* made writable and this flag is cleared. This should always reflect
* the actual write_protect status of a page.
*/
-#define PAGE_WRITE_PROTECTED_MASK 0x00000010
+#define PAGE_WRITE_PROTECTED_MASK (1 << PAGE_BASE_BIT_SHIFT)
#define PAGE_WRITE_PROTECTED(page) \
(page_table[page].flags & PAGE_WRITE_PROTECTED_MASK)
@@ -51,14 +77,14 @@ int gc_write_barrier(void *);
* the bytes_used must be 0.
*/
-#define PAGE_ALLOCATED_MASK 0x00000040
+#define PAGE_ALLOCATED_MASK (1 << (PAGE_BASE_BIT_SHIFT + 1))
#define PAGE_ALLOCATED(page) (page_table[page].flags & PAGE_ALLOCATED_MASK)
/*
* Unboxed region flag: 1 for unboxed objects, 0 for boxed objects.
*/
-#define PAGE_UNBOXED_MASK 0x00000080
-#define PAGE_UNBOXED_SHIFT 7
+#define PAGE_UNBOXED_SHIFT (PAGE_BASE_BIT_SHIFT + 2)
+#define PAGE_UNBOXED_MASK (1 << PAGE_UNBOXED_SHIFT)
#define PAGE_UNBOXED(page) (page_table[page].flags & PAGE_UNBOXED_MASK)
#define PAGE_UNBOXED_VAL(page) (PAGE_UNBOXED(page) >> PAGE_UNBOXED_SHIFT)
@@ -67,7 +93,7 @@ int gc_write_barrier(void *);
* set. It's only valid during a GC for allocated pages.
*/
-#define PAGE_DONT_MOVE_MASK 0x00000100
+#define PAGE_DONT_MOVE_MASK (1 << (PAGE_BASE_BIT_SHIFT + 3))
#define PAGE_DONT_MOVE(page) \
(page_table[page].flags & PAGE_DONT_MOVE_MASK)
@@ -77,28 +103,13 @@ int gc_write_barrier(void *);
* valid when the page is allocated.
*/
-#define PAGE_LARGE_OBJECT_MASK 0x00000200
-#define PAGE_LARGE_OBJECT_SHIFT 9
+#define PAGE_LARGE_OBJECT_SHIFT (PAGE_BASE_BIT_SHIFT + 4)
+#define PAGE_LARGE_OBJECT_MASK (1 << PAGE_LARGE_OBJECT_SHIFT)
#define PAGE_LARGE_OBJECT(page) \
(page_table[page].flags & PAGE_LARGE_OBJECT_MASK)
#define PAGE_LARGE_OBJECT_VAL(page) \
(PAGE_LARGE_OBJECT(page) >> PAGE_LARGE_OBJECT_SHIFT)
-/*
- * The generation that this page belongs to. This should be valid for
- * all pages that may have objects allocated, even current allocation
- * region pages - this allows the space of an object to be easily
- * determined.
- */
-
-#define PAGE_GENERATION_MASK 0x0000000f
-#define PAGE_GENERATION(page) \
- (page_table[page].flags & PAGE_GENERATION_MASK)
-
-#define PAGE_FLAGS(page, mask) (page_table[page].flags & (mask))
-#define PAGE_FLAGS_UPDATE(page, mmask, mflags) \
- (page_table[page].flags = (page_table[page].flags & ~(mmask)) | (mflags))
-
struct page {
/*
* Page flags.
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/545c960df893ce176fc899823188060f2814d350...2589cd0c29215133eac897d10f6f880d76bc1b75
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/545c960df893ce176fc899823188060f2814d350...2589cd0c29215133eac897d10f6f880d76bc1b75
You're receiving this email because of your account on gitlab.common-lisp.net.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cmucl-cvs/attachments/20210508/500a73d1/attachment-0001.html>
More information about the cmucl-cvs
mailing list