* 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50748 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5ac1972c1a
commit
c3cc282f7f
13
ChangeLog
13
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>
|
Wed Jun 3 19:24:12 2015 Koichi Sasada <ko1@atdot.net>
|
||||||
|
|
||||||
* vm_core.h: rename enum missing_reason to enum method_missing_reason.
|
* vm_core.h: rename enum missing_reason to enum method_missing_reason.
|
||||||
|
21
class.c
21
class.c
@ -243,21 +243,16 @@ rb_class_new(VALUE super)
|
|||||||
static void
|
static void
|
||||||
clone_method(VALUE klass, ID mid, const rb_method_entry_t *me)
|
clone_method(VALUE klass, ID mid, const rb_method_entry_t *me)
|
||||||
{
|
{
|
||||||
if (me->def) {
|
if (me->def->type == VM_METHOD_TYPE_ISEQ) {
|
||||||
if (me->def->type == VM_METHOD_TYPE_ISEQ) {
|
VALUE newiseqval;
|
||||||
VALUE newiseqval;
|
rb_cref_t *new_cref;
|
||||||
rb_cref_t *new_cref;
|
newiseqval = rb_iseq_clone(me->def->body.iseq.iseqptr->self, klass);
|
||||||
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_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_add_method_iseq(klass, mid, newiseqval, new_cref, me->def->flags.visi);
|
RB_GC_GUARD(newiseqval);
|
||||||
RB_GC_GUARD(newiseqval);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
rb_method_entry_set(klass, mid, me, me->def->flags.visi);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rb_bug("clone_method: unsupported");
|
rb_method_entry_set(klass, mid, me, me->def->flags.visi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
proc.c
2
proc.c
@ -2239,7 +2239,7 @@ method_def_location(const rb_method_definition_t *def)
|
|||||||
VALUE
|
VALUE
|
||||||
rb_method_entry_location(const rb_method_entry_t *me)
|
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);
|
return method_def_location(me->def);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
5
vm.c
5
vm.c
@ -1237,7 +1237,7 @@ static void
|
|||||||
rb_vm_check_redefinition_opt_method(const rb_method_entry_t *me, VALUE klass)
|
rb_vm_check_redefinition_opt_method(const rb_method_entry_t *me, VALUE klass)
|
||||||
{
|
{
|
||||||
st_data_t bop;
|
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)) {
|
if (st_lookup(vm_opt_method_table, (st_data_t)me, &bop)) {
|
||||||
int flag = vm_redefinition_check_flag(klass);
|
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);
|
rb_method_entry_t *me = rb_method_entry_at(klass, mid);
|
||||||
|
|
||||||
if (me && me->def &&
|
if (me && me->def->type == VM_METHOD_TYPE_CFUNC) {
|
||||||
me->def->type == VM_METHOD_TYPE_CFUNC) {
|
|
||||||
st_insert(vm_opt_method_table, (st_data_t)me, (st_data_t)bop);
|
st_insert(vm_opt_method_table, (st_data_t)me, (st_data_t)bop);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -153,8 +153,6 @@ vm_call0_body(rb_thread_t* th, rb_call_info_t *ci, const VALUE *argv)
|
|||||||
{
|
{
|
||||||
VALUE ret;
|
VALUE ret;
|
||||||
|
|
||||||
if (!ci->me->def) return Qnil;
|
|
||||||
|
|
||||||
if (th->passed_block) {
|
if (th->passed_block) {
|
||||||
ci->blockptr = (rb_block_t *)th->passed_block;
|
ci->blockptr = (rb_block_t *)th->passed_block;
|
||||||
th->passed_block = 0;
|
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;
|
goto success;
|
||||||
}
|
}
|
||||||
RUBY_VM_CHECK_INTS(th);
|
RUBY_VM_CHECK_INTS(th);
|
||||||
if (!ci->me->def) return Qnil;
|
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
case VM_METHOD_TYPE_ALIAS:
|
case VM_METHOD_TYPE_ALIAS:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user