From a3f9a3be68a4757a89f9678842f49a8e297f15f7 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Thu, 18 Feb 2016 18:58:32 +0900 Subject: [PATCH] remove WORD_BOXING mode --- extlib/benz/include/picrin/config.h | 100 ---------------------------- extlib/benz/include/picrin/setup.h | 16 +---- extlib/benz/include/picrin/type.h | 62 +---------------- 3 files changed, 4 insertions(+), 174 deletions(-) diff --git a/extlib/benz/include/picrin/config.h b/extlib/benz/include/picrin/config.h index e90684d0..2bbb920a 100644 --- a/extlib/benz/include/picrin/config.h +++ b/extlib/benz/include/picrin/config.h @@ -8,9 +8,6 @@ /** switch internal value representation */ /* #define PIC_NAN_BOXING 1 */ -/** enable word boxing */ -/* #define PIC_WORD_BOXING 0 */ - /** no dependency on libc */ /* #define PIC_ENABLE_LIBC 1 */ @@ -54,100 +51,3 @@ /* #define VM_DEBUG 1 */ /* #define GC_DEBUG 1 */ /* #define GC_DEBUG_DETAIL 1 */ - -#ifndef PIC_DIRECT_THREADED_VM -# if (defined(__GNUC__) || defined(__clang__)) && __STRICT_ANSI__ != 1 -# define PIC_DIRECT_THREADED_VM 1 -# endif -#endif - -#if PIC_NAN_BOXING && PIC_WORD_BOXING -# error cannot enable both PIC_NAN_BOXING and PIC_WORD_BOXING simultaneously -#endif - -#ifndef PIC_WORD_BOXING -# define PIC_WORD_BOXING 0 -#endif - -#if ! PIC_WORD_BOXING -# ifndef PIC_NAN_BOXING -# if __x86_64__ && (defined(__GNUC__) || defined(__clang__)) && __STRICT_ANSI__ != 1 -# define PIC_NAN_BOXING 1 -# endif -# endif -#endif - -#ifndef PIC_ENABLE_LIBC -# define PIC_ENABLE_LIBC 1 -#endif - -#ifndef PIC_ENABLE_STDIO -# define PIC_ENABLE_STDIO 1 -#endif - -#ifndef PIC_JMPBUF -# include -# define PIC_JMPBUF jmp_buf -#endif - -#ifndef PIC_SETJMP -# include -# define PIC_SETJMP(pic, buf) setjmp(buf) -#endif - -#ifndef PIC_LONGJMP -# include -# define PIC_LONGJMP(pic, buf, val) longjmp((buf), (val)) -#endif - -#ifndef PIC_ABORT -# define PIC_ABORT(pic) abort() -#endif - -#ifndef PIC_ARENA_SIZE -# define PIC_ARENA_SIZE (8 * 1024) -#endif - -#ifndef PIC_HEAP_PAGE_SIZE -# define PIC_HEAP_PAGE_SIZE (4 * 1024 * 1024) -#endif - -#ifndef PIC_PAGE_REQUEST_THRESHOLD -# define PIC_PAGE_REQUEST_THRESHOLD(total) ((total) * 77 / 100) -#endif - -#ifndef PIC_STACK_SIZE -# define PIC_STACK_SIZE 2048 -#endif - -#ifndef PIC_RESCUE_SIZE -# define PIC_RESCUE_SIZE 30 -#endif - -#ifndef PIC_SYM_POOL_SIZE -# define PIC_SYM_POOL_SIZE (2 * 1024) -#endif - -#ifndef PIC_IREP_SIZE -# define PIC_IREP_SIZE 8 -#endif - -#ifndef PIC_POOL_SIZE -# define PIC_POOL_SIZE 8 -#endif - -#ifndef PIC_SYMS_SIZE -# define PIC_SYMS_SIZE 32 -#endif - -#ifndef PIC_ISEQ_SIZE -# define PIC_ISEQ_SIZE 1024 -#endif - -#if DEBUG -# include -# define GC_STRESS 0 -# define VM_DEBUG 1 -# define GC_DEBUG 0 -# define GC_DEBUG_DETAIL 0 -#endif diff --git a/extlib/benz/include/picrin/setup.h b/extlib/benz/include/picrin/setup.h index ef10793f..47b97638 100644 --- a/extlib/benz/include/picrin/setup.h +++ b/extlib/benz/include/picrin/setup.h @@ -10,19 +10,9 @@ # endif #endif -#if PIC_NAN_BOXING && PIC_WORD_BOXING -# error cannot enable both PIC_NAN_BOXING and PIC_WORD_BOXING simultaneously -#endif - -#ifndef PIC_WORD_BOXING -# define PIC_WORD_BOXING 0 -#endif - -#if ! PIC_WORD_BOXING -# ifndef PIC_NAN_BOXING -# if __x86_64__ && (defined(__GNUC__) || defined(__clang__)) && __STRICT_ANSI__ != 1 -# define PIC_NAN_BOXING 1 -# endif +#ifndef PIC_NAN_BOXING +# if __x86_64__ && (defined(__GNUC__) || defined(__clang__)) && __STRICT_ANSI__ != 1 +# define PIC_NAN_BOXING 1 # endif #endif diff --git a/extlib/benz/include/picrin/type.h b/extlib/benz/include/picrin/type.h index de8e174f..1e93c372 100644 --- a/extlib/benz/include/picrin/type.h +++ b/extlib/benz/include/picrin/type.h @@ -72,46 +72,6 @@ pic_char(pic_value v) return v & 0xfffffffful; } -#elif PIC_WORD_BOXING - -typedef unsigned long pic_value; - -#define pic_ptr(v) ((void *)(v)) -#define pic_init_value(v,vtype) do { \ - v = (vtype << 3) + 7; \ - } while (0) - -PIC_INLINE enum pic_vtype -pic_vtype(pic_value v) -{ - if ((v & 1) == 0) { - return PIC_VTYPE_HEAP; - } - if ((v & 2) == 0) { - return PIC_VTYPE_INT; - } - if ((v & 4) == 0) { - return PIC_VTYPE_CHAR; - } - return v >> 3; -} - -PIC_INLINE int -pic_int(pic_value v) -{ - v >>= 2; - if ((v & ((ULONG_MAX >> 3) + 1)) != 0) { - v |= ULONG_MAX - (ULONG_MAX >> 2); - } - return v; -} - -PIC_INLINE char -pic_char(pic_value v) -{ - return v >> 3; -} - #else typedef struct { @@ -394,26 +354,6 @@ pic_char_value(char c) return v; } -#elif PIC_WORD_BOXING - -PIC_INLINE pic_value -pic_obj_value(void *ptr) -{ - return (pic_value)ptr; -} - -PIC_INLINE pic_value -pic_int_value(int i) -{ - return (i << 2) + 1; -} - -PIC_INLINE pic_value -pic_char_value(char c) -{ - return (c << 3) + 3; -} - #else PIC_INLINE pic_value @@ -476,7 +416,7 @@ pic_invalid_value() return v; } -#if PIC_NAN_BOXING || PIC_WORD_BOXING +#if PIC_NAN_BOXING PIC_INLINE bool pic_eq_p(pic_value x, pic_value y)