Skip to content

Instantly share code, notes, and snippets.

@shyouhei
Created January 9, 2018 15:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shyouhei/0217afe9dfc99c2fe2f27eade17d4768 to your computer and use it in GitHub Desktop.
Save shyouhei/0217afe9dfc99c2fe2f27eade17d4768 to your computer and use it in GitHub Desktop.
diff --git a/tool/ruby_vm/scripts/insns2vm.rb b/tool/ruby_vm/scripts/insns2vm.rb
index b1c604b570..ca857aacc4 100644
--- a/tool/ruby_vm/scripts/insns2vm.rb
+++ b/tool/ruby_vm/scripts/insns2vm.rb
@@ -22,7 +22,7 @@ def router argv
def generate_parser
OptionParser.new do |this|
- this.on "-I", "--srcdir=DIR", <<~'end'
+ this.on "-I", "--srcdir=DIR", <<-'end'
Historically this option has been passed to the script. This is
supposedly because at the beginnig the script was placed outside
of the ruby source tree. Decades passed since the merge of
@@ -30,58 +30,58 @@ def generate_parser
ignore the passed value here.
end
- this.on "-L", "--vpath=SPEC", <<~'end'
+ this.on "-L", "--vpath=SPEC", <<-'end'
Likewise, this option is no longer supported.
end
- this.on "--path-separator=SEP", /\A(?:\W\z|\.(\W).+)/, <<~'end'
+ this.on "--path-separator=SEP", /\A(?:\W\z|\.(\W).+)/, <<-'end'
Old script says this option is a "separator for vpath". I am
confident we no longer need this option.
end
- this.on "-Dname", "--enable=name[,name...]", Array, <<~'end'
+ this.on "-Dname", "--enable=name[,name...]", Array, <<-'end'
This option used to override VM option that is defined in
vm_opts.h. Now it is officially unsupported because vm_opts.h to
remain mismatched with this option must break things. Just edit
vm_opts.h directly.
end
- this.on "-Uname", "--disable=name[,name...]", Array, <<~'end'
+ this.on "-Uname", "--disable=name[,name...]", Array, <<-'end'
This option used to override VM option that is defined in
vm_opts.h. Now it is officially unsupported because vm_opts.h to
remain mismatched with this option must break things. Just edit
vm_opts.h directly.
end
- this.on "-i", "--insnsdef=FILE", "--instructions-def", <<~'end'
+ this.on "-i", "--insnsdef=FILE", "--instructions-def", <<-'end'
This option used to specify alternative path to insns.def. For
the same reason to ignore -I, we no longer support this.
end
- this.on "-o", "--opt-operanddef=FILE", "--opt-operand-def", <<~'end'
+ this.on "-o", "--opt-operanddef=FILE", "--opt-operand-def", <<-'end'
This option used to specify alternative path to opt_operand.def.
For the same reason to ignore -I, we no longer support this.
end
- this.on "-u", "--opt-insnunifdef=FILE", "--opt-insn-unif-def", <<~'end'
+ this.on "-u", "--opt-insnunifdef=FILE", "--opt-insn-unif-def", <<-'end'
This option used to specify alternative path to
opt_insn_unif.def. For the same reason to ignore -I, we no
longer support this.
end
- this.on "-C", "--[no-]use-const", <<~'end'
+ this.on "-C", "--[no-]use-const", <<-'end'
We use const whenever possible now so this option is ignored.
The author believes that C compilers can constant-fold.
end
- this.on "-d", "--destdir", "--output-directory=DIR", <<~'begin' do |dir|
+ this.on "-d", "--destdir", "--output-directory=DIR", <<-'begin' do |dir|
THIS IS THE ONLY OPTION THAT WORKS today. Change destination
directory from the current working directory to the given path.
begin
Dir.chdir dir
end
- this.on "-V", "--[no-]verbose", <<~'end'
+ this.on "-V", "--[no-]verbose", <<-'end'
Please let us ignore this and be modest.
end
end
diff --git a/tool/ruby_vm/views/optinsn.inc.erb b/tool/ruby_vm/views/optinsn.inc.erb
index 6e30078cae..ae99326275 100644
--- a/tool/ruby_vm/views/optinsn.inc.erb
+++ b/tool/ruby_vm/views/optinsn.inc.erb
@@ -59,7 +59,7 @@ rb_insn_unified_local_var_level(VALUE insn)
% RubyVM::OperandsUnifications.each_group do |orig, unifs|
% unifs.each do|insn|
case <%= insn.bin %>:
-% insn.spec.map{|(var,val)|val}.grep_v('*').each do |val|
+% insn.spec.map{|(var,val)|val}.reject{| i | i == '*' }.each do |val|
return <%= val %>;
% break
% end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment