[前][次][番号順一覧][スレッド一覧]

ruby-changes:31912

From: tmm1 <ko1@a...>
Date: Thu, 5 Dec 2013 09:19:19 +0900 (JST)
Subject: [ruby-changes:31912] tmm1:r43991 (trunk): gc.c: Load GC tuning settings earlier during boot.

tmm1	2013-12-05 09:19:13 +0900 (Thu, 05 Dec 2013)

  New Revision: 43991

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43991

  Log:
    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`.

  Modified files:
    trunk/ChangeLog
    trunk/gc.c
    trunk/internal.h
    trunk/ruby.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 43990)
+++ ChangeLog	(revision 43991)
@@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Dec  5 09:07:59 2013  Aman Gupta <ruby@t...>
+
+	* 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@t...>
 
 	* vm_trace.c (rb_suppress_tracing): Fix initialization of stack
Index: gc.c
===================================================================
--- gc.c	(revision 43990)
+++ gc.c	(revision 43991)
@@ -5386,9 +5386,9 @@ gc_set_initial_pages(void) https://github.com/ruby/ruby/blob/trunk/gc.c#L5386
  */
 
 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) https://github.com/ruby/ruby/blob/trunk/gc.c#L5419
 #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)
Index: internal.h
===================================================================
--- internal.h	(revision 43990)
+++ internal.h	(revision 43991)
@@ -453,7 +453,7 @@ void *ruby_mimmalloc(size_t size); https://github.com/ruby/ruby/blob/trunk/internal.h#L453
 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)
Index: ruby.c
===================================================================
--- ruby.c	(revision 43990)
+++ ruby.c	(revision 43991)
@@ -1405,6 +1405,7 @@ process_options(int argc, char **argv, s https://github.com/ruby/ruby/blob/trunk/ruby.c#L1405
     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, s https://github.com/ruby/ruby/blob/trunk/ruby.c#L1569
     rb_define_readonly_boolean("$-a", opt->do_split);
 
     rb_set_safe_level(opt->safe_level);
-    ruby_gc_set_params();
 
     return iseq;
 }

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]