зеркало из https://github.com/github/ruby.git
* eval.c, method.h, proc.c, vm.c, vm_eval.c, vm_insnhelper.c, vm_method.c:
TracePoint#method_id should return method_id, not callee_id. [ruby-core:77241] [Feature #12747] * test/ruby/test_settracefunc.rb: change accordingly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
bbeeb2535c
Коммит
8004ad33bc
|
@ -1,3 +1,11 @@
|
|||
Sat Nov 5 22:09:48 2016 Kazuki Tsujimoto <kazuki@callcc.net>
|
||||
|
||||
* eval.c, method.h, proc.c, vm.c, vm_eval.c, vm_insnhelper.c, vm_method.c:
|
||||
TracePoint#method_id should return method_id, not callee_id.
|
||||
[ruby-core:77241] [Feature #12747]
|
||||
|
||||
* test/ruby/test_settracefunc.rb: change accordingly.
|
||||
|
||||
Sat Nov 5 18:49:37 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* numeric.c (flo_round, int_round): support round-to-nearest-even
|
||||
|
|
2
eval.c
2
eval.c
|
@ -749,7 +749,7 @@ rb_raise_jump(VALUE mesg, VALUE cause)
|
|||
ID mid = me->called_id;
|
||||
|
||||
rb_vm_pop_frame(th);
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, self, mid, klass, Qnil);
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, self, me->def->original_id, klass, Qnil);
|
||||
|
||||
setup_exception(th, TAG_RAISE, mesg, cause);
|
||||
|
||||
|
|
2
method.h
2
method.h
|
@ -205,7 +205,7 @@ void rb_free_method_entry(const rb_method_entry_t *me);
|
|||
void rb_sweep_method_entry(void *vm);
|
||||
|
||||
const rb_method_entry_t *rb_method_entry_clone(const rb_method_entry_t *me);
|
||||
const rb_callable_method_entry_t *rb_method_entry_complement_defined_class(const rb_method_entry_t *src_me, VALUE defined_class);
|
||||
const rb_callable_method_entry_t *rb_method_entry_complement_defined_class(const rb_method_entry_t *src_me, ID called_id, VALUE defined_class);
|
||||
void rb_method_entry_copy(rb_method_entry_t *dst, const rb_method_entry_t *src);
|
||||
|
||||
void rb_scope_visibility_set(rb_method_visibility_t);
|
||||
|
|
2
proc.c
2
proc.c
|
@ -2224,7 +2224,7 @@ umethod_bind(VALUE method, VALUE recv)
|
|||
else {
|
||||
klass = rb_include_class_new(methclass, klass);
|
||||
}
|
||||
RB_OBJ_WRITE(method, &bound->me, rb_method_entry_complement_defined_class(bound->me, klass));
|
||||
RB_OBJ_WRITE(method, &bound->me, rb_method_entry_complement_defined_class(bound->me, bound->me->called_id, klass));
|
||||
}
|
||||
|
||||
return method;
|
||||
|
|
|
@ -1153,8 +1153,8 @@ class TestSetTraceFunc < Test::Unit::TestCase
|
|||
}
|
||||
assert_equal([
|
||||
[:call, :size],
|
||||
[:c_call, :original_size],
|
||||
[:c_return, :original_size],
|
||||
[:c_call, :size],
|
||||
[:c_return, :size],
|
||||
[:return, :size]
|
||||
], events, "should use alias method name for tracing c methods")
|
||||
end
|
||||
|
@ -1287,7 +1287,7 @@ class TestSetTraceFunc < Test::Unit::TestCase
|
|||
}.enable{
|
||||
p 1
|
||||
}
|
||||
}, %w[:p :inspect 1], [], '[Bug #9940]')
|
||||
}, %w[:p :to_s 1], [], '[Bug #9940]')
|
||||
end
|
||||
|
||||
def method_prefix event
|
||||
|
|
18
vm.c
18
vm.c
|
@ -522,8 +522,8 @@ rb_vm_pop_cfunc_frame(void)
|
|||
rb_control_frame_t *cfp = th->cfp;
|
||||
const rb_callable_method_entry_t *me = rb_vm_frame_method_entry(cfp);
|
||||
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, cfp->self, me->called_id, me->owner, Qnil);
|
||||
RUBY_DTRACE_CMETHOD_RETURN_HOOK(th, me->owner, me->called_id);
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, cfp->self, me->def->original_id, me->owner, Qnil);
|
||||
RUBY_DTRACE_CMETHOD_RETURN_HOOK(th, me->owner, me->def->original_id);
|
||||
vm_pop_frame(th, cfp, cfp->ep);
|
||||
}
|
||||
|
||||
|
@ -983,11 +983,11 @@ invoke_bmethod(rb_thread_t *th, const rb_iseq_t *iseq, VALUE self, const struct
|
|||
th->cfp->sp + arg_size, iseq->body->local_table_size - arg_size,
|
||||
iseq->body->stack_max);
|
||||
|
||||
RUBY_DTRACE_METHOD_ENTRY_HOOK(th, me->owner, me->called_id);
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_CALL, self, me->called_id, me->owner, Qnil);
|
||||
RUBY_DTRACE_METHOD_ENTRY_HOOK(th, me->owner, me->def->original_id);
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_CALL, self, me->def->original_id, me->owner, Qnil);
|
||||
ret = vm_exec(th);
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_RETURN, self, me->called_id, me->owner, ret);
|
||||
RUBY_DTRACE_METHOD_RETURN_HOOK(th, me->owner, me->called_id);
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_RETURN, self, me->def->original_id, me->owner, ret);
|
||||
RUBY_DTRACE_METHOD_RETURN_HOOK(th, me->owner, me->def->original_id);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1602,7 +1602,7 @@ hook_before_rewind(rb_thread_t *th, rb_control_frame_t *cfp, int will_finish_vm_
|
|||
if (!will_finish_vm_exec) {
|
||||
/* kick RUBY_EVENT_RETURN at invoke_block_from_c() for bmethod */
|
||||
EXEC_EVENT_HOOK_AND_POP_FRAME(th, RUBY_EVENT_RETURN, th->cfp->self,
|
||||
rb_vm_frame_method_entry(th->cfp)->called_id,
|
||||
rb_vm_frame_method_entry(th->cfp)->def->original_id,
|
||||
rb_vm_frame_method_entry(th->cfp)->owner, Qnil);
|
||||
}
|
||||
}
|
||||
|
@ -1734,11 +1734,11 @@ vm_exec(rb_thread_t *th)
|
|||
while (th->cfp->pc == 0 || th->cfp->iseq == 0) {
|
||||
if (UNLIKELY(VM_FRAME_TYPE(th->cfp) == VM_FRAME_MAGIC_CFUNC)) {
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, th->cfp->self,
|
||||
rb_vm_frame_method_entry(th->cfp)->called_id,
|
||||
rb_vm_frame_method_entry(th->cfp)->def->original_id,
|
||||
rb_vm_frame_method_entry(th->cfp)->owner, Qnil);
|
||||
RUBY_DTRACE_CMETHOD_RETURN_HOOK(th,
|
||||
rb_vm_frame_method_entry(th->cfp)->owner,
|
||||
rb_vm_frame_method_entry(th->cfp)->called_id);
|
||||
rb_vm_frame_method_entry(th->cfp)->def->original_id);
|
||||
}
|
||||
rb_vm_pop_frame(th);
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ vm_call0_cfunc_with_frame(rb_thread_t* th, struct rb_calling_info *calling, cons
|
|||
VALUE block_handler = calling->block_handler;
|
||||
|
||||
RUBY_DTRACE_CMETHOD_ENTRY_HOOK(th, me->owner, mid);
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_CALL, recv, mid, me->owner, Qnil);
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_CALL, recv, me->def->original_id, me->owner, Qnil);
|
||||
{
|
||||
rb_control_frame_t *reg_cfp = th->cfp;
|
||||
|
||||
|
@ -136,7 +136,7 @@ vm_call0_cfunc_with_frame(rb_thread_t* th, struct rb_calling_info *calling, cons
|
|||
VM_PROFILE_UP(C2C_POPF);
|
||||
rb_vm_pop_frame(th);
|
||||
}
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, recv, mid, me->owner, val);
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, recv, me->def->original_id, me->owner, val);
|
||||
RUBY_DTRACE_CMETHOD_RETURN_HOOK(th, me->owner, mid);
|
||||
|
||||
return val;
|
||||
|
|
|
@ -1738,8 +1738,8 @@ vm_call_cfunc_with_frame(rb_thread_t *th, rb_control_frame_t *reg_cfp, struct rb
|
|||
VALUE block_handler = calling->block_handler;
|
||||
int argc = calling->argc;
|
||||
|
||||
RUBY_DTRACE_CMETHOD_ENTRY_HOOK(th, me->owner, me->called_id);
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_CALL, recv, me->called_id, me->owner, Qundef);
|
||||
RUBY_DTRACE_CMETHOD_ENTRY_HOOK(th, me->owner, me->def->original_id);
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_CALL, recv, me->def->original_id, me->owner, Qundef);
|
||||
|
||||
vm_push_frame(th, NULL, VM_FRAME_MAGIC_CFUNC | VM_FRAME_FLAG_CFRAME | VM_ENV_FLAG_LOCAL, recv,
|
||||
block_handler, (VALUE)me,
|
||||
|
@ -1757,8 +1757,8 @@ vm_call_cfunc_with_frame(rb_thread_t *th, rb_control_frame_t *reg_cfp, struct rb
|
|||
|
||||
rb_vm_pop_frame(th);
|
||||
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, recv, me->called_id, me->owner, val);
|
||||
RUBY_DTRACE_CMETHOD_RETURN_HOOK(th, me->owner, me->called_id);
|
||||
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, recv, me->def->original_id, me->owner, val);
|
||||
RUBY_DTRACE_CMETHOD_RETURN_HOOK(th, me->owner, me->def->original_id);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
@ -2087,7 +2087,7 @@ aliased_callable_method_entry(const rb_callable_method_entry_t *me)
|
|||
if (orig_me->defined_class == 0) {
|
||||
VALUE defined_class = find_defined_class_by_owner(me->defined_class, orig_me->owner);
|
||||
VM_ASSERT(RB_TYPE_P(orig_me->owner, T_MODULE));
|
||||
cme = rb_method_entry_complement_defined_class(orig_me, defined_class);
|
||||
cme = rb_method_entry_complement_defined_class(orig_me, me->called_id, defined_class);
|
||||
|
||||
if (me->def->alias_count + me->def->complemented_count == 0) {
|
||||
RB_OBJ_WRITE(me, &me->def->body.alias.original_me, cme);
|
||||
|
|
|
@ -408,9 +408,9 @@ rb_method_entry_clone(const rb_method_entry_t *src_me)
|
|||
}
|
||||
|
||||
const rb_callable_method_entry_t *
|
||||
rb_method_entry_complement_defined_class(const rb_method_entry_t *src_me, VALUE defined_class)
|
||||
rb_method_entry_complement_defined_class(const rb_method_entry_t *src_me, ID called_id, VALUE defined_class)
|
||||
{
|
||||
rb_method_entry_t *me = rb_method_entry_alloc(src_me->called_id, src_me->owner, defined_class,
|
||||
rb_method_entry_t *me = rb_method_entry_alloc(called_id, src_me->owner, defined_class,
|
||||
method_definition_addref_complement(src_me->def));
|
||||
METHOD_ENTRY_FLAGS_COPY(me, src_me);
|
||||
METHOD_ENTRY_COMPLEMENTED_SET(me);
|
||||
|
@ -816,7 +816,7 @@ prepare_callable_method_entry(VALUE defined_class, ID id, const rb_method_entry_
|
|||
VM_ASSERT(callable_method_entry_p(cme));
|
||||
}
|
||||
else {
|
||||
cme = rb_method_entry_complement_defined_class(me, defined_class);
|
||||
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));
|
||||
}
|
||||
|
@ -949,7 +949,7 @@ rb_resolve_refined_method_callable(VALUE refinements, const rb_callable_method_e
|
|||
const rb_method_entry_t *resolved_me = resolve_refined_method(refinements, (const rb_method_entry_t *)me, &defined_class);
|
||||
|
||||
if (resolved_me && resolved_me->defined_class == 0) {
|
||||
return rb_method_entry_complement_defined_class(resolved_me, defined_class);
|
||||
return rb_method_entry_complement_defined_class(resolved_me, me->called_id, defined_class);
|
||||
}
|
||||
else {
|
||||
return (const rb_callable_method_entry_t *)resolved_me;
|
||||
|
|
Загрузка…
Ссылка в новой задаче