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

ruby-changes:49181

From: nobu <ko1@a...>
Date: Sun, 17 Dec 2017 14:35:35 +0900 (JST)
Subject: [ruby-changes:49181] nobu:r61299 (trunk): vm_method.c: empty table

nobu	2017-12-17 14:35:28 +0900 (Sun, 17 Dec 2017)

  New Revision: 61299

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

  Log:
    vm_method.c: empty table
    
    * vm_method.c (prepare_callable_method_entry): empty method table
      has no entries.

  Modified files:
    trunk/vm_method.c
Index: vm_method.c
===================================================================
--- vm_method.c	(revision 61298)
+++ vm_method.c	(revision 61299)
@@ -806,16 +806,17 @@ prepare_callable_method_entry(VALUE defi https://github.com/ruby/ruby/blob/trunk/vm_method.c#L806
 	VM_ASSERT(RB_TYPE_P(defined_class, T_ICLASS) || RB_TYPE_P(defined_class, T_MODULE));
 	VM_ASSERT(me->defined_class == 0);
 
-	if ((mtbl = RCLASS_CALLABLE_M_TBL(defined_class)) == NULL) {
-	    mtbl = RCLASS_EXT(defined_class)->callable_m_tbl = rb_id_table_create(0);
-	}
+	mtbl = RCLASS_CALLABLE_M_TBL(defined_class);
 
-	if (rb_id_table_lookup(mtbl, id, (VALUE *)&me)) {
+	if (mtbl && rb_id_table_lookup(mtbl, id, (VALUE *)&me)) {
 	    RB_DEBUG_COUNTER_INC(mc_cme_complement_hit);
 	    cme = (rb_callable_method_entry_t *)me;
 	    VM_ASSERT(callable_method_entry_p(cme));
 	}
 	else {
+	    if (!mtbl) {
+		mtbl = RCLASS_EXT(defined_class)->callable_m_tbl = rb_id_table_create(0);
+	    }
 	    cme = rb_method_entry_complement_defined_class(me, me->called_id, defined_class);
 	    rb_id_table_insert(mtbl, id, (VALUE)cme);
 	    VM_ASSERT(callable_method_entry_p(cme));

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

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