summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog13
-rw-r--r--vm_method.c8
2 files changed, 18 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index c8c8093..7885c06 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+Thu Jun 25 17:32:33 2015 Koichi Sasada <ko1@atdot.net>
+
+ * vm_method.c (rb_method_entry_create): need to call
+ method_definition_reset() if def is given.
+
+ Actually, `me' is a new object, so we don't need to call it.
+ It is just to make sure.
+
+ * vm_method.c (method_definition_reset): remove duplicated insertion.
+
+ * vm_method.c (rb_method_entry_clone): assgine dst->def here,
+ not in method_definition_reset().
+
Thu Jun 25 16:44:54 2015 Koichi Sasada <ko1@atdot.net>
* vm_method.c: make a rb_method_definition_t data (def) *after* making
diff --git a/vm_method.c b/vm_method.c
index 5a40e37..43b5d2a 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -283,9 +283,9 @@ method_definition_set(rb_method_entry_t *me, rb_method_definition_t *def, void *
}
static void
-method_definition_reset(const rb_method_entry_t *me, rb_method_definition_t *def)
+method_definition_reset(const rb_method_entry_t *me)
{
- *(rb_method_definition_t **)&me->def = def;
+ rb_method_definition_t *def = me->def;
switch(def->type) {
case VM_METHOD_TYPE_ISEQ:
@@ -338,6 +338,7 @@ rb_method_entry_create(ID called_id, VALUE klass, rb_method_visibility_t visi, c
{
rb_method_entry_t *me = (rb_method_entry_t *)rb_imemo_new(imemo_ment, (VALUE)def, (VALUE)called_id, (VALUE)klass, 0);
METHOD_ENTRY_FLAGS_SET(me, visi, ruby_running ? FALSE : TRUE, rb_safe_level());
+ if (def != NULL) method_definition_reset(me);
return me;
}
@@ -353,7 +354,8 @@ rb_method_entry_clone(const rb_method_entry_t *src_me)
void
rb_method_entry_copy(rb_method_entry_t *dst, const rb_method_entry_t *src)
{
- method_definition_reset(dst, method_definition_addref(src->def));
+ *(rb_method_definition_t **)&dst->def = method_definition_addref(src->def);
+ method_definition_reset(dst);
dst->called_id = src->called_id;
RB_OBJ_WRITE((VALUE)dst, &dst->klass, src->klass);
}