Class: YTLJit::VM::Node::GlobalVarNormalRefNode

Inherits:
GlobalVarRefNode show all
Includes:
NodeUtil, TypeListWithoutSignature, UnboxedArrayUtil
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

Constants inherited from BaseNode

BaseNode::ESCAPE_LEVEL

Instance Attribute Summary

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 UnboxedArrayUtil

#compile_array_unboxed, #gen_ref_element, #gen_set_element

Methods included from UnboxedObjectUtil

#compile_object_unboxed

Methods included from TypeListWithoutSignature

#add_type, #set_type_list, #type_list, #type_list_initvar

Methods included from NodeUtil

#search_class_top, #search_end, #search_frame_info, #search_top

Methods inherited from GlobalVarRefNode

#collect_info, instance

Methods inherited from BaseNode

#add_element_node, #add_element_node_backward, #add_element_node_backward_aux, #collect_info, #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, name) ⇒ GlobalVarNormalRefNode

Returns a new instance of GlobalVarNormalRefNode.



3849
3850
3851
3852
3853
3854
# File 'lib/ytljit/vm.rb', line 3849

def initialize(parent, name)
  super(parent)
  @name = name
  @assign_nodes = nil
  @offset = nil
end

Instance Method Details

#collect_candidate_type(context) ⇒ Object



3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
# File 'lib/ytljit/vm.rb', line 3856

def collect_candidate_type(context)
  if @assign_nodes then
    @offset = @assign_nodes[0][0].offset
    sig = context.to_signature
    @assign_nodes.reverse.each do |an, asig|
      same_type(self, an, sig, asig, context)
    end
  end
  context
end

#compile(context) ⇒ Object



3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
# File 'lib/ytljit/vm.rb', line 3867

def compile(context)
  sig = context.to_signature
  asm = context.assembler
  context.start_using_reg(TMPR2)
  asm.with_retry do
    asm.mov(TMPR2, context.top_node.get_global_arena_end_address)
  end
  context.set_reg_content(TMPR2, :global_arena)
  context = gen_ref_element(context, nil, -@offset)
  context.end_using_reg(TMPR2)
  rtype = decide_type_once(sig)
  if rtype.ruby_type == Float and !rtype.boxed then
    asm.with_retry do
      asm.mov(XMM0, context.ret_reg)
    end
    context.ret_reg = XMM0
  else
    asm.with_retry do
      asm.mov(RETR, context.ret_reg)
    end
    context.ret_reg = RETR
  end
  context
end