ruby-changes:38650
From: ko1 <ko1@a...>
Date: Tue, 2 Jun 2015 23:32:47 +0900 (JST)
Subject: [ruby-changes:38650] ko1:r50731 (trunk): * method.h: remove rb_method_iseq_t::iseqval.
ko1 2015-06-02 23:32:33 +0900 (Tue, 02 Jun 2015) New Revision: 50731 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50731 Log: * method.h: remove rb_method_iseq_t::iseqval. While making a r50728, iseqval is needed (to mark correctly), but now just iseqptr is enough. * class.c: catch up this fix. * gc.c: ditto. * proc.c: ditto. * vm_method.c: ditto. Modified files: trunk/ChangeLog trunk/class.c trunk/gc.c trunk/method.h trunk/proc.c trunk/vm_method.c Index: method.h =================================================================== --- method.h (revision 50730) +++ method.h (revision 50731) @@ -74,7 +74,6 @@ typedef struct rb_iseq_struct rb_iseq_t; https://github.com/ruby/ruby/blob/trunk/method.h#L74 typedef struct rb_method_iseq_struct { rb_iseq_t * const iseqptr; /* should be separated from iseqval */ rb_cref_t * const cref; /* shoudl be marked */ - const VALUE iseqval; /* should be marked */ } rb_method_iseq_t; typedef struct rb_method_cfunc_struct { @@ -120,7 +119,7 @@ typedef struct rb_method_definition_stru https://github.com/ruby/ruby/blob/trunk/method.h#L119 UNDEFINED_METHOD_ENTRY_P((def)->body.orig_me)) void rb_add_method_cfunc(VALUE klass, ID mid, VALUE (*func)(ANYARGS), int argc, rb_method_flag_t noex); -void rb_add_method_iseq(VALUE klass, ID mid, VALUE iseq, rb_cref_t *cref, rb_method_flag_t noex); +void rb_add_method_iseq(VALUE klass, ID mid, VALUE iseqval, rb_cref_t *cref, rb_method_flag_t noex); rb_method_entry_t *rb_add_method(VALUE klass, ID mid, rb_method_type_t type, void *option, rb_method_flag_t noex); rb_method_entry_t *rb_method_entry(VALUE klass, ID id, VALUE *define_class_ptr); rb_method_entry_t *rb_method_entry_at(VALUE obj, ID id); Index: ChangeLog =================================================================== --- ChangeLog (revision 50730) +++ ChangeLog (revision 50731) @@ -1,3 +1,17 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue Jun 2 23:27:18 2015 Koichi Sasada <ko1@a...> + + * method.h: remove rb_method_iseq_t::iseqval. + While making a r50728, iseqval is needed (to mark correctly), + but now just iseqptr is enough. + + * class.c: catch up this fix. + + * gc.c: ditto. + + * proc.c: ditto. + + * vm_method.c: ditto. + Tue Jun 2 21:29:28 2015 Koichi Sasada <ko1@a...> * proc.c (proc_curry): remove a debug line. Index: proc.c =================================================================== --- proc.c (revision 50730) +++ proc.c (revision 50731) @@ -2046,8 +2046,7 @@ rb_method_entry_min_max_arity(const rb_m https://github.com/ruby/ruby/blob/trunk/proc.c#L2046 case VM_METHOD_TYPE_BMETHOD: return rb_proc_min_max_arity(def->body.proc, max); case VM_METHOD_TYPE_ISEQ: { - rb_iseq_t *iseq; - GetISeqPtr(def->body.iseq.iseqval, iseq); + rb_iseq_t *iseq = def->body.iseq.iseqptr; return rb_iseq_min_max_arity(iseq, max); } case VM_METHOD_TYPE_UNDEF: @@ -2183,11 +2182,7 @@ method_def_iseq(const rb_method_definiti https://github.com/ruby/ruby/blob/trunk/proc.c#L2182 { switch (def->type) { case VM_METHOD_TYPE_ISEQ: - { - rb_iseq_t *iseq; - GetISeqPtr(def->body.iseq.iseqval, iseq); - return iseq; - } + return def->body.iseq.iseqptr; case VM_METHOD_TYPE_BMETHOD: return get_proc_iseq(def->body.proc, 0); case VM_METHOD_TYPE_ALIAS: Index: vm_method.c =================================================================== --- vm_method.c (revision 50730) +++ vm_method.c (revision 50731) @@ -226,12 +226,9 @@ rb_method_definition_set(rb_method_defin https://github.com/ruby/ruby/blob/trunk/vm_method.c#L226 { rb_method_iseq_t *iseq_body = (rb_method_iseq_t *)opts; rb_cref_t *method_cref, *cref = iseq_body->cref; - rb_iseq_t *iseq; - GetISeqPtr(iseq_body->iseqval, iseq); /* setup iseq first (before invoking GC) */ - DEF_OBJ_WRITE(&def->body.iseq.iseqval, iseq_body->iseqval); - DEF_OBJ_WRITE(&def->body.iseq.iseqptr, iseq); + DEF_OBJ_WRITE(&def->body.iseq.iseqptr, iseq_body->iseqptr); if (0) vm_cref_dump("rb_method_definition_create", cref); @@ -312,7 +309,7 @@ rb_method_definition_reset(rb_method_ent https://github.com/ruby/ruby/blob/trunk/vm_method.c#L309 { switch(def->type) { case VM_METHOD_TYPE_ISEQ: - RB_OBJ_WRITTEN(me, Qundef, def->body.iseq.iseqval); + RB_OBJ_WRITTEN(me, Qundef, def->body.iseq.iseqptr->self); RB_OBJ_WRITTEN(me, Qundef, def->body.iseq.cref); break; case VM_METHOD_TYPE_IVAR: @@ -558,8 +555,12 @@ rb_add_method(VALUE klass, ID mid, rb_me https://github.com/ruby/ruby/blob/trunk/vm_method.c#L555 void rb_add_method_iseq(VALUE klass, ID mid, VALUE iseqval, rb_cref_t *cref, rb_method_flag_t noex) { - rb_method_iseq_t iseq_body = {NULL, cref, iseqval}; - rb_add_method(klass, mid, VM_METHOD_TYPE_ISEQ, &iseq_body, noex); + rb_iseq_t *iseq; + GetISeqPtr(iseqval, iseq); + { + rb_method_iseq_t iseq_body = {iseq, cref}; + rb_add_method(klass, mid, VM_METHOD_TYPE_ISEQ, &iseq_body, noex); + } } static rb_method_entry_t * @@ -1281,7 +1282,7 @@ rb_method_definition_eq(const rb_method_ https://github.com/ruby/ruby/blob/trunk/vm_method.c#L1282 switch (d1->type) { case VM_METHOD_TYPE_ISEQ: - return d1->body.iseq.iseqval == d2->body.iseq.iseqval; + return d1->body.iseq.iseqptr == d2->body.iseq.iseqptr; case VM_METHOD_TYPE_CFUNC: return d1->body.cfunc.func == d2->body.cfunc.func && @@ -1316,7 +1317,7 @@ rb_hash_method_definition(st_index_t has https://github.com/ruby/ruby/blob/trunk/vm_method.c#L1317 switch (def->type) { case VM_METHOD_TYPE_ISEQ: - return rb_hash_uint(hash, (st_index_t)def->body.iseq.iseqval); + return rb_hash_uint(hash, (st_index_t)def->body.iseq.iseqptr); case VM_METHOD_TYPE_CFUNC: hash = rb_hash_uint(hash, (st_index_t)def->body.cfunc.func); return rb_hash_uint(hash, def->body.cfunc.argc); Index: gc.c =================================================================== --- gc.c (revision 50730) +++ gc.c (revision 50731) @@ -3932,7 +3932,7 @@ mark_method_entry(rb_objspace_t *objspac https://github.com/ruby/ruby/blob/trunk/gc.c#L3932 switch (def->type) { case VM_METHOD_TYPE_ISEQ: - gc_mark(objspace, def->body.iseq.iseqval); + gc_mark(objspace, def->body.iseq.iseqptr->self); gc_mark(objspace, (VALUE)def->body.iseq.cref); break; case VM_METHOD_TYPE_ATTRSET: Index: class.c =================================================================== --- class.c (revision 50730) +++ class.c (revision 50731) @@ -247,7 +247,7 @@ clone_method(VALUE klass, ID mid, const https://github.com/ruby/ruby/blob/trunk/class.c#L247 if (me->def->type == VM_METHOD_TYPE_ISEQ) { VALUE newiseqval; rb_cref_t *new_cref; - newiseqval = rb_iseq_clone(me->def->body.iseq.iseqval, klass); + newiseqval = rb_iseq_clone(me->def->body.iseq.iseqptr->self, klass); rb_vm_rewrite_cref_stack(me->def->body.iseq.cref, me->klass, klass, &new_cref); rb_add_method_iseq(klass, mid, newiseqval, new_cref, me->def->flag); RB_GC_GUARD(newiseqval); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/