Class: YTLJit::VM::Node::GlobalVarAssignNode

Inherits:
VariableRefCommonNode show all
Includes:
HaveChildlenMixin, 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 collapse

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 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 HaveChildlenMixin

#traverse_childlen

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, #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, name, value) ⇒ GlobalVarAssignNode

Returns a new instance of GlobalVarAssignNode.



3953
3954
3955
3956
3957
3958
3959
3960
# File 'lib/ytljit/vm.rb', line 3953

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

Instance Attribute Details

#offsetObject (readonly)

Returns the value of attribute offset.



3962
3963
3964
# File 'lib/ytljit/vm.rb', line 3962

def offset
  @offset
end

Instance Method Details

#collect_candidate_type(context) ⇒ Object



3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
# File 'lib/ytljit/vm.rb', line 3977

def collect_candidate_type(context)
  sig = context.to_signature
  @assign_nodes[@assign_no][1] = sig
  context = @value.collect_candidate_type(context)
  same_type(self, @value, sig, sig, context)
  if @offset == nil then
    @offset = @assign_nodes[0][0].offset
  end
  @body.collect_candidate_type(context)
end

#collect_info(context) ⇒ Object



3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
# File 'lib/ytljit/vm.rb', line 3964

def collect_info(context)
  context = @value.collect_info(context)
  context.modified_global_var[@name] ||= []
  @assign_nodes = context.modified_global_var[@name]
  asize = @assign_nodes.size
  if asize == 0 then
    @offset = context.modified_global_var.keys.size - 1
  end
  @assign_no  = asize
  @assign_nodes.push [self, nil]
  @body.collect_info(context)
end

#compile(context) ⇒ Object



3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
# File 'lib/ytljit/vm.rb', line 3988

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)
  contet = gen_set_element(context, nil, -@offset, @value)
  context.end_using_reg(TMPR2)
  @body.compile(context)
end