diff options
Diffstat (limited to 'tool/ruby_vm')
-rw-r--r-- | tool/ruby_vm/models/instructions.rb | 65 | ||||
-rw-r--r-- | tool/ruby_vm/views/vm.inc.erb | 10 |
2 files changed, 74 insertions, 1 deletions
diff --git a/tool/ruby_vm/models/instructions.rb b/tool/ruby_vm/models/instructions.rb index 1198c7a4a6..83dff9c5b0 100644 --- a/tool/ruby_vm/models/instructions.rb +++ b/tool/ruby_vm/models/instructions.rb @@ -14,9 +14,72 @@ require_relative 'bare_instructions' require_relative 'operands_unifications' require_relative 'instructions_unifications' +class RubyVM::UJITExampleInstructions + include RubyVM::CEscape + + attr_reader :name + + def initialize name + @name = name + end + + def pretty_name + return sprintf "%s(...)(...)(...)", @name + end + + def jump_destination + return @orig.name + end + + def bin + return sprintf "BIN(%s)", @name + end + + def width + 1 + end + + def operands_info + "" + end + + def rets + return ['...'] + end + + def pops + return ['...'] + end + + def attributes + return [] + end + + def has_attribute? *; + return false + end + + def handles_sp? + false + end + + def always_leaf? + false + end + + @all_examples = [new('ujit_call_example')] + + def self.to_a + @all_examples + end +end + RubyVM::Instructions = RubyVM::BareInstructions.to_a + \ RubyVM::OperandsUnifications.to_a + \ - RubyVM::InstructionsUnifications.to_a + RubyVM::InstructionsUnifications.to_a + \ + RubyVM::UJITExampleInstructions.to_a + + require_relative 'trace_instructions' RubyVM::Instructions.freeze diff --git a/tool/ruby_vm/views/vm.inc.erb b/tool/ruby_vm/views/vm.inc.erb index c1a3faf60a..7942a3ef87 100644 --- a/tool/ruby_vm/views/vm.inc.erb +++ b/tool/ruby_vm/views/vm.inc.erb @@ -28,3 +28,13 @@ % RubyVM::TraceInstructions.to_a.each do |insn| <%= render 'trace_instruction', locals: { insn: insn } -%> % end +% RubyVM::UJITExampleInstructions.to_a.each do |insn| +INSN_ENTRY(<%= insn.name %>) +{ + START_OF_ORIGINAL_INSN(<%= insn.name %>); + // assumes USE_MACHINE_REGS, aka reg_pc setup, + // aka #define SET_PC(x) (reg_cfp->pc = reg_pc = (x)) + reg_pc = rb_ujit_empty_func(GET_CFP()); + END_INSN(<%= insn.name %>); +} +% end |