From 5b40bb8d159c1432bb87973b2b5f42473dd0c623 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Wed, 14 Oct 2020 15:52:14 +0900 Subject: Avoid using C struct dump for test Ruby code. Files under `test/t` and `mrbgem/*/test` are for tests, not for actual execution. So symbols in those files need not to be pre-allocated. This change slightly reduce the memory consumption. --- mrbgems/mruby-test/driver.c | 4 ++-- mrbgems/mruby-test/mrbgem.rake | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'mrbgems/mruby-test') diff --git a/mrbgems/mruby-test/driver.c b/mrbgems/mruby-test/driver.c index 3bd52e175..f780e7e57 100644 --- a/mrbgems/mruby-test/driver.c +++ b/mrbgems/mruby-test/driver.c @@ -18,7 +18,7 @@ #include #include -extern const struct RProc mrbtest_assert_proc[]; +extern const uint8_t mrbtest_assert_irep[]; void mrbgemtest_init(mrb_state* mrb); void mrb_init_test_vformat(mrb_state* mrb); @@ -300,7 +300,7 @@ main(int argc, char **argv) } mrb_init_test_driver(mrb, verbose); - mrb_load_proc(mrb, mrbtest_assert_proc); + mrb_load_irep(mrb, mrbtest_assert_irep); mrbgemtest_init(mrb); ret = eval_test(mrb); mrb_close(mrb); diff --git a/mrbgems/mruby-test/mrbgem.rake b/mrbgems/mruby-test/mrbgem.rake index 9e8e4041f..0df683f7f 100644 --- a/mrbgems/mruby-test/mrbgem.rake +++ b/mrbgems/mruby-test/mrbgem.rake @@ -28,7 +28,7 @@ MRuby::Gem::Specification.new('mruby-test') do |spec| file assert_c => [assert_rb, build.mrbcfile] do |t| mkdir_p File.dirname(t.name) open(t.name, 'w') do |f| - mrbc.run f, assert_rb, 'mrbtest_assert_proc' + mrbc.run f, assert_rb, 'mrbtest_assert_irep', false end end @@ -56,12 +56,12 @@ MRuby::Gem::Specification.new('mruby-test') do |spec| f.puts %Q[ * All manual changes will get lost.] f.puts %Q[ */] if test_preload.nil? - f.puts %Q[extern const struct RProc mrbtest_assert_proc[];] + f.puts %Q[extern const uint8_t mrbtest_assert_irep[];] else - g.build.mrbc.run f, test_preload, "gem_test_#{g.funcname}_preload" + g.build.mrbc.run f, test_preload, "gem_test_irep_#{g.funcname}_preload", false end g.test_rbfiles.flatten.each_with_index do |rbfile, i| - g.build.mrbc.run f, rbfile, "gem_test_#{g.funcname}_#{i}_proc" + g.build.mrbc.run f, rbfile, "gem_test_irep_#{g.funcname}_#{i}", false end f.puts %Q[void mrb_#{g.funcname}_gem_test(mrb_state *mrb);] unless g.test_objs.empty? dep_list.each do |d| @@ -90,9 +90,9 @@ MRuby::Gem::Specification.new('mruby-test') do |spec| end f.puts %Q[ mrb_init_test_driver(mrb2, mrb_test(mrb_gv_get(mrb, mrb_intern_lit(mrb, "$mrbtest_verbose"))));] if test_preload.nil? - f.puts %Q[ mrb_load_proc(mrb2, mrbtest_assert_proc);] + f.puts %Q[ mrb_load_irep(mrb2, mrbtest_assert_irep);] else - f.puts %Q[ mrb_load_proc(mrb2, gem_test_#{g.funcname}_preload);] + f.puts %Q[ mrb_load_irep(mrb2, gem_test_irep_#{g.funcname}_preload);] end f.puts %Q[ if (mrb2->exc) {] f.puts %Q[ mrb_print_error(mrb2);] @@ -113,7 +113,7 @@ MRuby::Gem::Specification.new('mruby-test') do |spec| f.puts %Q[ mrb_#{g.funcname}_gem_test(mrb2);] if g.custom_test_init? - f.puts %Q[ mrb_load_proc(mrb2, gem_test_#{g.funcname}_#{i}_proc);] + f.puts %Q[ mrb_load_irep(mrb2, gem_test_irep_#{g.funcname}_#{i});] f.puts %Q[ ] f.puts %Q[ mrb_t_pass_result(mrb, mrb2);] -- cgit v1.2.3