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

Constants inherited from BaseNode

BaseNode::ESCAPE_LEVEL

Instance Attribute Summary collapse

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 SendUtil

#compile_c_fixarg, #compile_c_fixarg_raw, #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, #add_element_node_backward, #decide_type, #decide_type_core, #decide_type_once, #gen_type_inference_proc, #get_constant_value, #inference_type, #marge_element_node, #marge_type, #same_type, #set_escape_node, #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) ⇒ YieldNode

Returns a new instance of YieldNode.



2597
2598
2599
2600
2601
# File 'lib/ytljit/vm.rb', line 2597

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.



2604
2605
2606
# File 'lib/ytljit/vm.rb', line 2604

def frame_info
  @frame_info
end

#nameObject (readonly)

Returns the value of attribute name.



2603
2604
2605
# File 'lib/ytljit/vm.rb', line 2603

def name
  @name
end

Instance Method Details

#calling_convention(context) ⇒ Object



2615
2616
2617
# File 'lib/ytljit/vm.rb', line 2615

def calling_convention(context)
  :ytl
end

#collect_candidate_type(context) ⇒ Object



2611
2612
2613
# File 'lib/ytljit/vm.rb', line 2611

def collect_candidate_type(context)
  context
end

#collect_info(context) ⇒ Object



2606
2607
2608
2609
# File 'lib/ytljit/vm.rb', line 2606

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

#compile(context) ⇒ Object



2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
# File 'lib/ytljit/vm.rb', line 2623

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 PTMPR 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, PTMPR)
  asm.with_retry do
    asm.mov(PTMPR, prevenv)
    asm.mov(PTMPR, slfarg)
  end
  context.set_reg_content(PTMPR, true)
  context.ret_reg2 = PTMPR
  
  context.ret_reg = @frame_info.offset_arg(1, BPR)
  context.ret_node = self
  context.set_reg_content(context.ret_reg, self)
  context
end

#method_top_node(ctop, slf) ⇒ Object



2619
2620
2621
# File 'lib/ytljit/vm.rb', line 2619

def method_top_node(ctop, slf)
  nil
end