use compiled binary for gem_prelude.rb.
`gem_prelude.rb` is not compiled yet. This patch compile it to compiled binary.
This commit is contained in:
parent
943f3e5fd4
commit
2c5c60754c
Notes:
git
2019-12-11 11:25:19 +09:00
@ -39,5 +39,11 @@ rb_load_with_builtin_functions(const char *feature_name, const struct rb_builtin
|
|||||||
void
|
void
|
||||||
Init_builtin(void)
|
Init_builtin(void)
|
||||||
{
|
{
|
||||||
//
|
// nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Init_builtin_features(void)
|
||||||
|
{
|
||||||
|
rb_load_with_builtin_functions("gem_prelude", NULL);
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ GOLFOBJS = goruby.$(OBJEXT) golf_prelude.$(OBJEXT)
|
|||||||
|
|
||||||
DEFAULT_PRELUDES = $(GEM_PRELUDE)
|
DEFAULT_PRELUDES = $(GEM_PRELUDE)
|
||||||
PRELUDE_SCRIPTS = $(DEFAULT_PRELUDES)
|
PRELUDE_SCRIPTS = $(DEFAULT_PRELUDES)
|
||||||
GEM_PRELUDE = $(srcdir)/gem_prelude.rb
|
GEM_PRELUDE =
|
||||||
PRELUDES = {$(srcdir)}prelude.c {$(srcdir)}miniprelude.c
|
PRELUDES = {$(srcdir)}prelude.c {$(srcdir)}miniprelude.c
|
||||||
GOLFPRELUDES = {$(srcdir)}golf_prelude.c
|
GOLFPRELUDES = {$(srcdir)}golf_prelude.c
|
||||||
|
|
||||||
@ -1003,6 +1003,7 @@ BUILTIN_RB_SRCS = \
|
|||||||
$(srcdir)/pack.rb \
|
$(srcdir)/pack.rb \
|
||||||
$(srcdir)/trace_point.rb \
|
$(srcdir)/trace_point.rb \
|
||||||
$(srcdir)/prelude.rb \
|
$(srcdir)/prelude.rb \
|
||||||
|
$(srcdir)/gem_prelude.rb \
|
||||||
$(empty)
|
$(empty)
|
||||||
BUILTIN_RB_INCS = $(BUILTIN_RB_SRCS:.rb=.rbinc)
|
BUILTIN_RB_INCS = $(BUILTIN_RB_SRCS:.rb=.rbinc)
|
||||||
|
|
||||||
|
@ -2395,9 +2395,6 @@ RUBY_FUNC_NONNULL(1, bool rb_method_basic_definition_p_with_cc(struct rb_call_da
|
|||||||
})
|
})
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* miniprelude.c, prelude.c */
|
|
||||||
void Init_prelude(void);
|
|
||||||
|
|
||||||
/* vm_backtrace.c */
|
/* vm_backtrace.c */
|
||||||
void Init_vm_backtrace(void);
|
void Init_vm_backtrace(void);
|
||||||
VALUE rb_vm_thread_backtrace(int argc, const VALUE *argv, VALUE thval);
|
VALUE rb_vm_thread_backtrace(int argc, const VALUE *argv, VALUE thval);
|
||||||
|
@ -6,11 +6,10 @@
|
|||||||
// included from miniinit.c
|
// included from miniinit.c
|
||||||
|
|
||||||
static struct st_table *loaded_builtin_table;
|
static struct st_table *loaded_builtin_table;
|
||||||
|
|
||||||
rb_ast_t *rb_builtin_ast(const char *feature_name, VALUE *name_str);
|
rb_ast_t *rb_builtin_ast(const char *feature_name, VALUE *name_str);
|
||||||
|
|
||||||
void
|
static const rb_iseq_t *
|
||||||
rb_load_with_builtin_functions(const char *feature_name, const struct rb_builtin_function *table)
|
builtin_iseq_load(const char *feature_name, const struct rb_builtin_function *table)
|
||||||
{
|
{
|
||||||
VALUE name_str = 0;
|
VALUE name_str = 0;
|
||||||
rb_ast_t *ast = rb_builtin_ast(feature_name, &name_str);
|
rb_ast_t *ast = rb_builtin_ast(feature_name, &name_str);
|
||||||
@ -26,11 +25,16 @@ rb_load_with_builtin_functions(const char *feature_name, const struct rb_builtin
|
|||||||
rb_io_write(rb_stdout, rb_iseq_disasm((const rb_iseq_t *)iseq));
|
rb_io_write(rb_stdout, rb_iseq_disasm((const rb_iseq_t *)iseq));
|
||||||
}
|
}
|
||||||
|
|
||||||
// register (loaded iseq will not be freed)
|
|
||||||
st_insert(loaded_builtin_table, (st_data_t)feature_name, (st_data_t)iseq);
|
st_insert(loaded_builtin_table, (st_data_t)feature_name, (st_data_t)iseq);
|
||||||
rb_gc_register_mark_object((VALUE)iseq);
|
rb_gc_register_mark_object((VALUE)iseq);
|
||||||
|
|
||||||
// eval
|
return iseq;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
rb_load_with_builtin_functions(const char *feature_name, const struct rb_builtin_function *table)
|
||||||
|
{
|
||||||
|
const rb_iseq_t *iseq = builtin_iseq_load(feature_name, table);
|
||||||
rb_iseq_eval(iseq);
|
rb_iseq_eval(iseq);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,3 +62,10 @@ Init_builtin(void)
|
|||||||
rb_define_singleton_method(rb_cRubyVM, "each_builtin", each_builtin, 0);
|
rb_define_singleton_method(rb_cRubyVM, "each_builtin", each_builtin, 0);
|
||||||
loaded_builtin_table = st_init_strtable();
|
loaded_builtin_table = st_init_strtable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Init_builtin_features(void)
|
||||||
|
{
|
||||||
|
// register for ruby
|
||||||
|
builtin_iseq_load("gem_prelude", NULL);
|
||||||
|
}
|
||||||
|
4
ruby.c
4
ruby.c
@ -1408,10 +1408,12 @@ proc_options(long argc, char **argv, ruby_cmdline_options_t *opt, int envopt)
|
|||||||
return argc0 - argc;
|
return argc0 - argc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Init_builtin_features(void);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ruby_init_prelude(void)
|
ruby_init_prelude(void)
|
||||||
{
|
{
|
||||||
Init_prelude();
|
Init_builtin_features();
|
||||||
rb_const_remove(rb_cObject, rb_intern_const("TMP_RUBY_PREFIX"));
|
rb_const_remove(rb_cObject, rb_intern_const("TMP_RUBY_PREFIX"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ class Prelude
|
|||||||
@builtin_count = 0
|
@builtin_count = 0
|
||||||
@preludes = {}
|
@preludes = {}
|
||||||
@mains = preludes.map do |filename|
|
@mains = preludes.map do |filename|
|
||||||
if prelude = filename.end_with?("_prelude.rb")
|
if prelude = filename.end_with?("golf_prelude.rb")
|
||||||
@prelude_count += 1
|
@prelude_count += 1
|
||||||
else
|
else
|
||||||
@builtin_count += 1
|
@builtin_count += 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user