Class: YTLJit::VM::Node::LocalVarRefNode

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

Direct Known Subclasses

SelfRefNode

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

Attributes inherited from LocalVarRefCommonNode

#current_frame_info, #depth, #frame_info, #offset

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, #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

#inspect_by_graph

Constructor Details

#initialize(parent, offset, depth) ⇒ LocalVarRefNode

Returns a new instance of LocalVarRefNode.



3481
3482
3483
3484
# File 'lib/ytljit/vm.rb', line 3481

def initialize(parent, offset, depth)
  super
  @var_type_info = nil
end

Instance Method Details

#collect_candidate_type(context) ⇒ Object



3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
# File 'lib/ytljit/vm.rb', line 3507

def collect_candidate_type(context)
  cursig = context.to_signature
  @type = nil
  @var_type_info.reverse.each do |topnode, node|
    varsig = context.to_signature(topnode)
    same_type(self, node, cursig, varsig, context)
    # same_type(node, self, varsig, cursig, context)

  end
  context
end

#collect_info(context) ⇒ Object



3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
# File 'lib/ytljit/vm.rb', line 3486

def collect_info(context)
  vti = nil
  if context.modified_local_var.last[-@depth - 1] then
    vti = context.modified_local_var.last[-@depth - 1][@offset]
  end

  if vti then
    if depth == 0 then
      @var_type_info = vti.map {|e| e.dup }
    else
      @var_type_info = vti
    end
  else
    raise "maybe bug"
    roff = @current_frame_info.real_offset(@offset)
    @var_type_info = [@current_frame_info.frame_layout[roff]]
  end

  context
end

#compile(context) ⇒ Object



3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
# File 'lib/ytljit/vm.rb', line 3518

def compile(context)
  context = super(context)
  context = gen_pursue_parent_function(context, @depth)
  base = context.ret_reg
  offarg = @current_frame_info.offset_arg(@offset, base)

  asm = context.assembler
  @type = nil
  rtype = decide_type_once(context.to_signature)
  if !rtype.boxed and rtype.ruby_type == Float then
    asm.with_retry do
      asm.mov(XMM0, offarg)
    end
    context.ret_reg = XMM0
  else
    asm.with_retry do
      asm.mov(TMPR, offarg)
    end
    context.ret_reg = TMPR
  end

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

  context.ret_node = self
  context
end