enable bitmap gc only if available

This commit is contained in:
Yuichi Nishiwaki 2016-06-19 18:37:47 +09:00
parent c124a17a15
commit 9e0dd2cff9
2 changed files with 8 additions and 13 deletions

View File

@ -7,10 +7,6 @@
#include "picrin/private/khash.h"
#include "picrin/private/state.h"
#ifndef PIC_MEMALIGN
# error "bitmapgc requires PIC_MEMALIGN"
#endif
union header {
struct {
union header *ptr;
@ -294,7 +290,7 @@ heap_morecore(pic_state *pic)
assert(2 <= HEADER_SIZE);
if(PIC_MEMALIGN(pic, (void **)&page, PIC_HEAP_PAGE_SIZE, PIC_HEAP_PAGE_SIZE) != 0)
if (PIC_MEMALIGN(pic, (void **)&page, PIC_HEAP_PAGE_SIZE, PIC_HEAP_PAGE_SIZE) != 0)
pic_panic(pic, "memory exhausted");
memset(page->bitmap, 0, sizeof(page->bitmap));

View File

@ -165,14 +165,6 @@ typedef unsigned long uint32_t;
#include <assert.h>
#include <stdlib.h>
# ifndef PIC_MEMALIGN
# include <unistd.h>
# define PIC_MEMALIGN(pic, buf, alignment, size) posix_memalign(buf, alignment, size)
# endif
# ifndef PIC_USE_BITMAPGC
# define PIC_USE_BITMAPGC
# endif
#else
# define assert(v) (void)0
@ -468,3 +460,10 @@ double PIC_CSTRING_TO_DOUBLE(const char *);
#else
# define PIC_NAN_BOXING 0
#endif
#if PIC_USE_LIBC && (defined (__unix__) || (defined (__APPLE__) && defined (__MACH__)))
# include <unistd.h>
# define PIC_MEMALIGN(pic, buf, alignment, size) posix_memalign(buf, alignment, size)
# define PIC_USE_BITMAPGC 1
#endif