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, AbsArch::INDIRECT_TMPR3

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, #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, #decide_type, #decide_type_core, #decide_type_once, #gen_type_inference_proc, #get_constant_value, #inference_type, #marge_type, #same_type, #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, val) ⇒ LocalAssignNode

Returns a new instance of LocalAssignNode.



3065
3066
3067
3068
3069
3070
# File 'lib/ytljit/vm.rb', line 3065

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

Instance Method Details

#collect_candidate_type(context) ⇒ Object



3103
3104
3105
3106
3107
3108
3109
3110
# File 'lib/ytljit/vm.rb', line 3103

def collect_candidate_type(context)
  context = @val.collect_candidate_type(context)
  cursig = context.to_signature
  varcursig = context.to_signature(@var_from)
  same_type(self, @val, varcursig, cursig, context)
#          same_type(@val, self, cursig, varcursig, context)
  @body.collect_candidate_type(context)
end

#collect_info(context) ⇒ Object



3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
# File 'lib/ytljit/vm.rb', line 3077

def collect_info(context)
  context = @val.collect_info(context)
  top = @frame_info
  @depth.times do |i|
    top = top.previous_frame
  end
  @var_from = top.parent

  nodepare = nil
  if @depth > 0 then 
    nodepare = context.modified_local_var.last[-@depth - 1]
  end
  if nodepare then
    nodepare = nodepare[@offset]
  end
  if nodepare then
    nodepare.push [@var_from, self]
  else
    nodepare = [[@var_from, self]]
  end
    
  context.modified_local_var.last[-@depth - 1][@offset] = nodepare

  @body.collect_info(context)
end

#compile(context) ⇒ Object



3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
# File 'lib/ytljit/vm.rb', line 3112

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

  sig = context.to_signature(-@depth - 1)
  decide_type_once(sig)
  rtype = @val.decide_type_once(context.to_signature)
  if @type.boxed then
    if @val.is_escape != true then
      context = rtype.gen_boxing(context)
    end
  else
    context = rtype.gen_unboxing(context)
  end

  valr = context.ret_reg
  valn = context.ret_node
  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) and !valr.is_a?(OpImmidiate64)) 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

  tmpctx = context
  @depth.times { tmpctx = tmpctx.prev_context}
  tmpctx.set_reg_content(offarg, valn)

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

  @body.compile(context)
end

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

Yields:

  • (@val)


3072
3073
3074
3075
# File 'lib/ytljit/vm.rb', line 3072

def traverse_childlen
  yield @val
  yield @body
end