Project

General

Profile

Feature #14370 » benchmark_methods.diff

Methods used in benchmark - tenderlovemaking (Aaron Patterson), 01/20/2018 02:50 AM

View differences:

iseq.c
return iseq;
}
struct count_info {
int count;
};
static void
count_markables(void *ctx, VALUE obj)
{
struct count_info * my_count = (struct count_info *)ctx;
my_count->count += 1;
}
static VALUE
iseqw_object_count(VALUE self)
{
rb_iseq_t * iseq = iseqw_check(self);
struct count_info my_count = {0,};
rb_iseq_each_value(iseq, count_markables, &my_count);
return INT2NUM(my_count.count);
}
static VALUE
iseqw_size(VALUE self)
{
rb_iseq_t * iseq = iseqw_check(self);
return INT2NUM(iseq->body->iseq_size);
}
VALUE
rb_iseq_pathobj_new(VALUE path, VALUE realpath)
{
......
rb_define_method(rb_cISeq, "first_lineno", iseqw_first_lineno, 0);
rb_define_method(rb_cISeq, "trace_points", iseqw_trace_points, 0);
rb_define_method(rb_cISeq, "each_child", iseqw_each_child, 0);
rb_define_method(rb_cISeq, "markable_object_count", iseqw_object_count, 0);
rb_define_method(rb_cISeq, "size", iseqw_size, 0);
#if 0 /* TBD */
rb_define_private_method(rb_cISeq, "marshal_dump", iseqw_marshal_dump, 0);
(4-4/6)