Class: YTLJit::VM::Node::LocalLabel

Inherits:
BaseNode 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

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, #element_node_list, #id, #parent, #type

Instance Method Summary collapse

Methods inherited from BaseNode

#add_element_node, #add_type, #decide_type, #decide_type_core, #decide_type_once, #gen_type_inference_proc, #inference_type, #merge_type, #same_type, #set_type_list, #ti_add_observer, #ti_changed, #ti_update, #type_list

Methods included from Inspect

#inspect_by_graph

Constructor Details

#initialize(parent, name) ⇒ LocalLabel

Returns a new instance of LocalLabel.



932
933
934
935
936
937
938
939
940
941
# File 'lib/ytljit/vm.rb', line 932

def initialize(parent, name)
  super(parent)
  @name = name
  @come_from = {}
  @come_from_val = []
  @code_space = CodeSpace.new
  @value_node = PhiNode.new(self)
  @modified_local_var_list = []
  @modified_instance_var_list = []
end

Instance Attribute Details

#come_fromObject (readonly)

Returns the value of attribute come_from.



944
945
946
# File 'lib/ytljit/vm.rb', line 944

def come_from
  @come_from
end

#nameObject (readonly)

Returns the value of attribute name.



943
944
945
# File 'lib/ytljit/vm.rb', line 943

def name
  @name
end

#value_nodeObject (readonly)

Returns the value of attribute value_node.



945
946
947
# File 'lib/ytljit/vm.rb', line 945

def value_node
  @value_node
end

Instance Method Details

#collect_candidate_type(context, sender = nil) ⇒ Object



994
995
996
997
998
999
1000
# File 'lib/ytljit/vm.rb', line 994

def collect_candidate_type(context, sender = nil)
  if @come_from.keys[0] == sender then
    context = @body.collect_candidate_type(context)
  end

  context
end

#collect_info(context) ⇒ Object



952
953
954
955
956
957
958
959
960
961
962
963
964
# File 'lib/ytljit/vm.rb', line 952

def collect_info(context)
  modlocvar = context.modified_local_var.map {|ele| ele.dup}
  @modified_local_var_list.push modlocvar
  modinsvar = context.modified_instance_var.dup
  @modified_instance_var_list.push modinsvar
  if @modified_instance_var_list.size == @come_from.size then
    context.merge_local_var(@modified_local_var_list)
    context.merge_instance_var(@modified_instance_var_list)
    @body.collect_info(context)
  else
    context
  end
end

#compile(context) ⇒ Object



1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
# File 'lib/ytljit/vm.rb', line 1002

def compile(context)
  context = super(context)
  @come_from_val.push context.ret_reg

  # When all node finish to compile, next node compile
  if @come_from_val.size == @come_from.size then
    @body.compile(context)
  else
    context
  end

  context
end

#compile_block_value(context, comefrom) ⇒ Object



966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
# File 'lib/ytljit/vm.rb', line 966

def compile_block_value(context, comefrom)
  valnode = @come_from[comefrom]
  if valnode then
    context = valnode.compile(context)
    asm = context.assembler
    if !context.ret_reg.is_a?(OpRegXMM) then
      if RETR != context.ret_reg then
        asm.with_retry do
          asm.mov(RETR, context.ret_reg)
        end
        context.set_reg_content(RETR, context.ret_node)
        context.ret_reg = RETR
      end
    end
  end

  context
end

#traverse_block_value(comefrom, &block) ⇒ Object



985
986
987
988
989
990
991
992
# File 'lib/ytljit/vm.rb', line 985

def traverse_block_value(comefrom, &block)
  valnode = @come_from[comefrom]
  if valnode then
    yield valnode
  else
    nil
  end
end

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

Yields:



947
948
949
950
# File 'lib/ytljit/vm.rb', line 947

def traverse_childlen
  yield @body
  yield @value_node
end