Class: YTLJit::VM::YARVTranslatorBase
Instance Method Summary
collapse
Constructor Details
Returns a new instance of YARVTranslatorBase.
77
78
79
|
# File 'lib/ytljit/vm_trans.rb', line 77
def initialize(iseqs)
@iseqs = iseqs
end
|
Instance Method Details
#translate(context = nil) ⇒ Object
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
# File 'lib/ytljit/vm_trans.rb', line 81
def translate(context = nil)
if context == nil then
context = YARVContext.new
end
@iseqs.each do |code|
pos = "#{code.['filename']}:#{context.current_line_no}"
context.enc_pos_in_source = pos
if code.['type'] == :block then
lstr = context.enc_label + "+blk+" +
context.current_method_node.to_s
context.enc_label = lstr
end
translate_block(code, context)
end
context.the_top
end
|
#translate_block(code, context) ⇒ Object
119
120
121
122
123
|
# File 'lib/ytljit/vm_trans.rb', line 119
def translate_block(code, context)
visit_block_start(code, nil, context)
translate_main(code, context)
visit_block_end(code, nil, context)
end
|
#translate_main(code, context) ⇒ Object
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
# File 'lib/ytljit/vm_trans.rb', line 99
def translate_main(code, context)
code.body.each do |ins|
pos = "#{code.['filename']}:#{context.current_line_no}"
context.enc_pos_in_source = pos
if ins == nil then
elsif ins.is_a?(Fixnum) then
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
end
|