Class: YTLJit::VM::Node::MultiplexNode

Inherits:
BaseNode show all
Includes:
HaveChildlenMixin, NodeUtil
Defined in:
lib/ytljit/vm.rb

Overview

Multiplexer of node (Using YARV stack operation)

Constant Summary

Constants included from AbsArch

AbsArch::AL, AbsArch::BL, AbsArch::CL, AbsArch::DL, AbsArch::FUNC_ARG, AbsArch::FUNC_ARG_YTL, AbsArch::FUNC_FLOAT_ARG, AbsArch::FUNC_FLOAT_ARG_YTL, AbsArch::INDIRECT_BPR, AbsArch::INDIRECT_RETR, AbsArch::INDIRECT_SPR, AbsArch::INDIRECT_TMPR, AbsArch::INDIRECT_TMPR2, AbsArch::INDIRECT_TMPR3

Constants included from SSE

SSE::XMM0, SSE::XMM1, SSE::XMM2, SSE::XMM3, SSE::XMM4, SSE::XMM5, SSE::XMM6, SSE::XMM7

Instance Attribute Summary

Attributes included from HaveChildlenMixin

#body

Attributes inherited from BaseNode

#code_space, #debug_info, #element_node_list, #id, #is_escape, #parent, #ti_observee, #ti_observer, #type

Instance Method Summary collapse

Methods included from NodeUtil

#search_class_top, #search_end, #search_frame_info, #search_top

Methods inherited from BaseNode

#add_element_node, #add_element_node_backward, #decide_type, #decide_type_core, #decide_type_once, #gen_type_inference_proc, #get_constant_value, #inference_type, #marge_type, #same_type, #set_escape_node_backward, #ti_add_observer, #ti_changed, #ti_del_link, #ti_reset, #ti_update

Methods included from TypeListWithSignature

#add_type, #set_type_list, #type_list, #type_list_initvar

Methods included from Inspect

#inspect_by_graph

Constructor Details

#initialize(node) ⇒ MultiplexNode

Returns a new instance of MultiplexNode.



2303
2304
2305
2306
2307
2308
# File 'lib/ytljit/vm.rb', line 2303

def initialize(node)
  super(node.parent)
  @node = node
  @compiled_by_signature = []
  @res_area = nil
end

Instance Method Details

#collect_candidate_type(context) ⇒ Object



2321
2322
2323
2324
2325
2326
# File 'lib/ytljit/vm.rb', line 2321

def collect_candidate_type(context)
  sig = context.to_signature          
  same_type(self, @node, sig, sig, context)
  same_type(@node, self, sig, sig, context)
  @node.collect_candidate_type(context)
end

#collect_info(context) ⇒ Object



2314
2315
2316
2317
2318
2319
# File 'lib/ytljit/vm.rb', line 2314

def collect_info(context)
  tnode = search_frame_info
  offset = tnode.static_alloca(8)
  @res_area = OpIndirect.new(BPR, offset)
  @node.collect_info(context)
end

#compile(context) ⇒ Object



2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
# File 'lib/ytljit/vm.rb', line 2328

def compile(context)
  sig = context.to_signature
  if !@compiled_by_signature.include?(sig) then
    context = @node.compile(context)
    asm = context.assembler
    if context.ret_reg.is_a?(OpRegistor) then
      asm.with_retry do
        asm.mov(@res_area, context.ret_reg)
      end
      context.set_reg_content(@res_area, context.ret_node)
    else
      asm.with_retry do
        asm.mov(TMPR, context.ret_reg)
        asm.mov(@res_area, TMPR)
      end
      context.set_reg_content(@res_area, context.ret_node)
    end
    context.set_reg_content(@res_area, self)
    @compiled_by_signature.push sig

    context
  else
    asm = context.assembler
    asm.with_retry do
      asm.mov(RETR, @res_area)
    end
    context.set_reg_content(RETR, self)
    context.ret_reg = RETR
    context.ret_node = self

    context
  end
end

#traverse_childlen {|@node| ... } ⇒ Object

Yields:

  • (@node)


2310
2311
2312
# File 'lib/ytljit/vm.rb', line 2310

def traverse_childlen
  yield @node
end