From 4e2eb7695e9b45cb5d2ae757bdb5c2043d78be78 Mon Sep 17 00:00:00 2001 From: Jose Narvaez Date: Sat, 6 Mar 2021 23:46:56 +0000 Subject: Yet Another Ruby JIT! Renaming uJIT to YJIT. AKA s/ujit/yjit/g. --- tool/ruby_vm/models/micro_jit.rb | 6 +++--- .../models/micro_jit/example_instructions.rb | 2 +- tool/ruby_vm/views/ujit_hooks.inc.erb | 24 ---------------------- tool/ruby_vm/views/vm.inc.erb | 8 ++++---- tool/ruby_vm/views/yjit_hooks.inc.erb | 24 ++++++++++++++++++++++ 5 files changed, 32 insertions(+), 32 deletions(-) delete mode 100644 tool/ruby_vm/views/ujit_hooks.inc.erb create mode 100644 tool/ruby_vm/views/yjit_hooks.inc.erb (limited to 'tool/ruby_vm') diff --git a/tool/ruby_vm/models/micro_jit.rb b/tool/ruby_vm/models/micro_jit.rb index 5e376ebb3a..83b463a367 100644 --- a/tool/ruby_vm/models/micro_jit.rb +++ b/tool/ruby_vm/models/micro_jit.rb @@ -179,7 +179,7 @@ module RubyVM::MicroJIT def make_result(success, with_pc) [success ? 1 : 0, [ - ['ujit_with_ec', with_pc], + ['yjit_with_ec', with_pc], ] ] end @@ -197,7 +197,7 @@ module RubyVM::MicroJIT end def scrape - with_ec = scrape_instruction(RubyVM::Instructions.find_index { |insn| insn.name == 'ujit_call_example_with_ec' }) + with_ec = scrape_instruction(RubyVM::Instructions.find_index { |insn| insn.name == 'yjit_call_example_with_ec' }) make_result(true, with_ec) rescue => e print_warning("scrape failed: #{e.message}") @@ -207,7 +207,7 @@ module RubyVM::MicroJIT end def print_warning(text) - text = "ujit warning: #{text}" + text = "yjit warning: #{text}" text = "\x1b[1m#{text}\x1b[0m" if STDOUT.tty? STDOUT.puts(text) end diff --git a/tool/ruby_vm/models/micro_jit/example_instructions.rb b/tool/ruby_vm/models/micro_jit/example_instructions.rb index 23ecf72a3b..5dd40fef65 100644 --- a/tool/ruby_vm/models/micro_jit/example_instructions.rb +++ b/tool/ruby_vm/models/micro_jit/example_instructions.rb @@ -64,6 +64,6 @@ class RubyVM::MicroJIT::ExampleInstructions end def self.to_a - [new('ujit_call_example_with_ec')] + [new('yjit_call_example_with_ec')] end end diff --git a/tool/ruby_vm/views/ujit_hooks.inc.erb b/tool/ruby_vm/views/ujit_hooks.inc.erb deleted file mode 100644 index 9409c996b1..0000000000 --- a/tool/ruby_vm/views/ujit_hooks.inc.erb +++ /dev/null @@ -1,24 +0,0 @@ -/* -*- C -*- */ - -%# Copyright (c) 2020 Wu, Alan. All rights reserved. -%# -%# This file is a part of the programming language Ruby. Permission is hereby -%# granted, to either redistribute and/or modify this file, provided that the -%# conditions mentioned in the file COPYING are met. Consult the file for -%# details. -<%= render 'copyright' %> -<%= render 'notice', locals: { - this_file: 'contains raw instruction bytes that helps MicroJIT generate code', - edit: __FILE__, -} -%> - -% success, byte_arrays = RubyVM::MicroJIT.scrape -static const uint8_t ujit_scrape_successful = <%= success %>; -% byte_arrays.each do |(prefix, scrape_result)| -// Disassembly: -% scrape_result.disassembly_lines.each do |line| -// <%= line %> -% end -static const uint8_t <%= prefix %>_pre_call_bytes[] = { <%= scrape_result.pre_call_bytes %> }; -static const uint8_t <%= prefix %>_post_call_bytes[] = { <%= scrape_result.post_call_bytes %> }; -% end diff --git a/tool/ruby_vm/views/vm.inc.erb b/tool/ruby_vm/views/vm.inc.erb index 57a860efcf..c49c785df6 100644 --- a/tool/ruby_vm/views/vm.inc.erb +++ b/tool/ruby_vm/views/vm.inc.erb @@ -26,16 +26,16 @@ % end % % RubyVM::MicroJIT::ExampleInstructions.to_a.each do |insn| -INSN_ENTRY(ujit_call_example_with_ec) +INSN_ENTRY(yjit_call_example_with_ec) { - START_OF_ORIGINAL_INSN(ujit_call_example_with_ec); + START_OF_ORIGINAL_INSN(yjit_call_example_with_ec); #if USE_MACHINE_REGS // assumes USE_MACHINE_REGS, aka reg_pc setup, // aka #define SET_PC(x) (reg_cfp->pc = reg_pc = (x)) - rb_ujit_empty_func_with_ec(GET_CFP(), ec); + rb_yjit_empty_func_with_ec(GET_CFP(), ec); RESTORE_REGS(); #endif - END_INSN(ujit_call_example_with_ec); + END_INSN(yjit_call_example_with_ec); } % end % diff --git a/tool/ruby_vm/views/yjit_hooks.inc.erb b/tool/ruby_vm/views/yjit_hooks.inc.erb new file mode 100644 index 0000000000..faca2050c6 --- /dev/null +++ b/tool/ruby_vm/views/yjit_hooks.inc.erb @@ -0,0 +1,24 @@ +/* -*- C -*- */ + +%# Copyright (c) 2020 Wu, Alan. All rights reserved. +%# +%# This file is a part of the programming language Ruby. Permission is hereby +%# granted, to either redistribute and/or modify this file, provided that the +%# conditions mentioned in the file COPYING are met. Consult the file for +%# details. +<%= render 'copyright' %> +<%= render 'notice', locals: { + this_file: 'contains raw instruction bytes that helps MicroJIT generate code', + edit: __FILE__, +} -%> + +% success, byte_arrays = RubyVM::MicroJIT.scrape +static const uint8_t yjit_scrape_successful = <%= success %>; +% byte_arrays.each do |(prefix, scrape_result)| +// Disassembly: +% scrape_result.disassembly_lines.each do |line| +// <%= line %> +% end +static const uint8_t <%= prefix %>_pre_call_bytes[] = { <%= scrape_result.pre_call_bytes %> }; +static const uint8_t <%= prefix %>_post_call_bytes[] = { <%= scrape_result.post_call_bytes %> }; +% end -- cgit v1.2.1