mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5c19a5fa24
commit
df11c9c5e2
2 changed files with 17 additions and 6 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Sat Jul 4 14:38:43 2015 Eric Wong <e@80x24.org>
|
||||||
|
|
||||||
|
* enum.c (zip_ary): remove volatile, use RB_GC_GUARD
|
||||||
|
(zip_i): ditto
|
||||||
|
|
||||||
Sat Jul 4 10:42:57 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sat Jul 4 10:42:57 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* lib/rubygems/test_case.rb (teardown): do not delete features
|
* lib/rubygems/test_case.rb (teardown): do not delete features
|
||||||
|
|
18
enum.c
18
enum.c
|
@ -2350,10 +2350,10 @@ static VALUE
|
||||||
zip_ary(RB_BLOCK_CALL_FUNC_ARGLIST(val, memoval))
|
zip_ary(RB_BLOCK_CALL_FUNC_ARGLIST(val, memoval))
|
||||||
{
|
{
|
||||||
struct MEMO *memo = (struct MEMO *)memoval;
|
struct MEMO *memo = (struct MEMO *)memoval;
|
||||||
volatile VALUE result = memo->v1;
|
VALUE result = memo->v1;
|
||||||
volatile VALUE args = memo->v2;
|
VALUE args = memo->v2;
|
||||||
long n = memo->u3.cnt++;
|
long n = memo->u3.cnt++;
|
||||||
volatile VALUE tmp;
|
VALUE tmp;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
tmp = rb_ary_new2(RARRAY_LEN(args) + 1);
|
tmp = rb_ary_new2(RARRAY_LEN(args) + 1);
|
||||||
|
@ -2374,6 +2374,9 @@ zip_ary(RB_BLOCK_CALL_FUNC_ARGLIST(val, memoval))
|
||||||
else {
|
else {
|
||||||
rb_ary_push(result, tmp);
|
rb_ary_push(result, tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RB_GC_GUARD(args);
|
||||||
|
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2393,9 +2396,9 @@ static VALUE
|
||||||
zip_i(RB_BLOCK_CALL_FUNC_ARGLIST(val, memoval))
|
zip_i(RB_BLOCK_CALL_FUNC_ARGLIST(val, memoval))
|
||||||
{
|
{
|
||||||
struct MEMO *memo = (struct MEMO *)memoval;
|
struct MEMO *memo = (struct MEMO *)memoval;
|
||||||
volatile VALUE result = memo->v1;
|
VALUE result = memo->v1;
|
||||||
volatile VALUE args = memo->v2;
|
VALUE args = memo->v2;
|
||||||
volatile VALUE tmp;
|
VALUE tmp;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
tmp = rb_ary_new2(RARRAY_LEN(args) + 1);
|
tmp = rb_ary_new2(RARRAY_LEN(args) + 1);
|
||||||
|
@ -2422,6 +2425,9 @@ zip_i(RB_BLOCK_CALL_FUNC_ARGLIST(val, memoval))
|
||||||
else {
|
else {
|
||||||
rb_ary_push(result, tmp);
|
rb_ary_push(result, tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RB_GC_GUARD(args);
|
||||||
|
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue