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

ruby-changes:39087

From: ko1 <ko1@a...>
Date: Tue, 7 Jul 2015 04:08:30 +0900 (JST)
Subject: [ruby-changes:39087] ko1:r51168 (trunk): * vm_core.h: remove rb_iseq_t::defined_method_id because it is not

ko1	2015-07-07 04:08:05 +0900 (Tue, 07 Jul 2015)

  New Revision: 51168

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

  Log:
    * vm_core.h: remove rb_iseq_t::defined_method_id because it is not
      needed.
    * eval.c (frame_func_id): simplify. rb_callable_method_entry_t
      has enough information.
    * eval.c (frame_called_id): ditto.
    * iseq.c (prepare_iseq_build): catch up this fix.
    * proc.c (rb_mod_define_method): ditto.
    * vm.c (vm_define_method): ditto.

  Modified files:
    trunk/ChangeLog
    trunk/eval.c
    trunk/iseq.c
    trunk/proc.c
    trunk/vm.c
    trunk/vm_core.h
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 51167)
+++ ChangeLog	(revision 51168)
@@ -1,3 +1,19 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Jul  7 03:57:28 2015  Koichi Sasada  <ko1@a...>
+
+	* vm_core.h: remove rb_iseq_t::defined_method_id because it is not
+	  needed.
+
+	* eval.c (frame_func_id): simplify. rb_callable_method_entry_t
+	  has enough information.
+
+	* eval.c (frame_called_id): ditto.
+
+	* iseq.c (prepare_iseq_build): catch up this fix.
+
+	* proc.c (rb_mod_define_method): ditto.
+
+	* vm.c (vm_define_method): ditto.
+
 Tue Jul  7 03:47:26 2015  Koichi Sasada  <ko1@a...>
 
 	* vm_core.h: remove a useless declaration.
Index: vm_core.h
===================================================================
--- vm_core.h	(revision 51167)
+++ vm_core.h	(revision 51168)
@@ -348,7 +348,6 @@ struct rb_iseq_struct { https://github.com/ruby/ruby/blob/trunk/vm_core.h#L348
     const VALUE orig;			/* non-NULL if its data have origin */
 
     /* misc */
-    ID defined_method_id;	/* for define_method */
     rb_num_t flip_cnt;
 
     /* used at compile time */
Index: iseq.c
===================================================================
--- iseq.c	(revision 51167)
+++ iseq.c	(revision 51168)
@@ -268,7 +268,6 @@ prepare_iseq_build(rb_iseq_t *iseq, https://github.com/ruby/ruby/blob/trunk/iseq.c#L268
     if (iseq != iseq->local_iseq) {
 	RB_OBJ_WRITE(iseq->self, &iseq->location.base_label, iseq->local_iseq->location.label);
     }
-    iseq->defined_method_id = 0;
     RB_OBJ_WRITE(iseq->self, &iseq->mark_ary, 0);
 
     iseq->compile_data = ZALLOC(struct iseq_compile_data);
Index: proc.c
===================================================================
--- proc.c	(revision 51167)
+++ proc.c	(revision 51168)
@@ -1724,7 +1724,6 @@ rb_mod_define_method(int argc, VALUE *ar https://github.com/ruby/ruby/blob/trunk/proc.c#L1724
 	body = proc_dup(body);
 	GetProcPtr(body, proc);
 	if (!RUBY_VM_IFUNC_P(proc->block.iseq)) {
-	    proc->block.iseq->defined_method_id = id;
 	    proc->is_lambda = TRUE;
 	    proc->is_from_method = TRUE;
 	}
Index: eval.c
===================================================================
--- eval.c	(revision 51167)
+++ eval.c	(revision 51168)
@@ -922,80 +922,30 @@ rb_ensure(VALUE (*b_proc)(ANYARGS), VALU https://github.com/ruby/ruby/blob/trunk/eval.c#L922
     return result;
 }
 
-static const rb_callable_method_entry_t *
-method_entry_of_iseq(const rb_control_frame_t *cfp, const rb_iseq_t *iseq)
-{
-    rb_thread_t *th = GET_THREAD();
-    const rb_control_frame_t *cfp_limit;
-
-    cfp_limit = (rb_control_frame_t *)(th->stack + th->stack_size);
-    while (cfp_limit > cfp) {
-	if (cfp->iseq == iseq) return rb_vm_frame_method_entry(cfp); /* TODO: fix me */
-	cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp);
-    }
-    return 0;
-}
-
 static ID
 frame_func_id(rb_control_frame_t *cfp)
 {
-    const rb_iseq_t *iseq = cfp->iseq;
-    const rb_callable_method_entry_t *me_local;
     const rb_callable_method_entry_t *me = rb_vm_frame_method_entry(cfp);
 
     if (me) {
 	return me->def->original_id;
     }
-    while (iseq) {
-	if (RUBY_VM_IFUNC_P(iseq)) {
-	    const struct vm_ifunc *ifunc = (struct vm_ifunc *)iseq;
-	    if (ifunc->id) return ifunc->id;
-	    return idIFUNC;
-	}
-	me_local = method_entry_of_iseq(cfp, iseq);
-	if (me_local) {
-	    return me_local->def->original_id;
-	}
-	if (iseq->defined_method_id) {
-	    return iseq->defined_method_id;
-	}
-	if (iseq->local_iseq == iseq) {
-	    break;
-	}
-	iseq = iseq->parent_iseq;
+    else {
+	return 0;
     }
-    return 0;
 }
 
 static ID
 frame_called_id(rb_control_frame_t *cfp)
 {
-    const rb_iseq_t *iseq = cfp->iseq;
-    const rb_callable_method_entry_t *me_local;
     const rb_callable_method_entry_t *me = rb_vm_frame_method_entry(cfp);
 
     if (me) {
 	return me->called_id;
     }
-    while (iseq) {
-	if (RUBY_VM_IFUNC_P(iseq)) {
-	    const struct vm_ifunc *ifunc = (struct vm_ifunc *)iseq;
-	    if (ifunc->id) return ifunc->id;
-	    return idIFUNC;
-	}
-	me_local = method_entry_of_iseq(cfp, iseq);
-	if (me_local) {
-	    return me_local->called_id;
-	}
-	if (iseq->defined_method_id) {
-	    return iseq->defined_method_id;
-	}
-	if (iseq->local_iseq == iseq) {
-	    break;
-	}
-	iseq = iseq->parent_iseq;
+    else {
+	return 0;
     }
-    return 0;
 }
 
 ID
Index: vm.c
===================================================================
--- vm.c	(revision 51167)
+++ vm.c	(revision 51168)
@@ -2287,8 +2287,6 @@ vm_define_method(rb_thread_t *th, VALUE https://github.com/ruby/ruby/blob/trunk/vm.c#L2287
 	visi = METHOD_VISI_PUBLIC;
     }
 
-    /* dup */
-    miseq->defined_method_id = id;
     rb_add_method_iseq(klass, id, iseqval, cref, visi);
 
     if (!is_singleton && scope_visi->module_func) {

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

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