summaryrefslogtreecommitdiff
path: root/tool/ruby_vm/models
diff options
context:
space:
mode:
Diffstat (limited to 'tool/ruby_vm/models')
-rw-r--r--tool/ruby_vm/models/attribute.rb2
-rwxr-xr-xtool/ruby_vm/models/bare_instructions.rb16
-rw-r--r--tool/ruby_vm/models/c_expr.rb6
-rw-r--r--tool/ruby_vm/models/operands_unifications.rb8
-rw-r--r--tool/ruby_vm/models/typemap.rb1
5 files changed, 19 insertions, 14 deletions
diff --git a/tool/ruby_vm/models/attribute.rb b/tool/ruby_vm/models/attribute.rb
index de35e7234a..ac4122f3ac 100644
--- a/tool/ruby_vm/models/attribute.rb
+++ b/tool/ruby_vm/models/attribute.rb
@@ -21,7 +21,7 @@ class RubyVM::Attribute
@key = opts[:name]
@expr = RubyVM::CExpr.new location: opts[:location], expr: opts[:expr]
@type = opts[:type]
- @ope_decls = @insn.opes.map do |operand|
+ @ope_decls = @insn.operands.map do |operand|
decl = operand[:decl]
if @key == 'comptime_sp_inc' && operand[:type] == 'CALL_DATA'
decl = decl.gsub('CALL_DATA', 'CALL_INFO').gsub('cd', 'ci')
diff --git a/tool/ruby_vm/models/bare_instructions.rb b/tool/ruby_vm/models/bare_instructions.rb
index 6b5f1f6cf8..a810d89f3c 100755
--- a/tool/ruby_vm/models/bare_instructions.rb
+++ b/tool/ruby_vm/models/bare_instructions.rb
@@ -16,7 +16,7 @@ require_relative 'typemap'
require_relative 'attribute'
class RubyVM::BareInstructions
- attr_reader :template, :name, :opes, :pops, :rets, :decls, :expr
+ attr_reader :template, :name, :operands, :pops, :rets, :decls, :expr
def initialize opts = {}
@template = opts[:template]
@@ -24,7 +24,7 @@ class RubyVM::BareInstructions
@loc = opts[:location]
@sig = opts[:signature]
@expr = RubyVM::CExpr.new opts[:expr]
- @opes = typesplit @sig[:ope]
+ @operands = typesplit @sig[:ope]
@pops = typesplit @sig[:pop].reject {|i| i == '...' }
@rets = typesplit @sig[:ret].reject {|i| i == '...' }
@attrs = opts[:attributes].map {|i|
@@ -51,7 +51,7 @@ class RubyVM::BareInstructions
def call_attribute name
return sprintf 'attr_%s_%s(%s)', name, @name, \
- @opes.map {|i| i[:name] }.compact.join(', ')
+ @operands.map {|i| i[:name] }.compact.join(', ')
end
def has_attribute? k
@@ -65,7 +65,7 @@ class RubyVM::BareInstructions
end
def width
- return 1 + opes.size
+ return 1 + operands.size
end
def declarations
@@ -98,7 +98,7 @@ class RubyVM::BareInstructions
end
def operands_info
- opes.map {|o|
+ operands.map {|o|
c, _ = RubyVM::Typemap.fetch o[:type]
next c
}.join
@@ -137,7 +137,7 @@ class RubyVM::BareInstructions
end
def has_ope? var
- return @opes.any? {|i| i[:name] == var[:name] }
+ return @operands.any? {|i| i[:name] == var[:name] }
end
def has_pop? var
@@ -180,7 +180,7 @@ class RubyVM::BareInstructions
# Beware: order matters here because some attribute depends another.
generate_attribute 'const char*', 'name', "insn_name(#{bin})"
generate_attribute 'enum ruby_vminsn_type', 'bin', bin
- generate_attribute 'rb_num_t', 'open', opes.size
+ generate_attribute 'rb_num_t', 'open', operands.size
generate_attribute 'rb_num_t', 'popn', pops.size
generate_attribute 'rb_num_t', 'retn', rets.size
generate_attribute 'rb_num_t', 'width', width
@@ -191,7 +191,7 @@ class RubyVM::BareInstructions
def default_definition_of_handles_sp
# Insn with ISEQ should yield it; can handle sp.
- return opes.any? {|o| o[:type] == 'ISEQ' }
+ return operands.any? {|o| o[:type] == 'ISEQ' }
end
def default_definition_of_leaf
diff --git a/tool/ruby_vm/models/c_expr.rb b/tool/ruby_vm/models/c_expr.rb
index 073112f545..4b5aec58dd 100644
--- a/tool/ruby_vm/models/c_expr.rb
+++ b/tool/ruby_vm/models/c_expr.rb
@@ -36,6 +36,10 @@ class RubyVM::CExpr
end
def inspect
- sprintf "#<%s:%d %s>", @__FILE__, @__LINE__, @expr
+ if @__LINE__
+ sprintf "#<%s:%d %s>", @__FILE__, @__LINE__, @expr
+ else
+ sprintf "#<%s %s>", @__FILE__, @expr
+ end
end
end
diff --git a/tool/ruby_vm/models/operands_unifications.rb b/tool/ruby_vm/models/operands_unifications.rb
index ee4e3a695d..10e5742897 100644
--- a/tool/ruby_vm/models/operands_unifications.rb
+++ b/tool/ruby_vm/models/operands_unifications.rb
@@ -38,8 +38,8 @@ class RubyVM::OperandsUnifications < RubyVM::BareInstructions
end
def operand_shift_of var
- before = @original.opes.find_index var
- after = @opes.find_index var
+ before = @original.operands.find_index var
+ after = @operands.find_index var
raise "no #{var} for #{@name}" unless before and after
return before - after
end
@@ -50,7 +50,7 @@ class RubyVM::OperandsUnifications < RubyVM::BareInstructions
case val when '*' then
next nil
else
- type = @original.opes[i][:type]
+ type = @original.operands[i][:type]
expr = RubyVM::Typemap.typecast_to_VALUE type, val
next "#{ptr}[#{i}] == #{expr}"
end
@@ -85,7 +85,7 @@ class RubyVM::OperandsUnifications < RubyVM::BareInstructions
def compose location, spec, template
name = namegen spec
*, argv = *spec
- opes = @original.opes
+ opes = @original.operands
if opes.size != argv.size
raise sprintf("operand size mismatch for %s (%s's: %d, given: %d)",
name, template[:name], opes.size, argv.size)
diff --git a/tool/ruby_vm/models/typemap.rb b/tool/ruby_vm/models/typemap.rb
index ed3aea7d2e..d762dd3321 100644
--- a/tool/ruby_vm/models/typemap.rb
+++ b/tool/ruby_vm/models/typemap.rb
@@ -16,6 +16,7 @@ RubyVM::Typemap = {
"CDHASH" => %w[H TS_CDHASH],
"IC" => %w[K TS_IC],
"IVC" => %w[A TS_IVC],
+ "ICVARC" => %w[J TS_ICVARC],
"ID" => %w[I TS_ID],
"ISE" => %w[T TS_ISE],
"ISEQ" => %w[S TS_ISEQ],