Module: YTLJit::VM::TypeCodeGen::ArrayTypeUnboxedCodeGen

Includes:
SendNodeCodeGen, ArrayTypeCommonCodeGen
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 ArrayTypeCommonCodeGen

#element_type

Instance Method Summary collapse

Methods included from SendNodeCodeGen

#gen_make_argv

Methods included from CommonCodeGen

#dump_context, #gen_alloca, #gen_call, #gen_save_thepr

Methods included from ArrayTypeCommonCodeGen

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

Methods included from TypeUtil

#gen_copy_common

Instance Method Details

#copy_typeObject



416
417
418
419
420
421
# File 'lib/ytljit/vm_type_gen.rb', line 416

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

#gen_boxing(context) ⇒ Object



353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
# File 'lib/ytljit/vm_type_gen.rb', line 353

def gen_boxing(context)
#          raise "foo"
  return context
  cursig = context.to_signature
  asm = context.assembler
  val = context.ret_reg
  vnode = context.ret_node
  etypel = []
  vnode.element_node_list[1..-1].each do |a|
    if a[3] then
      curidx = a[3][0]
      if etypel[curidx] == nil then
        etypel[curidx] = a[2].decide_type_once(a[1])
      end
    end
  end
  siz = etypel.size

  context.start_using_reg(TMPR3)
  context.start_using_reg(TMPR2)
  asm.with_retry do
    asm.mov(TMPR3, val)
  end

  argcomp = lambda {|context, arg, idx|
    eleacc = OpIndirect.new(TMPR3, idx * AsmType::MACHINE_WORD.size)
    asm.with_retry do
      asm.mov(TMPR2, eleacc)
    end
    context.ret_reg = TMPR2
    arg
  }

  context = gen_make_argv(context, etypel, argcomp) do |context, rarg|
    context.start_arg_reg
    context.cpustack_pushn(2 * AsmType::MACHINE_WORD.size)

    addr = lambda {
      a = address_of("rb_ary_new4")
      $symbol_table[a] = "rb_ary_new4"
      a
    }
    rbarynew = OpVarMemAddress.new(addr)
    asm.with_retry do
      asm.mov(FUNC_ARG[0], siz)
      asm.mov(FUNC_ARG[1], TMPR2)
    end

    context = gen_save_thepr(context)
    context = gen_call(context, rbarynew, 2, vnode)
    context.cpustack_popn(2 * AsmType::MACHINE_WORD.size)
    context.end_arg_reg
    context.ret_reg = RETR
    context.set_reg_content(context.ret_reg, vnode)
    context
  end

  context.end_using_reg(TMPR2)
  context.end_using_reg(TMPR3)
  context
end

#instanceObject



346
347
348
349
350
351
# File 'lib/ytljit/vm_type_gen.rb', line 346

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