mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
gc.c: Load GC tuning settings earlier during boot.
* gc.c (ruby_gc_set_params): Accept safe_level argument so GC tuning settings can be applied before rb_safe_level() is available. * internal.h (rb_gc_set_params): ditto. * ruby.c (process_options): Apply GC tuning early during boot process so boot-time allocations can benefit. This also benefits any code loaded in via `ruby -r`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
46b4eca8e2
commit
53e0d4666c
4 changed files with 14 additions and 5 deletions
|
@ -1,3 +1,12 @@
|
|||
Thu Dec 5 09:07:59 2013 Aman Gupta <ruby@tmm1.net>
|
||||
|
||||
* gc.c (ruby_gc_set_params): Accept safe_level argument so GC tuning
|
||||
settings can be applied before rb_safe_level() is available.
|
||||
* internal.h (rb_gc_set_params): ditto.
|
||||
* ruby.c (process_options): Apply GC tuning early during boot process
|
||||
so boot-time allocations can benefit. This also benefits any code
|
||||
loaded in via `ruby -r`.
|
||||
|
||||
Wed Dec 4 13:02:13 2013 Aman Gupta <ruby@tmm1.net>
|
||||
|
||||
* vm_trace.c (rb_suppress_tracing): Fix initialization of stack
|
||||
|
|
6
gc.c
6
gc.c
|
@ -5386,9 +5386,9 @@ gc_set_initial_pages(void)
|
|||
*/
|
||||
|
||||
void
|
||||
ruby_gc_set_params(void)
|
||||
ruby_gc_set_params(int safe_level)
|
||||
{
|
||||
if (rb_safe_level() > 0) return;
|
||||
if (safe_level > 0) return;
|
||||
|
||||
/* RUBY_GC_HEAP_FREE_SLOTS */
|
||||
if (get_envparam_int ("RUBY_FREE_MIN", &gc_params.heap_free_slots, 0)) {
|
||||
|
@ -5419,7 +5419,7 @@ ruby_gc_set_params(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
RUBY_ALIAS_FUNCTION_VOID(rb_gc_set_params(void), ruby_gc_set_params, ())
|
||||
RUBY_ALIAS_FUNCTION_VOID(rb_gc_set_params(void), ruby_gc_set_params, (rb_safe_level()))
|
||||
|
||||
void
|
||||
rb_objspace_reachable_objects_from(VALUE obj, void (func)(VALUE, void *), void *data)
|
||||
|
|
|
@ -453,7 +453,7 @@ void *ruby_mimmalloc(size_t size);
|
|||
void ruby_mimfree(void *ptr);
|
||||
void rb_objspace_set_event_hook(const rb_event_flag_t event);
|
||||
void rb_gc_writebarrier_remember_promoted(VALUE obj);
|
||||
void ruby_gc_set_params(void);
|
||||
void ruby_gc_set_params(int safe_level);
|
||||
|
||||
#if defined(HAVE_MALLOC_USABLE_SIZE) || defined(HAVE_MALLOC_SIZE) || defined(_WIN32)
|
||||
#define ruby_sized_xrealloc(ptr, new_size, old_size) ruby_xrealloc(ptr, new_size)
|
||||
|
|
2
ruby.c
2
ruby.c
|
@ -1405,6 +1405,7 @@ process_options(int argc, char **argv, struct cmdline_options *opt)
|
|||
translit_char(RSTRING_PTR(opt->script_name), '\\', '/');
|
||||
#endif
|
||||
|
||||
ruby_gc_set_params(opt->safe_level);
|
||||
ruby_init_loadpath_safe(opt->safe_level);
|
||||
Init_enc();
|
||||
rb_enc_find_index("encdb");
|
||||
|
@ -1568,7 +1569,6 @@ process_options(int argc, char **argv, struct cmdline_options *opt)
|
|||
rb_define_readonly_boolean("$-a", opt->do_split);
|
||||
|
||||
rb_set_safe_level(opt->safe_level);
|
||||
ruby_gc_set_params();
|
||||
|
||||
return iseq;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue