Module: YTLJit::FunctionArgumentX86Mixin

Includes:
AbsArch
Defined in:
lib/ytljit/asmext_x86.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 Method Summary collapse

Instance Method Details

#dst_opecodeObject



15
16
17
# File 'lib/ytljit/asmext_x86.rb', line 15

def dst_opecode
  OpIndirect.new(SPR, OpImmidiate8.new(@no * size))
end

#gen_access_dst(gen, inst, dst, src, src2) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/ytljit/asmext_x86.rb', line 26

def gen_access_dst(gen, inst, dst, src, src2)
  argdst =  dst_opecode
  code = ""
  asm = gen.asm
  fainfo = gen.funcarg_info
  if @no == 0 then
    offset = asm.offset
    code += asm.update_state(gen.sub(SPR, fainfo.maxargs * size))
    fainfo.area_allocate_pos.push offset
    fainfo.used_arg_tab.push Hash.new
  end

  if asm.retry_mode != :change_op then
    # if retry mode fainfo.used_arg_tab is deleted
    fainfo.used_arg_tab.last[@no] = size
  end
  if src.is_a?(OpRegXMM) then
    code += asm.update_state(gen.movsd(argdst, src))
  else
    if inst == :mov and !src.is_a?(OpRegistor) then
      code += asm.update_state(gen.send(inst, TMPR, src))
      code += asm.update_state(gen.mov(argdst, TMPR))
    else
      code += asm.update_state(gen.mov(argdst, src))
    end
  end
  code
end

#gen_access_src(gen, inst, dst, src, src2) ⇒ Object

Access the passing argument from caller You can use only between entering the function and change value of

stack pointer.


59
60
61
62
63
64
65
66
# File 'lib/ytljit/asmext_x86.rb', line 59

def gen_access_src(gen, inst, dst, src, src2)
  asm = gen.asm
  fainfo = gen.funcarg_info
  code = ""
  code += asm.update_state(gen.mov(TMPR, src_opecode))
  code += asm.update_state(gen.send(inst, dst, TMPR))
  code
end

#sizeObject



5
6
7
8
9
10
11
12
13
# File 'lib/ytljit/asmext_x86.rb', line 5

def size
  case @abi_kind
  when :c 
    AsmType::MACHINE_WORD.size

  when :ytl, :cfloat
    8
  end
end

#src_opecodeObject



20
21
22
23
24
# File 'lib/ytljit/asmext_x86.rb', line 20

def src_opecode
  # AsmType::MACHINE_WORD.size is return address slot
  offset = AsmType::MACHINE_WORD.size + @no * size
  OpIndirect.new(SPR, offset)
end