Module: YTLJit::VM::TypeCodeGen::RangeTypeUnboxedCodeGen

Includes:
AbsArch, CommonCodeGen, RangeTypeCommonCodeGen, TypeUtil
Defined in:
lib/ytljit/vm_type_gen.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

Attributes included from RangeTypeCommonCodeGen

#args, #element_type

Instance Method Summary collapse

Methods included from RangeTypeCommonCodeGen

#==, #have_element?, #init, #inspect

Methods included from TypeUtil

#gen_copy_common

Methods included from CommonCodeGen

#dump_context, #gen_alloca, #gen_call, #gen_save_thepr

Instance Method Details

#copy_typeObject



539
540
541
542
543
544
545
# File 'lib/ytljit/vm_type_gen.rb', line 539

def copy_type
  dro = self.class.from_ruby_class(@ruby_type)
  dro = dro.to_unbox
  dro.element_type = @element_type
  dro.args = @args
  dro
end

#gen_boxing(context) ⇒ Object



493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
# File 'lib/ytljit/vm_type_gen.rb', line 493

def gen_boxing(context)
  rtype = @args[0].decide_type_once(context.to_signature)

  vnode = context.ret_node
  base = context.ret_reg
  addr = lambda {
    a = address_of("rb_range_new")
    $symbol_table[a] = "rb_range_new"
    a
  }
  rbrangenew = OpVarMemAddress.new(addr)
  begoff = OpIndirect.new(TMPR2, 0)
  endoff = OpIndirect.new(TMPR2, AsmType::MACHINE_WORD.size)
  excoff = OpIndirect.new(TMPR2, AsmType::MACHINE_WORD.size * 2)
 
  context.start_using_reg(TMPR2)
  context.start_arg_reg
  asm = context.assembler
  asm.with_retry do
    asm.mov(TMPR2, base)
  end

  context.ret_reg = begoff
  context = rtype.gen_boxing(context)
  asm.with_retry do
    asm.mov(FUNC_ARG[0], context.ret_reg)
  end

  context.ret_reg = endoff
  context = rtype.gen_boxing(context)
  asm.with_retry do
    asm.mov(FUNC_ARG[1], context.ret_reg)
  end

  asm.with_retry do
    asm.mov(FUNC_ARG[2], excoff)
  end
  context = gen_save_thepr(context)
  context = gen_call(context, rbrangenew, 3, vnode)

  context.end_arg_reg
  context.end_using_reg(TMPR2)
  context.ret_reg = RETR
  context
end

#instanceObject



486
487
488
489
490
491
# File 'lib/ytljit/vm_type_gen.rb', line 486

def instance
  ni = self.dup
  ni.instance_eval { extend RangeTypeUnboxedCodeGen }
  ni.init
  ni
end