Class: YTLJit::VM::Node::SetResultNode

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

Overview

Set result of method/block

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 collapse

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 inherited from BaseNode

#add_element_node, #add_element_node_backward, #collect_info, #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(parent, valnode) ⇒ SetResultNode

Returns a new instance of SetResultNode.



1885
1886
1887
1888
# File 'lib/ytljit/vm.rb', line 1885

def initialize(parent, valnode)
  super(parent)
  @value_node = valnode
end

Instance Attribute Details

#value_nodeObject (readonly)

Returns the value of attribute value_node.



1890
1891
1892
# File 'lib/ytljit/vm.rb', line 1890

def value_node
  @value_node
end

Instance Method Details

#collect_candidate_type(context) ⇒ Object



1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
# File 'lib/ytljit/vm.rb', line 1897

def collect_candidate_type(context)
  cursig = context.to_signature
  context = @value_node.collect_candidate_type(context)
  same_type(self, @value_node, cursig, cursig, context)
  same_type(@value_node, self, cursig, cursig, context)

  rtype = decide_type_once(cursig)
  rrtype = rtype.ruby_type
  if !rtype.boxed and rrtype != Fixnum and rrtype != Float then
    set_escape_node_backward(:export_object)
  else
    set_escape_node_backward(:not_export)
  end
  @body.collect_candidate_type(context)
end

#compile(context) ⇒ Object



1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
# File 'lib/ytljit/vm.rb', line 1913

def compile(context)
  context = super(context)
  context = @value_node.compile(context)
  if context.ret_reg != RETR then
    if context.ret_reg.is_a?(OpRegXMM) then
=begin
         decide_type_once(context.to_signature)
         context = @type.gen_boxing(context)
         if context.ret_reg != RETR then
           curas = context.assembler
           curas.with_retry do
            curas.mov(RETR, context.ret_reg)
          end
           
           context.set_reg_content(RETR, context.ret_node)
         end
=end
      context.set_reg_content(context.ret_reg, context.ret_node)
    else
      curas = context.assembler
      curas.with_retry do
        curas.mov(RETR, context.ret_reg)
      end
      context.set_reg_content(RETR, context.ret_node)
      context.ret_reg = RETR
    end
  else
    context.set_reg_content(RETR, context.ret_node)
    context.ret_reg = RETR
  end

  @body.compile(context)
end

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

Yields:



1892
1893
1894
1895
# File 'lib/ytljit/vm.rb', line 1892

def traverse_childlen
  yield @value_node
  yield @body
end