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, #decide_type, #decide_type_core, #decide_type_once, #gen_type_inference_proc, #get_constant_value, #inference_type, #marge_element_node, #marge_type, #same_type, #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.



3404
3405
3406
3407
3408
3409
3410
# File 'lib/ytljit/vm.rb', line 3404

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

Instance Attribute Details

#offsetObject (readonly)

Returns the value of attribute offset.



3412
3413
3414
# File 'lib/ytljit/vm.rb', line 3412

def offset
  @offset
end

Instance Method Details

#collect_candidate_type(context) ⇒ Object



3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
# File 'lib/ytljit/vm.rb', line 3425

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

#collect_info(context) ⇒ Object



3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
# File 'lib/ytljit/vm.rb', line 3414

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

#compile(context) ⇒ Object



3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
# File 'lib/ytljit/vm.rb', line 3436

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