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

ruby-changes:40018

From: ko1 <ko1@a...>
Date: Sat, 10 Oct 2015 15:34:41 +0900 (JST)
Subject: [ruby-changes:40018] ko1:r52099 (trunk): * import a github pull request

ko1	2015-10-10 15:34:24 +0900 (Sat, 10 Oct 2015)

  New Revision: 52099

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

  Log:
    * import a github pull request
      https://github.com/ruby/ruby/pull/1050
      by Kazuho Oku <kazuho@n...>.
      This pull request has the following commits.
    * gc.c: reduce # of args to 6 (max. of register args on x86-64) so
      that the `newobj_of_slowpass` can be called via TCO.
    * gc.c (newobj_of), string.c (str_duplicate): for performance,
      the hot functions must be inlined.
    * gc.c: for performance, preceding arguments of `.*newobj_of.*`
      must be same, so that the arg registers can be reused in case of
      TCO.

  Modified files:
    trunk/ChangeLog
    trunk/gc.c
    trunk/string.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 52098)
+++ ChangeLog	(revision 52099)
@@ -1,3 +1,21 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Oct 10 15:28:45 2015  Koichi Sasada  <ko1@a...>
+
+	* import a github pull request
+	  https://github.com/ruby/ruby/pull/1050
+	  by Kazuho Oku <kazuho@n...>.
+
+	  This pull request has the following commits.
+
+	* gc.c: reduce # of args to 6 (max. of register args on x86-64) so
+	  that the `newobj_of_slowpass` can be called via TCO.
+
+	* gc.c (newobj_of), string.c (str_duplicate): for performance,
+	  the hot functions must be inlined.
+
+	* gc.c: for performance, preceding arguments of `.*newobj_of.*`
+	  must be same, so that the arg registers can be reused in case of
+	  TCO.
+
 Sat Oct 10 08:52:21 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* ext/socket/udpsocket.c (udp_connect, udp_bind, udp_send): fix
Index: string.c
===================================================================
--- string.c	(revision 52098)
+++ string.c	(revision 52099)
@@ -1233,7 +1233,7 @@ str_replace(VALUE str, VALUE str2) https://github.com/ruby/ruby/blob/trunk/string.c#L1233
     return str;
 }
 
-static VALUE
+static inline VALUE
 str_duplicate(VALUE klass, VALUE str)
 {
     enum {embed_size = RSTRING_EMBED_LEN_MAX + 1};
Index: gc.c
===================================================================
--- gc.c	(revision 52098)
+++ gc.c	(revision 52099)
@@ -1784,10 +1784,10 @@ newobj_of_init(rb_objspace_t *objspace, https://github.com/ruby/ruby/blob/trunk/gc.c#L1784
     return obj;
 }
 
-NOINLINE(static VALUE newobj_of_slowpass(rb_objspace_t *objspace, VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3, int hook_needed));
+NOINLINE(static VALUE newobj_of_slowpass(VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3, rb_objspace_t *objspace));
 
 static VALUE
-newobj_of_slowpass(rb_objspace_t *objspace, VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3, int hook_needed)
+newobj_of_slowpass(VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3, rb_objspace_t *objspace)
 {
     VALUE obj;
 
@@ -1806,15 +1806,14 @@ newobj_of_slowpass(rb_objspace_t *objspa https://github.com/ruby/ruby/blob/trunk/gc.c#L1806
     }
 
     obj = heap_get_freeobj(objspace, heap_eden);
-    return newobj_of_init(objspace, klass, flags, v1, v2, v3, obj, hook_needed);
+    return newobj_of_init(objspace, klass, flags, v1, v2, v3, obj, gc_event_hook_needed_p(objspace, RUBY_INTERNAL_EVENT_NEWOBJ));
 }
 
-static VALUE
+static inline VALUE
 newobj_of(VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3)
 {
     rb_objspace_t *objspace = &rb_objspace;
     VALUE obj;
-    int hook_needed = gc_event_hook_needed_p(objspace, RUBY_INTERNAL_EVENT_NEWOBJ);
 
 #if GC_DEBUG_STRESS_TO_CLASS
     if (UNLIKELY(stress_to_class)) {
@@ -1826,12 +1825,12 @@ newobj_of(VALUE klass, VALUE flags, VALU https://github.com/ruby/ruby/blob/trunk/gc.c#L1825
     }
 #endif
 
-    if (LIKELY(!(during_gc || ruby_gc_stressful) && hook_needed == FALSE &&
+    if (LIKELY(!(during_gc || ruby_gc_stressful) && gc_event_hook_needed_p(objspace, RUBY_INTERNAL_EVENT_NEWOBJ) == FALSE &&
 	       (obj = heap_get_freeobj_head(objspace, heap_eden)) != Qfalse)) {
 	return newobj_of_init(objspace, klass, flags, v1, v2, v3, obj, FALSE);
     }
     else {
-	return newobj_of_slowpass(objspace, klass, flags, v1, v2, v3, hook_needed);
+	return newobj_of_slowpass(klass, flags, v1, v2, v3, objspace);
     }
 }
 

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

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