From ac88162198a6b5f1b8f3e17eaac5fe4b0b411934 Mon Sep 17 00:00:00 2001 From: ko1 Date: Tue, 2 Jun 2015 14:32:33 +0000 Subject: * 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm_method.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'vm_method.c') diff --git a/vm_method.c b/vm_method.c index 5708b7a490..09116b0733 100644 --- a/vm_method.c +++ b/vm_method.c @@ -226,12 +226,9 @@ rb_method_definition_set(rb_method_definition_t *def, void *opts) { 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_entry_t *me, rb_method_definition_t *def) { 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_method_type_t type, void *opts, rb_method_ 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_definition_t *d1, const rb_method_defini 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 hash, const rb_method_definition_t *def) 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); -- cgit v1.2.3