1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Make UJIT.disasm accept Procs

This commit is contained in:
Alan Wu 2021-02-04 12:29:36 -05:00
parent ab5760307b
commit 2fcb17d655
2 changed files with 7 additions and 3 deletions

View file

@ -1,8 +1,6 @@
module UJIT
def self.disasm(iseq)
if iseq.is_a? Method
iseq = RubyVM::InstructionSequence.of(iseq)
end
iseq = RubyVM::InstructionSequence.of(iseq)
blocks = UJIT.blocks_for(iseq)
return if blocks.empty?

View file

@ -353,6 +353,9 @@ iseqw_ujit_collect_blocks(st_data_t key, st_data_t value, st_data_t argp)
static VALUE
ujit_blocks_for(VALUE mod, VALUE rb_iseq)
{
if (!rb_obj_is_iseq(rb_iseq)) {
return rb_ary_new();
}
const rb_iseq_t *iseq = rb_iseqw_to_iseq(rb_iseq);
st_table * vt = (st_table *)version_tbl;
struct ujit_block_itr itr;
@ -367,6 +370,9 @@ ujit_blocks_for(VALUE mod, VALUE rb_iseq)
static VALUE
ujit_install_entry(VALUE mod, VALUE iseq)
{
if (!rb_obj_is_iseq(iseq)) {
rb_raise(rb_eTypeError, "not an InstructionSequence");
}
rb_ujit_compile_iseq(rb_iseqw_to_iseq(iseq));
return iseq;
}