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

Includes:
AbsArch, CommonCodeGen, RangeTypeCommonCodeGen
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 CommonCodeGen

#dump_context, #gen_alloca, #gen_call, #gen_save_thepr

Instance Method Details

#copy_typeObject



464
465
466
467
468
469
470
# File 'lib/ytljit/vm_type_gen.rb', line 464

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



418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
# File 'lib/ytljit/vm_type_gen.rb', line 418

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



411
412
413
414
415
416
# File 'lib/ytljit/vm_type_gen.rb', line 411

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