ruby-changes:73601
From: Takashi <ko1@a...>
Date: Sun, 18 Sep 2022 14:19:44 +0900 (JST)
Subject: [ruby-changes:73601] 62ec621f8c (master): Preserve the directory structure under tool/ruby_vm/views
https://git.ruby-lang.org/ruby.git/commit/?id=62ec621f8c From 62ec621f8c7457374d1f08aec97138ac1b7bdf2a Mon Sep 17 00:00:00 2001 From: Takashi Kokubun <takashikkbn@g...> Date: Sun, 18 Sep 2022 14:16:08 +0900 Subject: Preserve the directory structure under tool/ruby_vm/views for nested target directories --- template/Makefile.in | 2 +- tool/ruby_vm/helpers/dumper.rb | 3 +- tool/ruby_vm/views/instruction.rb.erb | 40 -------------------------- tool/ruby_vm/views/lib/mjit/instruction.rb.erb | 40 ++++++++++++++++++++++++++ 4 files changed, 43 insertions(+), 42 deletions(-) delete mode 100644 tool/ruby_vm/views/instruction.rb.erb create mode 100644 tool/ruby_vm/views/lib/mjit/instruction.rb.erb diff --git a/template/Makefile.in b/template/Makefile.in index 06878d552f..5c2f81381e 100644 --- a/template/Makefile.in +++ b/template/Makefile.in @@ -505,7 +505,7 @@ clean-local:: https://github.com/ruby/ruby/blob/trunk/template/Makefile.in#L505 -$(Q) $(RMDIRS) $(MJIT_HEADER_INSTALL_DIR) $(MJIT_HEADER_BUILD_DIR) $(TIMESTAMPDIR) 2> $(NULL) || $(NULLCMD) main: $(srcdir)/lib/mjit/instruction.rb -$(srcdir)/lib/mjit/instruction.rb: $(tooldir)/ruby_vm/views/instruction.rb.erb $(srcdir)/insns.def +$(srcdir)/lib/mjit/instruction.rb: $(tooldir)/ruby_vm/views/lib/mjit/instruction.rb.erb $(srcdir)/insns.def $(ECHO) generating $@ $(Q) $(BASERUBY) -Ku $(tooldir)/insns2vm.rb $(INSNS2VMOPT) $@ diff --git a/tool/ruby_vm/helpers/dumper.rb b/tool/ruby_vm/helpers/dumper.rb index 7aec9c7631..c4294e1b3e 100644 --- a/tool/ruby_vm/helpers/dumper.rb +++ b/tool/ruby_vm/helpers/dumper.rb @@ -25,10 +25,11 @@ class RubyVM::Dumper https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/helpers/dumper.rb#L25 end def new_erb spec + srcdir = Pathname.new(__dir__).parent.parent.parent path = Pathname.new(__FILE__) path = (path.relative_path_from(Pathname.pwd) rescue path).dirname path += '../views' - path += File.basename(spec) + path += Pathname.pwd.join(spec).to_s.sub("#{srcdir}/", '') src = path.read mode: 'rt:utf-8:utf-8' rescue Errno::ENOENT raise "don't know how to generate #{path}" diff --git a/tool/ruby_vm/views/instruction.rb.erb b/tool/ruby_vm/views/instruction.rb.erb deleted file mode 100644 index 1c462de53a..0000000000 --- a/tool/ruby_vm/views/instruction.rb.erb +++ /dev/null @@ -1,40 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/helpers/dumper.rb#L0 -module RubyVM::MJIT - Instruction = Struct.new( - :name, - :bin, - :len, - :expr, - :declarations, - :preamble, - :opes, - :pops, - :rets, - :always_leaf?, - :leaf_without_check_ints?, - :handles_sp?, - ) - - INSNS = { -% RubyVM::Instructions.each_with_index do |insn, i| -% next if insn.name.start_with?('trace_') - <%= i %> => Instruction.new( - name: :<%= insn.name %>, - bin: <%= i %>, # BIN(<%= insn.name %>) - len: <%= insn.width %>, # insn_len - expr: <<-EXPR, -<%= insn.expr.expr.dump.sub(/\A"/, '').sub(/"\z/, '').gsub(/\\n/, "\n").gsub(/\\t/, ' ' * 8) %> - EXPR - declarations: <%= insn.declarations.inspect %>, - preamble: <%= insn.preamble.map(&:expr).inspect %>, - opes: <%= insn.opes.inspect %>, - pops: <%= insn.pops.inspect %>, - rets: <%= insn.rets.inspect %>, - always_leaf?: <%= insn.always_leaf? %>, - leaf_without_check_ints?: <%= insn.leaf_without_check_ints? %>, - handles_sp?: <%= insn.handles_sp? %>, - ), -% end - } - - private_constant(*constants) -end if RubyVM::MJIT.enabled? diff --git a/tool/ruby_vm/views/lib/mjit/instruction.rb.erb b/tool/ruby_vm/views/lib/mjit/instruction.rb.erb new file mode 100644 index 0000000000..1c462de53a --- /dev/null +++ b/tool/ruby_vm/views/lib/mjit/instruction.rb.erb @@ -0,0 +1,40 @@ https://github.com/ruby/ruby/blob/trunk/tool/ruby_vm/views/lib/mjit/instruction.rb.erb#L1 +module RubyVM::MJIT + Instruction = Struct.new( + :name, + :bin, + :len, + :expr, + :declarations, + :preamble, + :opes, + :pops, + :rets, + :always_leaf?, + :leaf_without_check_ints?, + :handles_sp?, + ) + + INSNS = { +% RubyVM::Instructions.each_with_index do |insn, i| +% next if insn.name.start_with?('trace_') + <%= i %> => Instruction.new( + name: :<%= insn.name %>, + bin: <%= i %>, # BIN(<%= insn.name %>) + len: <%= insn.width %>, # insn_len + expr: <<-EXPR, +<%= insn.expr.expr.dump.sub(/\A"/, '').sub(/"\z/, '').gsub(/\\n/, "\n").gsub(/\\t/, ' ' * 8) %> + EXPR + declarations: <%= insn.declarations.inspect %>, + preamble: <%= insn.preamble.map(&:expr).inspect %>, + opes: <%= insn.opes.inspect %>, + pops: <%= insn.pops.inspect %>, + rets: <%= insn.rets.inspect %>, + always_leaf?: <%= insn.always_leaf? %>, + leaf_without_check_ints?: <%= insn.leaf_without_check_ints? %>, + handles_sp?: <%= insn.handles_sp? %>, + ), +% end + } + + private_constant(*constants) +end if RubyVM::MJIT.enabled? -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/