mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
move RB_GC_GUARD responsibility to rb_add_method_iseq
This simplifies all the callers and makes code easier to use and review. I was confused about the need for RB_GC_GUARD in define_{aset,aref}_method of struct.c without reading rb_add_method_iseq. Likewise, do the same for rb_iseq_clone, where the GC guard only seems neccesary iff RGenGC is disabled. * vm_method.c (rb_add_method_iseq): add RB_GC_GUARD * class.c (clone_method): remove RB_GC_GUARD * struct.c (define_aref_method): ditto (define_aset_method): ditto * vm.c (vm_define_method): * iseq.c (rb_iseq_clone): add RB_GC_GUARD git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c7548028a2
commit
b49075cdf1
6 changed files with 13 additions and 4 deletions
2
struct.c
2
struct.c
|
@ -288,7 +288,6 @@ define_aref_method(VALUE nstr, VALUE name, VALUE off)
|
|||
VALUE iseqval = rb_method_for_self_aref(name, off, rb_vm_opt_struct_aref);
|
||||
|
||||
rb_add_method_iseq(nstr, SYM2ID(name), iseqval, NULL, METHOD_VISI_PUBLIC);
|
||||
RB_GC_GUARD(iseqval);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -298,7 +297,6 @@ define_aset_method(VALUE nstr, VALUE name, VALUE off)
|
|||
VALUE iseqval = rb_method_for_self_aset(name, off, rb_vm_opt_struct_aset);
|
||||
|
||||
rb_add_method_iseq(nstr, SYM2ID(name), iseqval, NULL, METHOD_VISI_PUBLIC);
|
||||
RB_GC_GUARD(iseqval);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue