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

ruby-changes:39058

From: normal <ko1@a...>
Date: Sat, 4 Jul 2015 14:50:00 +0900 (JST)
Subject: [ruby-changes:39058] normal:r51139 (trunk): enum.c: remove volatile, use RB_GC_GUARD

normal	2015-07-04 14:49:35 +0900 (Sat, 04 Jul 2015)

  New Revision: 51139

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

  Log:
    enum.c: remove volatile, use RB_GC_GUARD
    
    volatile appears unnecessary in most cases as the VALUEs are used as
    arguments of uninlined functions.  Even worse, volatile can be
    insufficient in places where RB_GC_GUARD is necessary.
    
    * enum.c (zip_ary): remove volatile, use RB_GC_GUARD
      (zip_i): ditto

  Modified files:
    trunk/ChangeLog
    trunk/enum.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 51138)
+++ ChangeLog	(revision 51139)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Jul  4 14:38:43 2015  Eric Wong  <e@8...>
+
+	* enum.c (zip_ary): remove volatile, use RB_GC_GUARD
+	  (zip_i): ditto
+
 Sat Jul  4 10:42:57 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* lib/rubygems/test_case.rb (teardown): do not delete features
Index: enum.c
===================================================================
--- enum.c	(revision 51138)
+++ enum.c	(revision 51139)
@@ -2350,10 +2350,10 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/enum.c#L2350
 zip_ary(RB_BLOCK_CALL_FUNC_ARGLIST(val, memoval))
 {
     struct MEMO *memo = (struct MEMO *)memoval;
-    volatile VALUE result = memo->v1;
-    volatile VALUE args = memo->v2;
+    VALUE result = memo->v1;
+    VALUE args = memo->v2;
     long n = memo->u3.cnt++;
-    volatile VALUE tmp;
+    VALUE tmp;
     int i;
 
     tmp = rb_ary_new2(RARRAY_LEN(args) + 1);
@@ -2374,6 +2374,9 @@ zip_ary(RB_BLOCK_CALL_FUNC_ARGLIST(val, https://github.com/ruby/ruby/blob/trunk/enum.c#L2374
     else {
 	rb_ary_push(result, tmp);
     }
+
+    RB_GC_GUARD(args);
+
     return Qnil;
 }
 
@@ -2393,9 +2396,9 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/enum.c#L2396
 zip_i(RB_BLOCK_CALL_FUNC_ARGLIST(val, memoval))
 {
     struct MEMO *memo = (struct MEMO *)memoval;
-    volatile VALUE result = memo->v1;
-    volatile VALUE args = memo->v2;
-    volatile VALUE tmp;
+    VALUE result = memo->v1;
+    VALUE args = memo->v2;
+    VALUE tmp;
     int i;
 
     tmp = rb_ary_new2(RARRAY_LEN(args) + 1);
@@ -2422,6 +2425,9 @@ zip_i(RB_BLOCK_CALL_FUNC_ARGLIST(val, me https://github.com/ruby/ruby/blob/trunk/enum.c#L2425
     else {
 	rb_ary_push(result, tmp);
     }
+
+    RB_GC_GUARD(args);
+
     return Qnil;
 }
 

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

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