ruby-changes:59548
From: Nobuyoshi <ko1@a...>
Date: Sun, 29 Dec 2019 12:35:17 +0900 (JST)
Subject: [ruby-changes:59548] d7bef803ac (master): Separate builtin initialization calls
https://git.ruby-lang.org/ruby.git/commit/?id=d7bef803ac From d7bef803ac3546119b30e1d78af0097a9df9c907 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sun, 29 Dec 2019 10:07:17 +0900 Subject: Separate builtin initialization calls diff --git a/ast.c b/ast.c index 3f7061a..18a9723 100644 --- a/ast.c +++ b/ast.c @@ -690,6 +690,4 @@ Init_ast(void) https://github.com/ruby/ruby/blob/trunk/ast.c#L690 rb_mAST = rb_define_module_under(rb_cRubyVM, "AbstractSyntaxTree"); rb_cNode = rb_define_class_under(rb_mAST, "Node", rb_cObject); rb_undef_alloc_func(rb_cNode); - - load_ast(); } diff --git a/error.c b/error.c index f99cdb6..fd6c8fe 100644 --- a/error.c +++ b/error.c @@ -3077,12 +3077,6 @@ Init_syserr(void) https://github.com/ruby/ruby/blob/trunk/error.c#L3077 #include "warning.rbinc" -void -Init_warning(void) -{ - load_warning(); -} - /*! * \} */ diff --git a/gc.c b/gc.c index 9747655..ccece5b 100644 --- a/gc.c +++ b/gc.c @@ -11868,7 +11868,6 @@ Init_GC(void) https://github.com/ruby/ruby/blob/trunk/gc.c#L11868 VALUE gc_constants; rb_mGC = rb_define_module("GC"); - load_gc(); gc_constants = rb_hash_new(); rb_hash_aset(gc_constants, ID2SYM(rb_intern("RVALUE_SIZE")), SIZET2NUM(sizeof(RVALUE))); diff --git a/inits.c b/inits.c index 72a2a98..b313d1d 100644 --- a/inits.c +++ b/inits.c @@ -12,6 +12,7 @@ https://github.com/ruby/ruby/blob/trunk/inits.c#L12 #include "internal/inits.h" #include "ruby.h" #include "builtin.h" +static void Init_builtin_prelude(void); #include "prelude.rbinc" #define CALL(n) {void Init_##n(void); Init_##n();} @@ -45,6 +46,7 @@ rb_call_inits(void) https://github.com/ruby/ruby/blob/trunk/inits.c#L46 CALL(Hash); CALL(Struct); CALL(Regexp); + CALL(pack); CALL(transcode); CALL(marshal); CALL(Range); @@ -57,6 +59,7 @@ rb_call_inits(void) https://github.com/ruby/ruby/blob/trunk/inits.c#L59 CALL(Proc); CALL(Binding); CALL(Math); + CALL(GC); CALL(Enumerator); CALL(VM); CALL(ISeq); @@ -66,18 +69,21 @@ rb_call_inits(void) https://github.com/ruby/ruby/blob/trunk/inits.c#L69 CALL(Rational); CALL(Complex); CALL(version); + CALL(vm_trace); CALL(vm_stack_canary); + CALL(ast); CALL(gc_stress); // enable builtin loading CALL(builtin); - CALL(GC); - CALL(IO_nonblock); - CALL(ast); - CALL(vm_trace); - CALL(pack); - CALL(warning); - load_prelude(); +#define BUILTIN(n) CALL(builtin_##n) + BUILTIN(gc); + BUILTIN(io); + BUILTIN(ast); + BUILTIN(trace_point); + BUILTIN(pack); + BUILTIN(warning); + Init_builtin_prelude(); } #undef CALL diff --git a/io.c b/io.c index 37109f5..a6a7dd3 100644 --- a/io.c +++ b/io.c @@ -13522,9 +13522,3 @@ Init_IO(void) https://github.com/ruby/ruby/blob/trunk/io.c#L13522 } #include "io.rbinc" - -void -Init_IO_nonblock(void) -{ - load_io(); -} diff --git a/pack.c b/pack.c index 8ba492f..3c63d64 100644 --- a/pack.c +++ b/pack.c @@ -1767,7 +1767,5 @@ utf8_to_uv(const char *p, long *lenp) https://github.com/ruby/ruby/blob/trunk/pack.c#L1767 void Init_pack(void) { - load_pack(); - id_associated = rb_make_internal_id(); } diff --git a/tool/mk_builtin_loader.rb b/tool/mk_builtin_loader.rb index 3d2a343..837f56d 100644 --- a/tool/mk_builtin_loader.rb +++ b/tool/mk_builtin_loader.rb @@ -166,7 +166,7 @@ def mk_builtin_header file https://github.com/ruby/ruby/blob/trunk/tool/mk_builtin_loader.rb#L166 end } - f.puts "static void load_#{base}(void)" + f.puts "void Init_builtin_#{base}(void)" f.puts "{" table = "#{base}_table" diff --git a/vm_trace.c b/vm_trace.c index 079795b..e72c618 100644 --- a/vm_trace.c +++ b/vm_trace.c @@ -1526,8 +1526,6 @@ Init_vm_trace(void) https://github.com/ruby/ruby/blob/trunk/vm_trace.c#L1526 rb_cTracePoint = rb_define_class("TracePoint", rb_cObject); rb_undef_alloc_func(rb_cTracePoint); - - load_trace_point(); } typedef struct rb_postponed_job_struct { -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/