ruby-changes:68729
From: Maxime <ko1@a...>
Date: Thu, 21 Oct 2021 08:12:37 +0900 (JST)
Subject: [ruby-changes:68729] 9def269b47 (master): Fix issue with block address accessor. Print absolute addresses.
https://git.ruby-lang.org/ruby.git/commit/?id=9def269b47 From 9def269b470f74d8ea4bb7919f927d16efb35cfa Mon Sep 17 00:00:00 2001 From: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@s...> Date: Sun, 24 Jan 2021 18:21:18 -0500 Subject: Fix issue with block address accessor. Print absolute addresses. --- ujit.rb | 6 +++--- ujit_iface.c | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ujit.rb b/ujit.rb index 3697e50b1c..8690ffc37a 100644 --- a/ujit.rb +++ b/ujit.rb @@ -15,14 +15,14 @@ module UJIT https://github.com/ruby/ruby/blob/trunk/ujit.rb#L15 str << "\n" # Sort the blocks by increasing addresses - blocks.sort_by(&:address).reverse.each do |block| + blocks.sort_by(&:address).each do |block| 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( - "\t%<address>04X:\t%<instruction>s\t%<details>s\n", - address: i.address, + "\t%<address>08X:\t%<instruction>s\t%<details>s\n", + address: block.address + i.address, instruction: i.mnemonic, details: i.op_str ) diff --git a/ujit_iface.c b/ujit_iface.c index 981c882ceb..7c553f4b3c 100644 --- a/ujit_iface.c +++ b/ujit_iface.c @@ -335,7 +335,8 @@ block_address(VALUE self) https://github.com/ruby/ruby/blob/trunk/ujit_iface.c#L335 { block_t * block; TypedData_Get_Struct(self, block_t, &ujit_block_type, block); - return LONG2NUM((intptr_t)block); + uint8_t* code_addr = cb_get_ptr(cb, block->start_pos); + return LONG2NUM((intptr_t)code_addr); } /* Get the machine code for UJIT::Block as a binary string */ -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/