Project

General

Profile

Bug #17652 » ruby-cygwin-rb_aligned_malloc.patch

xtkoba (Tee KOBAYASHI), 02/27/2021 12:13 AM

View differences:

gc.c
} rb_objspace_t;
/* default tiny heap size: 16KB */
/* default tiny heap size: 64KB for Cygwin, 16KB otherwise */
#if defined __CYGWIN__
#define HEAP_PAGE_ALIGN_LOG 16
#else
#define HEAP_PAGE_ALIGN_LOG 14
#endif
#define CEILDIV(i, mod) (((i) + (mod) - 1)/(mod))
enum {
HEAP_PAGE_ALIGN = (1UL << HEAP_PAGE_ALIGN_LOG),
......
}
char *aligned = ptr + alignment;
aligned -= ((VALUE)aligned & (alignment - 1));
GC_ASSERT(aligned > ptr);
GC_ASSERT(aligned <= ptr + alignment);
aligned -= (((VALUE)aligned - 1) & (alignment - 1)) + 1;
GC_ASSERT(aligned >= ptr);
GC_ASSERT(aligned < ptr + alignment);
size_t start_out_of_range_size = aligned - ptr;
GC_ASSERT(start_out_of_range_size % sysconf(_SC_PAGE_SIZE) == 0);
(2-2/2)