Class: YTLJit::VM::Node::TopTopNode

Inherits:
ClassTopNode show all
Includes:
MethodTopCodeGen
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 collapse

Attributes inherited from ClassTopNode

#constant_tab, #klass_object, #method_tab

Attributes inherited from TopNode

#end_nodes, #name, #orig_modified_local_var, #signature_cache, #yield_node

Attributes included from HaveChildlenMixin

#body

Attributes inherited from BaseNode

#code_space, #element_node_list, #id, #parent, #ti_observee, #ti_observer, #type

Instance Method Summary collapse

Methods included from MethodTopCodeGen

#gen_method_prologue

Methods inherited from ClassTopNode

#construct_frame_info, get_class_top_node, #get_constant_tab, #get_constant_value, #get_method_tab, #make_klassclass_node, #search_constant_with_super, #search_method_with_super

Methods included from SendNodeCodeGen

#dump_context, #gen_call, #gen_make_argv

Methods inherited from TopNode

#add_cs_for_signature, #construct_frame_info, #disp_signature, #find_cs_by_signature, #modified_instance_var

Methods included from NodeUtil

#search_class_top, #search_end, #search_frame_info, #search_top

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, klassobj, name = :top) ⇒ TopTopNode

Returns a new instance of TopTopNode.



1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
# File 'lib/ytljit/vm.rb', line 1073

def initialize(parent, klassobj, name = :top)
  super
  
  @code_space_tab = []
  @asm_tab = {}
  @id.push 0

  @unwind_proc = CodeSpace.new
  @init_node = nil
  init_unwind_proc
  add_code_space(nil, @unwind_proc)
end

Instance Attribute Details

#asm_tabObject (readonly)

Returns the value of attribute asm_tab.



1088
1089
1090
# File 'lib/ytljit/vm.rb', line 1088

def asm_tab
  @asm_tab
end

#code_space_tabObject (readonly)

Returns the value of attribute code_space_tab.



1087
1088
1089
# File 'lib/ytljit/vm.rb', line 1087

def code_space_tab
  @code_space_tab
end

#init_nodeObject

Returns the value of attribute init_node.



1086
1087
1088
# File 'lib/ytljit/vm.rb', line 1086

def init_node
  @init_node
end

Instance Method Details

#add_code_space(oldcs, newcs) ⇒ Object



1111
1112
1113
1114
1115
# File 'lib/ytljit/vm.rb', line 1111

def add_code_space(oldcs, newcs)
  if !@code_space_tab.include?(newcs) then
    @code_space_tab.push newcs
  end
end

#collect_candidate_type(context, signode, sig) ⇒ Object



1124
1125
1126
1127
1128
1129
1130
1131
# File 'lib/ytljit/vm.rb', line 1124

def collect_candidate_type(context, signode, sig)
  context.convergent = true
  context.visited_top_node = {}
  if @init_node then
    context = @init_node.collect_candidate_type(context, signode, sig)
  end
  super(context, signode, sig)
end

#collect_info(context) ⇒ Object



1117
1118
1119
1120
1121
1122
# File 'lib/ytljit/vm.rb', line 1117

def collect_info(context)
  if @init_node then
    context = @init_node.collect_info(context)
  end
  super(context)
end

#compile(context) ⇒ Object



1133
1134
1135
1136
1137
1138
1139
# File 'lib/ytljit/vm.rb', line 1133

def compile(context)
  if @init_node then
    context = @init_node.compile(context)
  end
  context = super(context)
  context
end

#init_unwind_procObject



1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
# File 'lib/ytljit/vm.rb', line 1097

def init_unwind_proc
  asm = Assembler.new(@unwind_proc)
  # Make linkage of frame pointer
  finfo = OpIndirect.new(TMPR3, AsmType::MACHINE_WORD.size)
  retadd = OpIndirect.new(TMPR3, AsmType::MACHINE_WORD.size)
  asm.with_retry do
    asm.mov(TMPR3, BPR)
    asm.mov(TMPR3, INDIRECT_TMPR3)
    asm.mov(TMPR, finfo)
    asm.mov(TMPR3, INDIRECT_TMPR3)
    asm.mov(TMPR2, retadd) # Return address store by call inst.
  end
end

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

Yields:



1090
1091
1092
1093
1094
1095
# File 'lib/ytljit/vm.rb', line 1090

def traverse_childlen
  if @init_node then
    yield @init_node
  end
  yield @body
end