Feature #11768 » 0002-add-a-tracepoint-for-PIC-hit-miss.patch
include/ruby/ruby.h | ||
---|---|---|
#define RUBY_EVENT_THREAD_BEGIN 0x0400
|
||
#define RUBY_EVENT_THREAD_END 0x0800
|
||
#define RUBY_EVENT_FIBER_SWITCH 0x1000
|
||
#define RUBY_EVENT_INLINE_CACHE_HIT 0x2000
|
||
#define RUBY_EVENT_INLINE_CACHE_MISS 0x4000
|
||
#define RUBY_EVENT_TRACEPOINT_ALL 0xffff
|
||
/* special events */
|
vm_insnhelper.c | ||
---|---|---|
#if OPT_INLINE_METHOD_CACHE
|
||
int i;
|
||
rb_thread_t *th = GET_THREAD();
|
||
VALUE ccid;
|
||
if (LIKELY(GET_GLOBAL_METHOD_STATE() == cc->method_state && RCLASS_SERIAL(klass) == cc->class_serial)) {
|
||
ccid = INT2NUM(cc);
|
||
EXEC_EVENT_HOOK(th, RUBY_EVENT_INLINE_CACHE_HIT, recv, 0, 0, ccid);
|
||
/* cache hit! */
|
||
return;
|
||
# if OPT_POLYMORPHIC_INLINE_METHOD_CACHE
|
||
... | ... | |
cc->me = cc->mes[i];
|
||
cc->class_serial = cc->class_serials[i];
|
||
cc->call = cc->calls[i];
|
||
ccid = INT2NUM(cc);
|
||
EXEC_EVENT_HOOK(th, RUBY_EVENT_INLINE_CACHE_HIT, recv, 0, 0, ccid);
|
||
/* cache hit! */
|
||
return;
|
||
}
|
||
... | ... | |
VM_ASSERT(callable_method_entry_p(cc->me));
|
||
cc->call = vm_call_general;
|
||
#if OPT_INLINE_METHOD_CACHE
|
||
ccid = INT2NUM(cc);
|
||
EXEC_EVENT_HOOK(th, RUBY_EVENT_INLINE_CACHE_MISS, recv, 0, 0, ccid);
|
||
cc->method_state = GET_GLOBAL_METHOD_STATE();
|
||
cc->class_serial = RCLASS_SERIAL(klass);
|
||
vm_trace.c | ||
---|---|---|
C(thread_end, THREAD_END);
|
||
C(fiber_switch, FIBER_SWITCH);
|
||
C(specified_line, SPECIFIED_LINE);
|
||
C(inline_cache_hit, INLINE_CACHE_HIT);
|
||
C(inline_cache_miss, INLINE_CACHE_MISS);
|
||
case RUBY_EVENT_LINE | RUBY_EVENT_SPECIFIED_LINE: CONST_ID(id, "line"); return id;
|
||
#undef C
|
||
default:
|
||
... | ... | |
C(specified_line, SPECIFIED_LINE);
|
||
C(a_call, A_CALL);
|
||
C(a_return, A_RETURN);
|
||
C(inline_cache_hit, INLINE_CACHE_HIT);
|
||
C(inline_cache_miss, INLINE_CACHE_MISS);
|
||
#undef C
|
||
rb_raise(rb_eArgError, "unknown event: %"PRIsVALUE, rb_sym2str(sym));
|
||
}
|
||
... | ... | |
}
|
||
VALUE
|
||
rb_tracearg_callcache_id(rb_trace_arg_t *trace_arg)
|
||
{
|
||
if (trace_arg->event & (RUBY_EVENT_INLINE_CACHE_HIT | RUBY_EVENT_INLINE_CACHE_MISS)) {
|
||
/* ok */
|
||
}
|
||
else {
|
||
rb_raise(rb_eRuntimeError, "not supported by this event");
|
||
}
|
||
if (trace_arg->data == Qundef) {
|
||
rb_bug("tp_attr_return_value_m: unreachable");
|
||
}
|
||
return trace_arg->data;
|
||
}
|
||
VALUE
|
||
rb_tracearg_return_value(rb_trace_arg_t *trace_arg)
|
||
{
|
||
if (trace_arg->event & (RUBY_EVENT_RETURN | RUBY_EVENT_C_RETURN | RUBY_EVENT_B_RETURN)) {
|
||
... | ... | |
}
|
||
/*
|
||
* Return call cache id for +:inline_cache_hit+ and +:inline_cache_miss+
|
||
*/
|
||
static VALUE
|
||
tracepoint_callcache_id(VALUE tpval)
|
||
{
|
||
return rb_tracearg_callcache_id(get_trace_arg());
|
||
}
|
||
/*
|
||
* Value from exception raised on the +:raise+ event
|
||
*/
|
||
static VALUE
|
||
... | ... | |
rb_define_method(rb_cTracePoint, "self", tracepoint_attr_self, 0);
|
||
rb_define_method(rb_cTracePoint, "return_value", tracepoint_attr_return_value, 0);
|
||
rb_define_method(rb_cTracePoint, "raised_exception", tracepoint_attr_raised_exception, 0);
|
||
rb_define_method(rb_cTracePoint, "callcache_id", tracepoint_callcache_id, 0);
|
||
rb_define_singleton_method(rb_cTracePoint, "stat", tracepoint_stat_s, 0);
|
||
- « Previous
- 1
- 2
- Next »