diff options
author | Takashi Kokubun <[email protected]> | 2023-03-13 20:40:24 -0700 |
---|---|---|
committer | Takashi Kokubun <[email protected]> | 2023-03-13 20:42:19 -0700 |
commit | d8344559b224a701caa80a2f72e0798ded80bcd7 (patch) | |
tree | 953e0e87b4624dc77b1e7ed105e2280143965b21 /test/ruby/rjit/test_assembler.rb | |
parent | 1c8e69d602eb368cbfdff17954f7c04c3c070641 (diff) |
RJIT: Simplify how Capstone is used in tests
Diffstat (limited to 'test/ruby/rjit/test_assembler.rb')
-rw-r--r-- | test/ruby/rjit/test_assembler.rb | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/test/ruby/rjit/test_assembler.rb b/test/ruby/rjit/test_assembler.rb index 57c84cfd50..45805115a5 100644 --- a/test/ruby/rjit/test_assembler.rb +++ b/test/ruby/rjit/test_assembler.rb @@ -166,7 +166,7 @@ module RubyVM::RJIT asm.jmp([:rax, 8]) # JMP r/m64 (Mod 01: [reg]+disp8) asm.jmp(:rax) # JMP r/m64 (Mod 11: reg) assert_compile(asm, <<~EOS) - 0x0: jmp 0x2 + 0x0: jmp 2 0x2: jmp 0xff 0x7: jmp qword ptr [rax + 8] 0xa: jmp rax @@ -338,23 +338,12 @@ module RubyVM::RJIT end_addr = @cb.write_addr io = StringIO.new - @cb.dump_disasm(start_addr, end_addr, io:, color: false) + @cb.dump_disasm(start_addr, end_addr, io:, color: false, test: true) io.seek(0) disasm = io.read disasm.gsub!(/^ /, '') disasm.sub!(/\n\z/, '') - disasm.gsub!(/0x(\h{12})/) do - offset = $1.to_i(16) - start_addr - if offset.negative? - "-0x#{offset.to_s(16)}" - else - "0x#{offset.to_s(16)}" - end - end - (start_addr...end_addr).each do |addr| - disasm.gsub!("0x#{addr.to_s(16)}", "0x#{(addr - start_addr).to_s(16)}") - end disasm end end |