summaryrefslogtreecommitdiff
path: root/include/mimalloc-internal.h
diff options
context:
space:
mode:
authordaan <daan@microsoft.com>2019-08-23 14:08:00 -0700
committerdaan <daanl@outlook.com>2019-08-23 21:42:24 -0700
commit6c6fcad242ebedba6ee07cff2d255457eb811bb8 (patch)
tree1ddb6d6106dc1bd32ef538da545e4c5c7580dd09 /include/mimalloc-internal.h
parent15552eba790e7a7e6d8477236c7c51fdb9288ee0 (diff)
remove threadid from pages and keep page flags separate (cherry picked)
Diffstat (limited to 'include/mimalloc-internal.h')
-rw-r--r--include/mimalloc-internal.h25
1 files changed, 5 insertions, 20 deletions
diff --git a/include/mimalloc-internal.h b/include/mimalloc-internal.h
index 6455d57..d886bce 100644
--- a/include/mimalloc-internal.h
+++ b/include/mimalloc-internal.h
@@ -315,39 +315,24 @@ static inline mi_page_queue_t* mi_page_queue(const mi_heap_t* heap, size_t size)
}
+
//-----------------------------------------------------------
// Page flags
//-----------------------------------------------------------
-static inline uintptr_t mi_page_thread_id(const mi_page_t* page) {
- return (page->flags & ~MI_PAGE_FLAGS_MASK);
-}
-
-static inline void mi_page_init_flags(mi_page_t* page, uintptr_t thread_id) {
- mi_assert_internal((thread_id & MI_PAGE_FLAGS_MASK) == 0);
- page->flags = thread_id;
-}
-
-static inline void mi_page_set_thread_id(mi_page_t* page, uintptr_t thread_id) {
- mi_assert_internal((thread_id & MI_PAGE_FLAGS_MASK) == 0);
- page->flags = thread_id | (page->flags & MI_PAGE_FLAGS_MASK);
-}
-
static inline bool mi_page_is_in_full(const mi_page_t* page) {
- return ((page->flags & 0x01) != 0);
+ return page->flags.in_full;
}
static inline void mi_page_set_in_full(mi_page_t* page, bool in_full) {
- if (in_full) page->flags |= 0x01;
- else page->flags &= ~0x01;
+ page->flags.in_full = in_full;
}
static inline bool mi_page_has_aligned(const mi_page_t* page) {
- return ((page->flags & 0x02) != 0);
+ return page->flags.has_aligned;
}
static inline void mi_page_set_has_aligned(mi_page_t* page, bool has_aligned) {
- if (has_aligned) page->flags |= 0x02;
- else page->flags &= ~0x02;
+ page->flags.has_aligned = has_aligned;
}