Module: YTLJit::VM::CommonCodeGen

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 Method Summary collapse

Instance Method Details

#dump_context(context) ⇒ Object



595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
# File 'lib/ytljit/vm_codegen.rb', line 595

def dump_context(context)
  print "---- Reg map ----\n"
  context.reg_content.each do |key, value|
    print "#{key}   #{value.class} \n"
  end

  print "---- Stack map ----\n"
=begin
  @frame_info.frame_layout.each_with_index do |vinf, i|
    ro = @frame_info.real_offset(i)
    if mlv = @modified_local_var.last[0][ro] then
      print "    #{mlv.class} \n"
    else
      print "    #{vinf.class} \n"
    end
  end
=end
  context.stack_content.each do |value|
    print "    #{value.class} \n"
  end
end

#gen_alloca(context, siz) ⇒ Object



560
561
562
563
564
565
566
567
568
# File 'lib/ytljit/vm_codegen.rb', line 560

def gen_alloca(context, siz)
  asm = context.assembler
  siz = siz * AsmType::MACHINE_WORD.size
  asm.with_retry do
    asm.sub(THEPR, siz)
  end
  context.ret_reg = THEPR
  context
end

#gen_call(context, fnc, numarg, slf = nil) ⇒ Object



570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
# File 'lib/ytljit/vm_codegen.rb', line 570

def gen_call(context, fnc, numarg, slf = nil)
  casm = context.assembler

  callpos = nil
  casm.with_retry do 
    dmy, callpos = casm.call_with_arg(fnc, numarg)
  end
  context.end_using_reg(fnc)
  vretadd = casm.output_stream.var_base_address(callpos)
  cpuinfo = []
  if slf then
    cpuinfo.push slf
  else
    cpuinfo.push self
  end
  cpuinfo.push context.reg_content.dup
  cpuinfo.push context.stack_content.dup
  context.top_node.frame_struct_array.push [vretadd, cpuinfo]
  
  if context.options[:dump_context] then
    dump_context(context)
  end
  context
end