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, #decide_type, #decide_type_core, #decide_type_once, #gen_type_inference_proc, #get_constant_value, #inference_type, #merge_type, #same_type, #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.



1855
1856
1857
1858
1859
1860
# File 'lib/ytljit/vm.rb', line 1855

def initialize(node)
  super(node.parent)
  @node = node
  @first_compile = true
  @res_area = nil
end

Instance Method Details

#collect_candidate_type(context) ⇒ Object



1873
1874
1875
1876
1877
1878
# File 'lib/ytljit/vm.rb', line 1873

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



1866
1867
1868
1869
1870
1871
# File 'lib/ytljit/vm.rb', line 1866

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

#compile(context) ⇒ Object



1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
# File 'lib/ytljit/vm.rb', line 1880

def compile(context)
  if @first_compile then
    context = @node.compile(context)
    asm = context.assembler
    asm.with_retry do
      asm.mov(@res_area, context.ret_reg)
    end
    context.set_reg_content(@res_area, self)
    @first_compile = false

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

    context
  end
end

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

Yields:

  • (@node)


1862
1863
1864
# File 'lib/ytljit/vm.rb', line 1862

def traverse_childlen
  yield @node
end