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

Constants inherited from BaseNode

BaseNode::ESCAPE_LEVEL

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_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, offset, depth, val) ⇒ LocalAssignNode

Returns a new instance of LocalAssignNode.



3149
3150
3151
3152
3153
3154
# File 'lib/ytljit/vm.rb', line 3149

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



3187
3188
3189
3190
3191
3192
3193
3194
# File 'lib/ytljit/vm.rb', line 3187

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



3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
# File 'lib/ytljit/vm.rb', line 3161

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



3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
# File 'lib/ytljit/vm.rb', line 3196

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 != :global_export 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)


3156
3157
3158
3159
# File 'lib/ytljit/vm.rb', line 3156

def traverse_childlen
  yield @val
  yield @body
end