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, #element_node_list, #id, #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, #decide_type, #decide_type_core, #decide_type_once, #gen_type_inference_proc, #get_constant_value, #inference_type, #merge_type, #same_type, #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.



2223
2224
2225
2226
2227
# File 'lib/ytljit/vm.rb', line 2223

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

Instance Method Details

#collect_candidate_type(context) ⇒ Object



2256
2257
2258
2259
2260
2261
2262
# File 'lib/ytljit/vm.rb', line 2256

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

#collect_info(context) ⇒ Object



2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
# File 'lib/ytljit/vm.rb', line 2234

def collect_info(context)
  context = @val.collect_info(context)
  top = @frame_info.parent

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

  @body.collect_info(context)
end

#compile(context) ⇒ Object



2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
# File 'lib/ytljit/vm.rb', line 2264

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

  decide_type_once(context.to_signature)
  if @type.boxed then
    @val.decide_type_once(context.to_signature)
    rtype = @val.type
    context = rtype.gen_boxing(context)
  end

  valr = context.ret_reg
  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
  
  context.ret_reg = nil
  if base == TMPR2 then
    context.end_using_reg(base)
  end

  @body.compile(context)
end

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

Yields:

  • (@val)


2229
2230
2231
2232
# File 'lib/ytljit/vm.rb', line 2229

def traverse_childlen
  yield @val
  yield @body
end