зеркало из https://github.com/github/ruby.git
[Feature #19785] Deprecate RUBY_GC_HEAP_INIT_SLOTS
This environment variable is replaced by `RUBY_GC_HEAP_INIT_SIZE_%d_SLOTS`, so it doesn't make sense to keep it.
This commit is contained in:
Родитель
487d91fde1
Коммит
9ea9f99248
2
NEWS.md
2
NEWS.md
|
@ -12,6 +12,7 @@ Note that each entry is kept to a minimum, see links for details.
|
|||
* A new `performance` warning category was introduced.
|
||||
They are not displayed by default even in verbose mode.
|
||||
Turn them on with `-W:performance` or `Warning[:performance] = true`. [[Feature #19538]]
|
||||
* The `RUBY_GC_HEAP_INIT_SLOTS` environment variable has been deprecated and removed. Environment variables `RUBY_GC_HEAP_INIT_SIZE_%d_SLOTS` should be used instead. [[Feature #19785]]
|
||||
|
||||
## Core classes updates
|
||||
|
||||
|
@ -164,3 +165,4 @@ changelog for details of the default gems or bundled gems.
|
|||
[Feature #19538]: https://bugs.ruby-lang.org/issues/19538
|
||||
[Feature #19591]: https://bugs.ruby-lang.org/issues/19591
|
||||
[Feature #19714]: https://bugs.ruby-lang.org/issues/19714
|
||||
[Feature #19785]: https://bugs.ruby-lang.org/issues/19785
|
||||
|
|
9
gc.c
9
gc.c
|
@ -11615,8 +11615,6 @@ gc_set_initial_pages(rb_objspace_t *objspace)
|
|||
/*
|
||||
* GC tuning environment variables
|
||||
*
|
||||
* * RUBY_GC_HEAP_INIT_SLOTS
|
||||
* - Initial allocation slots.
|
||||
* * RUBY_GC_HEAP_FREE_SLOTS
|
||||
* - Prepare at least this amount of slots after GC.
|
||||
* - Allocate slots if there are not enough slots.
|
||||
|
@ -11663,13 +11661,6 @@ ruby_gc_set_params(void)
|
|||
/* ok */
|
||||
}
|
||||
|
||||
/* RUBY_GC_HEAP_INIT_SLOTS */
|
||||
size_t global_init_slots = GC_HEAP_INIT_SLOTS;
|
||||
if (get_envparam_size("RUBY_GC_HEAP_INIT_SLOTS", &global_init_slots, 0)) {
|
||||
for (int i = 0; i < SIZE_POOL_COUNT; i++) {
|
||||
gc_params.size_pool_init_slots[i] = global_init_slots;
|
||||
}
|
||||
}
|
||||
gc_set_initial_pages(objspace);
|
||||
|
||||
get_envparam_double("RUBY_GC_HEAP_GROWTH_FACTOR", &gc_params.growth_factor, 1.0, 0.0, FALSE);
|
||||
|
|
7
ruby.c
7
ruby.c
|
@ -1738,6 +1738,13 @@ ruby_opt_init(ruby_cmdline_options_t *opt)
|
|||
|
||||
rb_warning_category_update(opt->warn.mask, opt->warn.set);
|
||||
|
||||
/* [Feature #19785] Warning for removed GC environment variable.
|
||||
* Remove this in Ruby 3.4. */
|
||||
if (getenv("RUBY_GC_HEAP_INIT_SLOTS")) {
|
||||
rb_warn_deprecated("The environment variable RUBY_GC_HEAP_INIT_SLOTS",
|
||||
"environment variables RUBY_GC_HEAP_INIT_SIZE_%d_SLOTS");
|
||||
}
|
||||
|
||||
#if USE_RJIT
|
||||
// rb_call_builtin_inits depends on RubyVM::RJIT.enabled?
|
||||
if (opt->rjit.on)
|
||||
|
|
|
@ -375,13 +375,9 @@ class TestGc < Test::Unit::TestCase
|
|||
env = {
|
||||
"RUBY_GC_HEAP_INIT_SLOTS" => "100"
|
||||
}
|
||||
assert_in_out_err([env, "-W0", "-e", "exit"], "", [], [], "[Bug #19284]")
|
||||
|
||||
env = {
|
||||
"RUBY_GC_MALLOC_LIMIT" => "60000000",
|
||||
"RUBY_GC_HEAP_INIT_SLOTS" => "100000"
|
||||
}
|
||||
assert_normal_exit("exit", "[ruby-core:39777]", :child_env => env)
|
||||
assert_in_out_err([env, "-W0", "-e", "exit"], "", [], [])
|
||||
assert_in_out_err([env, "-W:deprecated", "-e", "exit"], "", [],
|
||||
/The environment variable RUBY_GC_HEAP_INIT_SLOTS is deprecated; use environment variables RUBY_GC_HEAP_INIT_SIZE_%d_SLOTS instead/)
|
||||
|
||||
env = {}
|
||||
GC.stat_heap.each do |_, s|
|
||||
|
@ -389,26 +385,12 @@ class TestGc < Test::Unit::TestCase
|
|||
end
|
||||
assert_normal_exit("exit", "", :child_env => env)
|
||||
|
||||
env["RUBY_GC_HEAP_INIT_SLOTS"] = "100000"
|
||||
assert_normal_exit("exit", "", :child_env => env)
|
||||
|
||||
env = {}
|
||||
GC.stat_heap.each do |_, s|
|
||||
env["RUBY_GC_HEAP_INIT_SIZE_#{s[:slot_size]}_SLOTS"] = "0"
|
||||
end
|
||||
assert_normal_exit("exit", "", :child_env => env)
|
||||
|
||||
env = {
|
||||
"RUBYOPT" => "",
|
||||
"RUBY_GC_HEAP_INIT_SLOTS" => "100000"
|
||||
}
|
||||
assert_in_out_err([env, "-e", "exit"], "", [], [], "[ruby-core:39795]")
|
||||
assert_in_out_err([env, "-W0", "-e", "exit"], "", [], [], "[ruby-core:39795]")
|
||||
assert_in_out_err([env, "-W1", "-e", "exit"], "", [], [], "[ruby-core:39795]")
|
||||
assert_in_out_err([env, "-w", "-e", "exit"], "", [], /RUBY_GC_HEAP_INIT_SLOTS=100000/, "[ruby-core:39795]")
|
||||
# Value of GC_HEAP_INIT_SLOTS is 10000
|
||||
assert_in_out_err([env, "-w", "-e", "exit"], "", [], /\(default value: 10000\)/)
|
||||
|
||||
env = {
|
||||
"RUBY_GC_HEAP_GROWTH_FACTOR" => "2.0",
|
||||
"RUBY_GC_HEAP_GROWTH_MAX_SLOTS" => "10000"
|
||||
|
@ -417,15 +399,10 @@ class TestGc < Test::Unit::TestCase
|
|||
assert_in_out_err([env, "-w", "-e", "exit"], "", [], /RUBY_GC_HEAP_GROWTH_FACTOR=2.0/, "")
|
||||
assert_in_out_err([env, "-w", "-e", "exit"], "", [], /RUBY_GC_HEAP_GROWTH_MAX_SLOTS=10000/, "[ruby-core:57928]")
|
||||
|
||||
if use_rgengc?
|
||||
env = {
|
||||
"RUBY_GC_HEAP_INIT_SLOTS" => "100000",
|
||||
"RUBY_GC_HEAP_FREE_SLOTS" => "10000",
|
||||
"RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR" => "0.4",
|
||||
}
|
||||
assert_normal_exit("exit", "", :child_env => env)
|
||||
assert_in_out_err([env, "-w", "-e", "exit"], "", [], /RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=0\.4/, "")
|
||||
|
||||
if use_rgengc?
|
||||
# always full GC when RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR < 1.0
|
||||
assert_in_out_err([env, "--disable-gems", "-e", "GC.start; 1000_000.times{Object.new}; p(GC.stat[:minor_gc_count] < GC.stat[:major_gc_count])"], "", ['true'], //, "")
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче