Class: YTLJit::VM::Node::YieldNode

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

Overview

yield(invokeblock)

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

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

Instance Method Summary collapse

Methods included from SendUtil

#compile_c_fixarg, #compile_c_vararg, #compile_ytl, #gen_eval_self, #signature

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(parent) ⇒ YieldNode

Returns a new instance of YieldNode.



1825
1826
1827
1828
1829
# File 'lib/ytljit/vm.rb', line 1825

def initialize(parent)
  super(parent)
  @name = "block yield"
  @frame_info = search_frame_info
end

Instance Attribute Details

#frame_infoObject (readonly)

Returns the value of attribute frame_info.



1832
1833
1834
# File 'lib/ytljit/vm.rb', line 1832

def frame_info
  @frame_info
end

#nameObject (readonly)

Returns the value of attribute name.



1831
1832
1833
# File 'lib/ytljit/vm.rb', line 1831

def name
  @name
end

Instance Method Details

#calling_convention(context) ⇒ Object



1843
1844
1845
# File 'lib/ytljit/vm.rb', line 1843

def calling_convention(context)
  :ytl
end

#collect_candidate_type(context) ⇒ Object



1839
1840
1841
# File 'lib/ytljit/vm.rb', line 1839

def collect_candidate_type(context)
  context
end

#collect_info(context) ⇒ Object



1834
1835
1836
1837
# File 'lib/ytljit/vm.rb', line 1834

def collect_info(context)
  context.yield_node.last.push @parent
  context
end

#compile(context) ⇒ Object



1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
# File 'lib/ytljit/vm.rb', line 1851

def compile(context)
  context = super(context)
  asm = context.assembler
  # You can crash when you use yield in block.
  # You can fix this bug for traversing TMPR3 for method top.
  # But is is little troublesome. So it  is not supported.
  prevenv = @frame_info.offset_arg(0, BPR)
  # offset of self is common, so it no nessery traverse prev frame
  # for @frame_info.
  slfarg = @frame_info.offset_arg(2, TMPR3)
  asm.with_retry do
    asm.mov(TMPR3, prevenv)
    asm.mov(TMPR3, slfarg)
  end
  context.ret_reg2 = TMPR3
  
  context.ret_reg = @frame_info.offset_arg(1, BPR)
  context.ret_node = self
  context
end

#method_top_node(ctop, slf) ⇒ Object



1847
1848
1849
# File 'lib/ytljit/vm.rb', line 1847

def method_top_node(ctop, slf)
  nil
end