End of Life Ruby 3.1 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
class method
RubyVM::YJIT.blocks_for
blocks_for(p1)
yjit_iface.c
View on GitHub ↗
static VALUE
yjit_blocks_for(VALUE mod, VALUE rb_iseq)
{
if (CLASS_OF(rb_iseq) != rb_cISeq) {
return rb_ary_new();
}
const rb_iseq_t *iseq = rb_iseqw_to_iseq(rb_iseq);
VALUE all_versions = rb_ary_new();
rb_darray_for(iseq->body->yjit_blocks, version_array_idx) {
rb_yjit_block_array_t versions = rb_darray_get(iseq->body->yjit_blocks, version_array_idx);
rb_darray_for(versions, block_idx) {
block_t *block = rb_darray_get(versions, block_idx);
// FIXME: The object craeted here can outlive the block itself
VALUE rb_block = TypedData_Wrap_Struct(cYjitBlock, &yjit_block_type, block);
rb_ary_push(all_versions, rb_block);
}
}
return all_versions;
}
Get a list of the YJIT blocks associated with rb_iseq