From 5e9eed2d0c70e77c683043e4f287162cf6e07ffe Mon Sep 17 00:00:00 2001 From: HASUMI Hitoshi Date: Thu, 19 Mar 2026 09:38:36 +0900 Subject: [PATCH] Fix KHASH_DEFAULT_SIZE to KHASH_INITIAL_SIZE rename inconsistencies Commit 250bf6edd renamed KHASH_DEFAULT_SIZE to KHASH_INITIAL_SIZE but missed updating build_config files and documentation. Also restore the default value in khash.h to 32, consistent with the documented default and the profile hierarchy (MRB_CONSTRAINED_BASELINE_PROFILE reduces it to 16). --- build_config/ArduinoDue.rb | 2 +- build_config/RX630.rb | 2 +- build_config/chipKITMax32.rb | 2 +- doc/guides/mrbconf.md | 6 +++--- include/mrbconf.h | 6 +++--- include/mruby/khash.h | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/build_config/ArduinoDue.rb b/build_config/ArduinoDue.rb index 2ddaf6740..94fdac034 100644 --- a/build_config/ArduinoDue.rb +++ b/build_config/ArduinoDue.rb @@ -30,7 +30,7 @@ MRuby::CrossBuild.new("ArduinoDue") do |conf| #configuration for low memory environment cc.defines << %w(MRB_HEAP_PAGE_SIZE=64) - cc.defines << %w(KHASH_DEFAULT_SIZE=8) + cc.defines << %w(KHASH_INITIAL_SIZE=8) cc.defines << %w(MRB_GC_STRESS) #cc.defines << %w(MRB_NO_STDIO) #if you don't need stdio. #cc.defines << %w(POOL_PAGE_SIZE=1000) #effective only for use with mruby-eval diff --git a/build_config/RX630.rb b/build_config/RX630.rb index c3aab1f8d..0f5f6fd96 100644 --- a/build_config/RX630.rb +++ b/build_config/RX630.rb @@ -16,7 +16,7 @@ MRuby::CrossBuild.new("RX630") do |conf| #configuration for low memory environment cc.defines << %w(MRB_USE_FLOAT32) cc.defines << %w(MRB_HEAP_PAGE_SIZE=64) - cc.defines << %w(KHASH_DEFAULT_SIZE=8) + cc.defines << %w(KHASH_INITIAL_SIZE=8) cc.defines << %w(MRB_GC_STRESS) cc.defines << %w(MRB_NO_STDIO) #if you don't need stdio. #cc.defines << %w(POOL_PAGE_SIZE=1000) #effective only for use with mruby-eval diff --git a/build_config/chipKITMax32.rb b/build_config/chipKITMax32.rb index 466db71d9..cde3edf36 100644 --- a/build_config/chipKITMax32.rb +++ b/build_config/chipKITMax32.rb @@ -27,7 +27,7 @@ MRuby::CrossBuild.new("chipKITMax32") do |conf| #configuration for low memory environment cc.defines << %w(MRB_HEAP_PAGE_SIZE=64) - cc.defines << %w(KHASH_DEFAULT_SIZE=8) + cc.defines << %w(KHASH_INITIAL_SIZE=8) cc.defines << %w(MRB_GC_STRESS) #cc.defines << %w(MRB_NO_STDIO) #if you don't need stdio. #cc.defines << %w(POOL_PAGE_SIZE=1000) #effective only for use with mruby-eval diff --git a/doc/guides/mrbconf.md b/doc/guides/mrbconf.md index e8644e48c..cc438653e 100644 --- a/doc/guides/mrbconf.md +++ b/doc/guides/mrbconf.md @@ -233,10 +233,10 @@ end - Specifies 4th argument(`argc`) max value of `mrb_funcall`. - Raises `ArgumentError` when the `argc` argument is bigger then this value `mrb_funcall`. -`KHASH_DEFAULT_SIZE` +`KHASH_INITIAL_SIZE` - Default value is `32`. -- Specifies default size of khash table bucket. +- Specifies initial size of khash table bucket. - Used in `kh_init_ ## name` function. `MRB_NO_METHOD_CACHE` @@ -272,7 +272,7 @@ deployment targets. Define one of the following: `MRB_CONSTRAINED_BASELINE_PROFILE` - For micro controllers. -- Enables `MRB_NO_METHOD_CACHE`, reduces `KHASH_DEFAULT_SIZE` to `16`, +- Enables `MRB_NO_METHOD_CACHE`, reduces `KHASH_INITIAL_SIZE` to `16`, and `MRB_HEAP_PAGE_SIZE` to `256`. `MRB_BASELINE_PROFILE` diff --git a/include/mrbconf.h b/include/mrbconf.h index ace38d73b..3e43efe77 100644 --- a/include/mrbconf.h +++ b/include/mrbconf.h @@ -139,7 +139,7 @@ //#define MRB_GC_TURN_OFF_GENERATIONAL /* default size of khash table bucket */ -//#define KHASH_DEFAULT_SIZE 32 +//#define KHASH_INITIAL_SIZE 32 /* allocated memory address alignment */ //#define POOL_ALIGNMENT 4 @@ -208,8 +208,8 @@ # define MRB_NO_METHOD_CACHE # endif -# ifndef KHASH_DEFAULT_SIZE -# define KHASH_DEFAULT_SIZE 16 +# ifndef KHASH_INITIAL_SIZE +# define KHASH_INITIAL_SIZE 16 # endif # ifndef MRB_HEAP_PAGE_SIZE diff --git a/include/mruby/khash.h b/include/mruby/khash.h index 4b846177d..8d7139e87 100644 --- a/include/mruby/khash.h +++ b/include/mruby/khash.h @@ -21,7 +21,7 @@ typedef uint32_t khint_t; typedef khint_t khiter_t; #ifndef KHASH_INITIAL_SIZE -# define KHASH_INITIAL_SIZE 8 +# define KHASH_INITIAL_SIZE 32 #endif #define KHASH_MIN_SIZE 8 #define KHASH_SMALL_LIMIT 4