summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog13
-rw-r--r--class.c21
-rw-r--r--proc.c2
-rw-r--r--vm.c5
-rw-r--r--vm_eval.c3
5 files changed, 24 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index 7c89f51ccf..009aa1d678 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+Wed Jun 3 20:07:07 2015 Koichi Sasada <ko1@atdot.net>
+
+ * class.c (clone_method): remove redundant check for me->def != NULL.
+ Now, all `me` have `me->def`.
+
+ * proc.c (rb_method_entry_location): ditto.
+
+ * vm.c (rb_vm_check_redefinition_opt_method): ditto.
+
+ * vm.c (add_opt_method): ditto.
+
+ * vm_eval.c (vm_call0_body): ditto.
+
Wed Jun 3 19:24:12 2015 Koichi Sasada <ko1@atdot.net>
* vm_core.h: rename enum missing_reason to enum method_missing_reason.
diff --git a/class.c b/class.c
index e4b6cfde3e..da41d85023 100644
--- a/class.c
+++ b/class.c
@@ -243,21 +243,16 @@ rb_class_new(VALUE super)
static void
clone_method(VALUE klass, ID mid, const rb_method_entry_t *me)
{
- if (me->def) {
- if (me->def->type == VM_METHOD_TYPE_ISEQ) {
- VALUE newiseqval;
- rb_cref_t *new_cref;
- newiseqval = rb_iseq_clone(me->def->body.iseq.iseqptr->self, klass);
- rb_vm_rewrite_cref_stack(me->def->body.iseq.cref, me->klass, klass, &new_cref);
- rb_add_method_iseq(klass, mid, newiseqval, new_cref, me->def->flags.visi);
- RB_GC_GUARD(newiseqval);
- }
- else {
- rb_method_entry_set(klass, mid, me, me->def->flags.visi);
- }
+ if (me->def->type == VM_METHOD_TYPE_ISEQ) {
+ VALUE newiseqval;
+ rb_cref_t *new_cref;
+ newiseqval = rb_iseq_clone(me->def->body.iseq.iseqptr->self, klass);
+ rb_vm_rewrite_cref_stack(me->def->body.iseq.cref, me->klass, klass, &new_cref);
+ rb_add_method_iseq(klass, mid, newiseqval, new_cref, me->def->flags.visi);
+ RB_GC_GUARD(newiseqval);
}
else {
- rb_bug("clone_method: unsupported");
+ rb_method_entry_set(klass, mid, me, me->def->flags.visi);
}
}
diff --git a/proc.c b/proc.c
index a661cb3d3b..950a02a206 100644
--- a/proc.c
+++ b/proc.c
@@ -2239,7 +2239,7 @@ method_def_location(const rb_method_definition_t *def)
VALUE
rb_method_entry_location(const rb_method_entry_t *me)
{
- if (!me || !me->def) return Qnil;
+ if (!me) return Qnil;
return method_def_location(me->def);
}
diff --git a/vm.c b/vm.c
index 0702e8a39e..a772206aeb 100644
--- a/vm.c
+++ b/vm.c
@@ -1237,7 +1237,7 @@ static void
rb_vm_check_redefinition_opt_method(const rb_method_entry_t *me, VALUE klass)
{
st_data_t bop;
- if (!me->def || me->def->type == VM_METHOD_TYPE_CFUNC) {
+ if (me->def->type == VM_METHOD_TYPE_CFUNC) {
if (st_lookup(vm_opt_method_table, (st_data_t)me, &bop)) {
int flag = vm_redefinition_check_flag(klass);
@@ -1272,8 +1272,7 @@ add_opt_method(VALUE klass, ID mid, VALUE bop)
{
rb_method_entry_t *me = rb_method_entry_at(klass, mid);
- if (me && me->def &&
- me->def->type == VM_METHOD_TYPE_CFUNC) {
+ if (me && me->def->type == VM_METHOD_TYPE_CFUNC) {
st_insert(vm_opt_method_table, (st_data_t)me, (st_data_t)bop);
}
else {
diff --git a/vm_eval.c b/vm_eval.c
index bd7d76214b..cd8e75a657 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -153,8 +153,6 @@ vm_call0_body(rb_thread_t* th, rb_call_info_t *ci, const VALUE *argv)
{
VALUE ret;
- if (!ci->me->def) return Qnil;
-
if (th->passed_block) {
ci->blockptr = (rb_block_t *)th->passed_block;
th->passed_block = 0;
@@ -213,7 +211,6 @@ vm_call0_body(rb_thread_t* th, rb_call_info_t *ci, const VALUE *argv)
goto success;
}
RUBY_VM_CHECK_INTS(th);
- if (!ci->me->def) return Qnil;
goto again;
}
case VM_METHOD_TYPE_ALIAS: