From ff492f9bb6641bf65a55f8ff7b68d1604499832f Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Fri, 3 Jul 2015 12:40:26 -0600 Subject: [PATCH] add comments on how page alisngment --- racket/src/racket/gc2/vm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/racket/src/racket/gc2/vm.c b/racket/src/racket/gc2/vm.c index f5f3b05990..7a096a8162 100644 --- a/racket/src/racket/gc2/vm.c +++ b/racket/src/racket/gc2/vm.c @@ -17,7 +17,7 @@ enum { }; #if defined(_WIN32) || defined(__CYGWIN32__) -/* No block cache or alloc cache */ +/* No block cache or alloc cache; relies on APAGE_SIZE matching allocator's alignment */ #elif defined(OSKIT) # define OS_ALLOCATOR_NEEDS_ALIGNMENT #elif defined(MZ_USE_PLACES) || defined(PREFER_MMAP_LARGE_BLOCKS) @@ -30,6 +30,10 @@ enum { # define USE_ALLOC_CACHE #endif +/* Either USE_ALLOC_CACHE or OS_ALLOCATOR_NEEDS_ALIGNMENT must be + enabled, unless the lower-level allocator's alignment matches + APAGE_SIZE. */ + struct AllocCacheBlock; struct BlockCache; typedef struct MMU { @@ -78,7 +82,7 @@ static inline size_t mmu_round_up_to_os_page_size(MMU *mmu, size_t len) { static inline void mmu_assert_os_page_aligned(MMU *mmu, size_t p) { if (p & (mmu->os_pagesize - 1)) { - printf("address or size is not OS PAGE ALIGNED!!!!"); + GCPRINT(GCOUTF, "address or size is not page-aligned\n"); abort(); } }