diff --git a/ujit.rb b/ujit.rb index 43be881c05..3697e50b1c 100644 --- a/ujit.rb +++ b/ujit.rb @@ -1,5 +1,9 @@ module UJIT def self.disasm(iseq) + if iseq.is_a? Method + iseq = RubyVM::InstructionSequence.of(iseq) + end + blocks = UJIT.blocks_for(iseq) return if blocks.empty? @@ -10,13 +14,14 @@ module UJIT str << iseq.disasm str << "\n" + # Sort the blocks by increasing addresses blocks.sort_by(&:address).reverse.each do |block| - str << "== ISEQ RANGE: #{block.iseq_start_index} -> #{block.iseq_end_index} ".ljust(80, "=") + str << "== ISEQ RANGE: [#{block.iseq_start_index},#{block.iseq_end_index}[ ".ljust(80, "=") str << "\n" cs.disasm(block.code, 0).each do |i| str << sprintf( - "\t0x%
x:\t%