diff options
author | Alan Wu <XrXr@users.noreply.github.com> | 2021-03-12 12:22:19 -0500 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2021-10-20 18:19:31 -0400 |
commit | 5d834bcf9fb9596fd15f9e657a94caa8716b3f10 (patch) | |
tree | 6ae91f07eb1172c40966f7631e204d827a0f17f0 /yjit.rb | |
parent | 439db7b81b588a1ee12475568cab7b8dab4e2cd3 (diff) | |
download | ruby-5d834bcf9fb9596fd15f9e657a94caa8716b3f10.tar.gz |
YJIT: lazy polymorphic getinstancevariable
Lazily compile out a chain of checks for different known classes and
whether `self` embeds its ivars or not.
* Remove trailing whitespaces
* Get proper addresss in Capstone disassembly
* Lowercase address in Capstone disassembly
Capstone uses lowercase for jump targets in generated listings. Let's
match it.
* Use the same successor in getivar guard chains
Cuts down on duplication
* Address reviews
* Fix copypasta error
* Add a comment
Diffstat (limited to 'yjit.rb')
-rw-r--r-- | yjit.rb | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -14,13 +14,13 @@ module YJIT # 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 << "== 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| + cs.disasm(block.code, block.address).each do |i| str << sprintf( - " %<address>08X: %<instruction>s\t%<details>s\n", - address: block.address + i.address, + " %<address>08x: %<instruction>s\t%<details>s\n", + address: i.address, instruction: i.mnemonic, details: i.op_str ) @@ -62,6 +62,7 @@ module YJIT print_counters(counters, prefix: 'oswb_', prompt: 'opt_send_without_block exit reasons: ') print_counters(counters, prefix: 'leave_', prompt: 'leave exit reasons: ') + print_counters(counters, prefix: 'getivar_', prompt: 'getinstancevariable exit reasons:') end def print_counters(counters, prefix:, prompt:) |