module UJIT def self.disasm(iseq) iseq = RubyVM::InstructionSequence.of(iseq) blocks = UJIT.blocks_for(iseq) return if blocks.empty? str = "" cs = UJIT::Disasm.new str << iseq.disasm str << "\n" # Sort the blocks by increasing addresses blocks.sort_by(&:address).each_with_index do |block, i| str << "== BLOCK #{i+1}/#{blocks.length}: #{block.code.length} BYTES, ISEQ RANGE [#{block.iseq_start_index},#{block.iseq_end_index}[ ".ljust(80, "=") str << "\n" cs.disasm(block.code, 0).each do |i| str << sprintf( " %
08X: %