Class: YTLJit::VM::Node::MultiplexNode
- Includes:
- HaveChildlenMixin, NodeUtil
- Defined in:
- lib/ytljit/vm.rb
Overview
Multiplexer of node (Using YARV stack operation)
Constant Summary
Constants inherited from BaseNode
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
-
#node ⇒ Object
readonly
Returns the value of attribute node.
Attributes included from HaveChildlenMixin
Attributes inherited from BaseNode
#code_space, #debug_info, #element_node_list, #id, #is_escape, #parent, #ti_observee, #ti_observer, #type
Instance Method Summary collapse
- #collect_candidate_type(context) ⇒ Object
- #collect_info(context) ⇒ Object
- #compile(context) ⇒ Object
-
#initialize(parent, node) ⇒ MultiplexNode
constructor
A new instance of MultiplexNode.
- #traverse_childlen {|@node| ... } ⇒ Object
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, #add_element_node_backward_aux, #decide_type, #decide_type_core, #decide_type_once, #gen_type_inference_proc, #get_constant_value, #inference_type, #marge_element_node, #marge_type, #same_type, #search_valid_signature, #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
Constructor Details
#initialize(parent, node) ⇒ MultiplexNode
Returns a new instance of MultiplexNode.
2623 2624 2625 2626 2627 2628 |
# File 'lib/ytljit/vm.rb', line 2623 def initialize(parent, node) super(parent) @node = node @compiled_by_signature = [] @res_area = nil end |
Instance Attribute Details
#node ⇒ Object (readonly)
Returns the value of attribute node.
2630 2631 2632 |
# File 'lib/ytljit/vm.rb', line 2630 def node @node end |
Instance Method Details
#collect_candidate_type(context) ⇒ Object
2643 2644 2645 2646 2647 2648 |
# File 'lib/ytljit/vm.rb', line 2643 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
2636 2637 2638 2639 2640 2641 |
# File 'lib/ytljit/vm.rb', line 2636 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
2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 |
# File 'lib/ytljit/vm.rb', line 2650 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 else asm = context.assembler rtype = decide_type_once(sig) if rtype.ruby_type == Float and !rtype.boxed then asm.with_retry do asm.movsd(XMM0, @res_area) end context.set_reg_content(XMM0, self) context.ret_reg = XMM0 else asm.with_retry do asm.mov(RETR, @res_area) end context.set_reg_content(RETR, self) context.ret_reg = RETR end context.ret_node = self end context end |
#traverse_childlen {|@node| ... } ⇒ Object
2632 2633 2634 |
# File 'lib/ytljit/vm.rb', line 2632 def traverse_childlen yield @node end |