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

Inherits:
ClassTopNode show all
Includes:
MethodTopCodeGen
Defined in:
lib/ytljit/vm.rb

Constant Summary collapse

@@frame_struct_tab =
{}
@@local_object_area =
Runtime::Arena.new

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, #klassclass, #klassclass_node, #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, #debug_info, #element_node_list, #id, #is_escape, #parent, #ti_observee, #ti_observer, #type

Class Method Summary collapse

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

#gen_make_argv

Methods included from CommonCodeGen

#dump_context, #gen_alloca, #gen_call

Methods inherited from TopNode

#add_arg_to_args, #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.



1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
# File 'lib/ytljit/vm.rb', line 1201

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

  @frame_struct_array = []
  @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.



1217
1218
1219
# File 'lib/ytljit/vm.rb', line 1217

def asm_tab
  @asm_tab
end

#code_space_tabObject (readonly)

Returns the value of attribute code_space_tab.



1216
1217
1218
# File 'lib/ytljit/vm.rb', line 1216

def code_space_tab
  @code_space_tab
end

#frame_struct_arrayObject (readonly)

Returns the value of attribute frame_struct_array.



1218
1219
1220
# File 'lib/ytljit/vm.rb', line 1218

def frame_struct_array
  @frame_struct_array
end

#init_nodeObject

Returns the value of attribute init_node.



1215
1216
1217
# File 'lib/ytljit/vm.rb', line 1215

def init_node
  @init_node
end

Class Method Details

.get_frame_struct_tabObject



1197
1198
1199
# File 'lib/ytljit/vm.rb', line 1197

def self.get_frame_struct_tab
  @@frame_struct_tab
end

Instance Method Details

#add_code_space(oldcs, newcs) ⇒ Object



1247
1248
1249
1250
1251
# File 'lib/ytljit/vm.rb', line 1247

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



1260
1261
1262
1263
1264
1265
1266
1267
# File 'lib/ytljit/vm.rb', line 1260

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



1253
1254
1255
1256
1257
1258
# File 'lib/ytljit/vm.rb', line 1253

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

#compile(context) ⇒ Object



1279
1280
1281
1282
1283
1284
# File 'lib/ytljit/vm.rb', line 1279

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

#compile_init(context) ⇒ Object



1269
1270
1271
1272
1273
1274
1275
1276
1277
# File 'lib/ytljit/vm.rb', line 1269

def compile_init(context)
  ar = @@local_object_area
  aa = (ar.address + ar.size) & (~0xf)
  asm = context.assembler
  asm.with_retry do
    asm.mov(THEPR, aa)
  end
  context
end

#init_unwind_procObject



1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
# File 'lib/ytljit/vm.rb', line 1233

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

#make_frame_struct_tabObject



1220
1221
1222
1223
1224
# File 'lib/ytljit/vm.rb', line 1220

def make_frame_struct_tab
  @frame_struct_array.each do |vkey, val|
    @@frame_struct_tab[vkey.value] = val
  end
end

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

Yields:



1226
1227
1228
1229
1230
1231
# File 'lib/ytljit/vm.rb', line 1226

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