Change default boxing scheme from MRB_NO_BOXING.

On 64bit platforms: `MRB_NAN_BOXING`
On 32bit platforms: `MRB_WORD_BOXING`
On debugging: `MRB_NO_BOXING`
This commit is contained in:
Yukihiro "Matz" Matsumoto
2020-08-05 07:52:15 +09:00
parent 84a68ca5ae
commit 1eb71b008f
3 changed files with 38 additions and 20 deletions
+34 -19
View File
@@ -53,25 +53,6 @@
# endif
#endif
/* add -DMRB_INT32 to use 32bit integer for mrb_int; conflict with MRB_INT64;
Default for 32-bit CPU mode. */
//#define MRB_INT32
/* add -DMRB_INT64 to use 64bit integer for mrb_int; conflict with MRB_INT32;
Default for 64-bit CPU mode. */
//#define MRB_INT64
/* if no specific integer type is chosen */
#if !defined(MRB_INT32) && !defined(MRB_INT64)
# if defined(MRB_64BIT) && !defined(MRB_NAN_BOXING)
/* Use 64bit integers on 64bit architecture (without MRB_NAN_BOXING) */
# define MRB_INT64
# else
/* Otherwise use 32bit integers */
# define MRB_INT32
# endif
#endif
/* define on big endian machines; used by MRB_NAN_BOXING, etc. */
#ifndef MRB_ENDIAN_BIG
# if (defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN) || \
@@ -86,6 +67,40 @@
/* represent mrb_value as a word (natural unit of data for the processor) */
//#define MRB_WORD_BOXING
/* with MRB_WORD_BOXING, embed float values in mrb_value (dropping 2 bit precision) */
//#define MRB_WBOX_FLOAT_INLINE
/* represent mrb_value as a struct; occupies 2 words */
//#define MRB_NO_BOXING
/* if no specific boxing type is chosen */
#if !defined(MRB_NAN_BOXING) && !defined(MRB_WORD_BOXING) && !defined(MRB_NO_BOXING)
# if defined(MRB_64BIT) && !defined(MRB_INT64)
# define MRB_NAN_BOXING
# else
# define MRB_WORD_BOXING
# endif
#endif
/* add -DMRB_INT32 to use 32bit integer for mrb_int; conflict with MRB_INT64;
Default for 32-bit CPU mode. */
//#define MRB_INT32
/* add -DMRB_INT64 to use 64bit integer for mrb_int; conflict with MRB_INT32;
Default for 64-bit CPU mode (unless using MRB_NAN_BOXING). */
//#define MRB_INT64
/* if no specific integer type is chosen */
#if !defined(MRB_INT32) && !defined(MRB_INT64)
# if defined(MRB_64BIT) && !defined(MRB_NAN_BOXING)
/* Use 64bit integers on 64bit architecture (without MRB_NAN_BOXING) */
# define MRB_INT64
# else
/* Otherwise use 32bit integers */
# define MRB_INT32
# endif
#endif
/* string class to handle UTF-8 encoding */
//#define MRB_UTF8_STRING
+3
View File
@@ -5,6 +5,9 @@ end
MRuby::Build.new('no_boxing') do |conf|
toolchain :gcc
conf.compilers.each do |c|
c.defines += %w(MRB_NO_BOXING)
end
conf.gembox 'default'
conf.enable_test
end
+1 -1
View File
@@ -14,7 +14,7 @@ MRuby::Build.new('host-debug') do |conf|
conf.gembox 'full-core'
# C compiler settings
conf.cc.defines = %w(MRB_ENABLE_DEBUG_HOOK)
conf.cc.defines = %w(MRB_ENABLE_DEBUG_HOOK MRB_NO_BOXING)
# Generate mruby debugger command (require mruby-eval)
conf.gem :core => "mruby-bin-debugger"