[ruby-core:63077] Re: [RFC] vm_method.c (rb_method_entry_make): avoid freed me in m_tbl

From: Eric Wong <normalperson@...>
Date: 2014-06-10 19:47:56 UTC
List: ruby-core #63077
SASADA Koichi <ko1@atdot.net> wrote:
> Hi,
> 
> I don't against this change but I can't understand what is problem and
> what is better. It seems moving rb_unlink_method_entry() function to the
> end of rb_method_entry_make().

Right.

The problem is unlinking too early may cause the entry to be swept by
the time the new entry is inserted.  For st, this is not a serious
problem: the hash chaining from st_table_entry remain valid during
st_insert even if the rb_method_entry_t value is invalid.

ihash chains using rb_method_entry_t itself, so this made insertion
dereference freed/swept method entry.

Anyways, my ihash proposal is dead.  khash seems the best, so far.

In This Thread