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

BaseNode::ESCAPE_LEVEL

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, #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(node) ⇒ MultiplexNode

Returns a new instance of MultiplexNode.



2351
2352
2353
2354
2355
2356
# File 'lib/ytljit/vm.rb', line 2351

def initialize(node)
  super(node.parent)
  @node = node
  @compiled_by_signature = []
  @res_area = nil
end

Instance Method Details

#collect_candidate_type(context) ⇒ Object



2369
2370
2371
2372
2373
2374
# File 'lib/ytljit/vm.rb', line 2369

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



2362
2363
2364
2365
2366
2367
# File 'lib/ytljit/vm.rb', line 2362

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



2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
# File 'lib/ytljit/vm.rb', line 2376

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

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

    context
  end
end

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

Yields:

  • (@node)


2358
2359
2360
# File 'lib/ytljit/vm.rb', line 2358

def traverse_childlen
  yield @node
end