Class: YTLJit::VM::YARVTranslatorBase
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(iseqs) ⇒ YARVTranslatorBase
constructor
A new instance of YARVTranslatorBase.
- #translate(context = nil) ⇒ Object
- #translate_block(code, context) ⇒ Object
Constructor Details
#initialize(iseqs) ⇒ YARVTranslatorBase
Returns a new instance of YARVTranslatorBase.
58 59 60 |
# File 'lib/ytljit/vm_trans.rb', line 58 def initialize(iseqs) @iseqs = iseqs end |
Instance Method Details
#translate(context = nil) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/ytljit/vm_trans.rb', line 62 def translate(context = nil) if context == nil then context = YARVContext.new end @iseqs.each do |code| pos = "#{code.header['filename']}:#{context.current_line_no}" context.enc_pos_in_source = pos if code.header['type'] == :block then lstr = context.enc_label + "+blk+" + context.current_method_name.to_s context.enc_label = lstr end translate_block(code, context) end context.the_top end |
#translate_block(code, context) ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/ytljit/vm_trans.rb', line 80 def translate_block(code, context) visit_block_start(code, nil, context) code.body.each do |ins| pos = "#{code.header['filename']}:#{context.current_line_no}" context.enc_pos_in_source = pos if ins == nil then # do nothing elsif ins.is_a?(Fixnum) then # line no context.current_line_no = ins elsif ins.is_a?(Symbol) then context.not_reached_pos = false visit_symbol(code, ins, context) elsif !context.not_reached_pos then opname = ins[0].to_s send(("visit_" + opname).to_sym, code, ins, context) end end visit_block_end(code, nil, context) end |