Class: YTLJit::VM::YARVTranslatorBase
Instance Method Summary
collapse
Constructor Details
Returns a new instance of YARVTranslatorBase.
118
119
120
|
# File 'lib/ytljit/vm_trans.rb', line 118
def initialize(iseqs)
@iseqs = iseqs
end
|
Instance Method Details
#translate(context = nil) ⇒ Object
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
# File 'lib/ytljit/vm_trans.rb', line 122
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.['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
160
161
162
163
164
|
# File 'lib/ytljit/vm_trans.rb', line 160
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
|
# File 'lib/ytljit/vm_trans.rb', line 140
def translate_main(code, context)
code.body.each do |ins|
pos = "#{code.header['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
|