aboutsummaryrefslogtreecommitdiffstats
path: root/tool/ruby_vm/models/operands_unifications.rb
diff options
context:
space:
mode:
Diffstat (limited to 'tool/ruby_vm/models/operands_unifications.rb')
-rw-r--r--tool/ruby_vm/models/operands_unifications.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/tool/ruby_vm/models/operands_unifications.rb b/tool/ruby_vm/models/operands_unifications.rb
index 1bc1a2a153..ee4e3a695d 100644
--- a/tool/ruby_vm/models/operands_unifications.rb
+++ b/tool/ruby_vm/models/operands_unifications.rb
@@ -31,7 +31,8 @@ class RubyVM::OperandsUnifications < RubyVM::BareInstructions
@preamble = parts[:preamble]
@spec = parts[:spec]
super json.merge(:template => template)
- parts[:vars].each do |v|
+ @konsts = parts[:vars]
+ @konsts.each do |v|
@variables[v[:name]] ||= v
end
end
@@ -63,6 +64,10 @@ class RubyVM::OperandsUnifications < RubyVM::BareInstructions
end
end
+ def has_ope? var
+ super or @konsts.any? {|i| i[:name] == var[:name] }
+ end
+
private
def namegen signature
@@ -101,7 +106,7 @@ class RubyVM::OperandsUnifications < RubyVM::BareInstructions
vars << k
src << {
location: location,
- expr: " #{k[:name]} = #{j};"
+ expr: " const #{k[:decl]} = #{j};"
}
end
end