add comments on how page alisngment
This commit is contained in:
parent
331b104345
commit
ff492f9bb6
|
@ -17,7 +17,7 @@ enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(__CYGWIN32__)
|
#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)
|
#elif defined(OSKIT)
|
||||||
# define OS_ALLOCATOR_NEEDS_ALIGNMENT
|
# define OS_ALLOCATOR_NEEDS_ALIGNMENT
|
||||||
#elif defined(MZ_USE_PLACES) || defined(PREFER_MMAP_LARGE_BLOCKS)
|
#elif defined(MZ_USE_PLACES) || defined(PREFER_MMAP_LARGE_BLOCKS)
|
||||||
|
@ -30,6 +30,10 @@ enum {
|
||||||
# define USE_ALLOC_CACHE
|
# define USE_ALLOC_CACHE
|
||||||
#endif
|
#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 AllocCacheBlock;
|
||||||
struct BlockCache;
|
struct BlockCache;
|
||||||
typedef struct MMU {
|
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) {
|
static inline void mmu_assert_os_page_aligned(MMU *mmu, size_t p) {
|
||||||
if (p & (mmu->os_pagesize - 1)) {
|
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();
|
abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user