Class: YTLJit::VM::Node::LocalAssignNode

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

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

Attributes included from HaveChildlenMixin

#body

Attributes inherited from LocalVarRefCommonNode

#current_frame_info, #frame_info

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 included from LocalVarNodeCodeGen

#gen_pursue_parent_function

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, offset, depth, val) ⇒ LocalAssignNode

Returns a new instance of LocalAssignNode.



2545
2546
2547
2548
2549
# File 'lib/ytljit/vm.rb', line 2545

def initialize(parent, offset, depth, val)
  super(parent, offset, depth)
  val.parent = self
  @val = val
end

Instance Method Details

#collect_candidate_type(context) ⇒ Object



2578
2579
2580
2581
2582
2583
2584
# File 'lib/ytljit/vm.rb', line 2578

def collect_candidate_type(context)
  context = @val.collect_candidate_type(context)
  cursig = context.to_signature
  same_type(self, @val, cursig, cursig, context)
#          same_type(@val, self, cursig, cursig, context)
  @body.collect_candidate_type(context)
end

#collect_info(context) ⇒ Object



2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
# File 'lib/ytljit/vm.rb', line 2556

def collect_info(context)
  context = @val.collect_info(context)
  top = @frame_info.parent

  nodepare = nil
  if @depth > 0 then 
    nodepare = top.orig_modified_local_var[-@depth]
  end
  if nodepare then
    nodepare = nodepare[@offset]
  end
  if nodepare then
    nodepare.push [top, self]
  else
    nodepare = [[top, self]]
  end
    
  context.modified_local_var.last[-@depth - 1][@offset] = nodepare

  @body.collect_info(context)
end

#compile(context) ⇒ Object



2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
# File 'lib/ytljit/vm.rb', line 2586

def compile(context)
  context = super(context)
  context = @val.compile(context)

  decide_type_once(context.to_signature)
  if @type.boxed then
    @val.decide_type_once(context.to_signature)
    rtype = @val.type
    context = rtype.gen_boxing(context)
  end

  valr = context.ret_reg
  valn = context.ret_node
  context = gen_pursue_parent_function(context, @depth)
  base = context.ret_reg
  offarg = @current_frame_info.offset_arg(@offset, base)

  asm = context.assembler
  if valr.is_a?(OpRegistor) or 
      (valr.is_a?(OpImmidiate) and !valr.is_a?(OpImmidiate64)) then
    asm.with_retry do
      asm.mov(offarg, valr)
    end

  else
    asm.with_retry do
      asm.mov(TMPR, valr)
      asm.mov(offarg, TMPR)
    end
  end

  tmpctx = context
  @depth.times { tmpctx = tmpctx.prev_context}
  tmpctx.set_reg_content(offarg, valn)

  context.ret_reg = nil
  if base == TMPR2 then
    context.end_using_reg(base)
  end

  @body.compile(context)
end

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

Yields:

  • (@val)


2551
2552
2553
2554
# File 'lib/ytljit/vm.rb', line 2551

def traverse_childlen
  yield @val
  yield @body
end