diff options
author | Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com> | 2021-01-28 16:58:20 -0500 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2021-10-20 18:19:28 -0400 |
commit | 2e561ff255ea69e50f2d53240332cfd96463ef06 (patch) | |
tree | 3711eca121d493aa1f7a7f4e557333275a905c1e /tool/ruby_vm/models | |
parent | 3c7251b41b8850aab7c64c4885669e9c099d2465 (diff) | |
download | ruby-2e561ff255ea69e50f2d53240332cfd96463ef06.tar.gz |
Restore interpreter regs in ujit hook. Implement leave bytecode.
Diffstat (limited to 'tool/ruby_vm/models')
-rw-r--r-- | tool/ruby_vm/models/micro_jit.rb | 10 | ||||
-rw-r--r-- | tool/ruby_vm/models/micro_jit/example_instructions.rb | 12 |
2 files changed, 7 insertions, 15 deletions
diff --git a/tool/ruby_vm/models/micro_jit.rb b/tool/ruby_vm/models/micro_jit.rb index 9bbce73150..5e376ebb3a 100644 --- a/tool/ruby_vm/models/micro_jit.rb +++ b/tool/ruby_vm/models/micro_jit.rb @@ -176,10 +176,9 @@ module RubyVM::MicroJIT disassemble(handler_offset) end - def make_result(success, without_pc, with_pc) + def make_result(success, with_pc) [success ? 1 : 0, [ - ['ujit_without_ec', without_pc], ['ujit_with_ec', with_pc], ] ] @@ -193,19 +192,18 @@ module RubyVM::MicroJIT when :linux linux_scrape(instruction_id) else - raise 'Unkonwn platform. Only Mach-O on macOS and ELF on Linux are supported' + raise 'Unknown platform. Only Mach-O on macOS and ELF on Linux are supported' end end def scrape - without_ec = scrape_instruction(RubyVM::Instructions.find_index { |insn| insn.name == 'ujit_call_example' }) with_ec = scrape_instruction(RubyVM::Instructions.find_index { |insn| insn.name == 'ujit_call_example_with_ec' }) - make_result(true, without_ec, with_ec) + make_result(true, with_ec) rescue => e print_warning("scrape failed: #{e.message}") int3 = '0xcc' failure_result = ScrapeResult.new(int3, int3, ['int3']) - make_result(false, failure_result, failure_result) + make_result(false, failure_result) end def print_warning(text) diff --git a/tool/ruby_vm/models/micro_jit/example_instructions.rb b/tool/ruby_vm/models/micro_jit/example_instructions.rb index 111346f6e9..23ecf72a3b 100644 --- a/tool/ruby_vm/models/micro_jit/example_instructions.rb +++ b/tool/ruby_vm/models/micro_jit/example_instructions.rb @@ -13,11 +13,10 @@ class RubyVM::MicroJIT::ExampleInstructions include RubyVM::CEscape - attr_reader :name, :call_line + attr_reader :name - def initialize(name, call_line) + def initialize(name) @name = name - @call_line = call_line end def pretty_name @@ -64,12 +63,7 @@ class RubyVM::MicroJIT::ExampleInstructions false end - @all_examples = [ - new('ujit_call_example', 'reg_pc = rb_ujit_empty_func(GET_CFP());'), - new('ujit_call_example_with_ec', 'reg_pc = rb_ujit_empty_func_with_ec(GET_CFP(), ec);') - ] - def self.to_a - @all_examples + [new('ujit_call_example_with_ec')] end end |