Class: YTLJit::VM::Node::SetResultNode

Inherits:
BaseNode show all
Includes:
HaveChildlenMixin, NodeUtil
Defined in:
lib/ytljit/vm.rb

Overview

Set result of method/block

Constant Summary

Constants inherited from BaseNode

BaseNode::ESCAPE_LEVEL

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 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 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, #collect_info, #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, valnode) ⇒ SetResultNode

Returns a new instance of SetResultNode.



2170
2171
2172
2173
2174
# File 'lib/ytljit/vm.rb', line 2170

def initialize(parent, valnode)
  super(parent)
  @value_node = valnode
  @class_top_node = search_class_top
end

Instance Attribute Details

#value_nodeObject (readonly)

Returns the value of attribute value_node.



2176
2177
2178
# File 'lib/ytljit/vm.rb', line 2176

def value_node
  @value_node
end

Instance Method Details

#collect_candidate_type(context) ⇒ Object



2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
# File 'lib/ytljit/vm.rb', line 2183

def collect_candidate_type(context)
  cursig = context.to_signature
  context = @value_node.collect_candidate_type(context)
  same_type(self, @value_node, cursig, cursig, context)
  same_type(@value_node, self, cursig, cursig, context)

#          @type = nil
  rtype = decide_type_once(cursig)
  rrtype = rtype.ruby_type
  if !rtype.boxed and rrtype != Fixnum and rrtype != Float then
    set_escape_node_backward(:local_export)
  else
    set_escape_node_backward(:not_export)
  end
  @body.collect_candidate_type(context)
end

#compile(context) ⇒ Object



2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
# File 'lib/ytljit/vm.rb', line 2200

def compile(context)
  context = super(context)
  context = @value_node.compile(context)
  if context.ret_reg != RETR then
    if context.ret_reg.is_a?(OpRegXMM) then
=begin
         decide_type_once(context.to_signature)
         context = @type.gen_boxing(context)
         if context.ret_reg != RETR then
           curas = context.assembler
           curas.with_retry do
            curas.mov(RETR, context.ret_reg)
          end
           
           context.set_reg_content(RETR, context.ret_node)
         end
=end
      context.set_reg_content(context.ret_reg, context.ret_node)
    else
      curas = context.assembler
      curas.with_retry do
        curas.mov(RETR, context.ret_reg)
      end
      context.set_reg_content(RETR, context.ret_node)
      context.ret_reg = RETR
    end
  else
    context.set_reg_content(RETR, context.ret_node)
    context.ret_reg = RETR
  end

  @body.compile(context)
end

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

Yields:



2178
2179
2180
2181
# File 'lib/ytljit/vm.rb', line 2178

def traverse_childlen
  yield @value_node
  yield @body
end