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

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, #element_node_list, #id, #parent, #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, #add_type, #decide_type, #decide_type_core, #decide_type_once, #gen_type_inference_proc, #inference_type, #merge_type, #same_type, #set_type_list, #ti_add_observer, #ti_changed, #ti_update, #type_list

Methods included from Inspect

#inspect_by_graph

Constructor Details

#initialize(parent, offset, depth, val) ⇒ LocalAssignNode

Returns a new instance of LocalAssignNode.



1520
1521
1522
1523
1524
# File 'lib/ytljit/vm.rb', line 1520

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

Instance Method Details

#collect_candidate_type(context) ⇒ Object



1537
1538
1539
1540
1541
1542
# File 'lib/ytljit/vm.rb', line 1537

def collect_candidate_type(context)
  context = @val.collect_candidate_type(context)
  same_type(self, @val, 
            context.to_key, context.to_key, context)
  @body.collect_candidate_type(context)
end

#collect_info(context) ⇒ Object



1531
1532
1533
1534
1535
# File 'lib/ytljit/vm.rb', line 1531

def collect_info(context)
  context = @val.collect_info(context)
  context.modified_local_var[@depth][@offset] = [self]
  @body.collect_info(context)
end

#compile(context) ⇒ Object



1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
# File 'lib/ytljit/vm.rb', line 1544

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

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

  valr = context.ret_reg
  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) 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
  
  context.ret_reg = nil
  if base == TMPR2 then
    context.end_using_reg(base)
  end
  context = @body.compile(context)
  context
end

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

Yields:

  • (@val)


1526
1527
1528
1529
# File 'lib/ytljit/vm.rb', line 1526

def traverse_childlen
  yield @val
  yield @body
end