Module: YTLJit::FunctionArgumentX64MixinCommon

Includes:
FuncArgX64CommonMixin
Defined in:
lib/ytljit/asmext_x64.rb

Constant Summary

Constants included from FuncArgX64CommonMixin

YTLJit::FuncArgX64CommonMixin::ARGPOS2FREG, YTLJit::FuncArgX64CommonMixin::ARGPOS2REG

Constants included from X64

X64::INDIRECT_RAX, X64::INDIRECT_RBP, X64::INDIRECT_RBX, X64::INDIRECT_RCX, X64::INDIRECT_RDI, X64::INDIRECT_RDX, X64::INDIRECT_RSI, X64::INDIRECT_RSP, X64::R10, X64::R11, X64::R12, X64::R13, X64::R14, X64::R15, X64::R8, X64::R9, X64::RAX, X64::RBP, X64::RBX, X64::RCX, X64::RDI, X64::RDX, X64::RSI, X64::RSP

Constants included from SSE64

SSE64::XMM10, SSE64::XMM11, SSE64::XMM12, SSE64::XMM13, SSE64::XMM14, SSE64::XMM15, SSE64::XMM8, SSE64::XMM9

Constants included from SSE

SSE::XMM0, SSE::XMM1, SSE::XMM2, SSE::XMM3, SSE::XMM4, SSE::XMM5, SSE::XMM6, SSE::XMM7

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

Instance Method Summary collapse

Instance Method Details

#dst_opecodeObject



52
53
54
55
56
57
58
59
# File 'lib/ytljit/asmext_x64.rb', line 52

def dst_opecode
  if @no < argpos2reg.size then
    argpos2reg[@no]
  else
    spos = @no - argpos2reg.size
    OpIndirect.new(SPR, OpImmidiate8.new(spos * 8))
  end
end

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



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/ytljit/asmext_x64.rb', line 71

def gen_access_dst(gen, inst, dst, src, src2)
  code = ""
  asm = gen.asm
  fainfo = gen.funcarg_info

  if @no == 0 then
    fainfo.area_allocate_pos.push nil
    fainfo.used_arg_tab.push Hash.new
  end

  # It can be argpos2reg.size == 0, so this "if" isn't "elsif"
  if @no == argpos2reg.size then
    offset = asm.offset
    code += asm.update_state(gen.sub(SPR, 0))
    fainfo.area_allocate_pos[-1] = offset
  end

  if @no < argpos2reg.size then
    argreg = argpos2reg[@no]

=begin        
    # for nested function call. need save previous reg.
    if asm.retry_mode != :change_op and 
        fainfo.used_arg_tab.last[@no] then
      asm.update_state(gen.push(argreg))
      fainfo.push argreg
    end
=end
    code += asm.update_state(gen.mov(argreg, src))
  else
    # spilled reg 
    spos = @no - argpos2reg.size
    argdst = OpIndirect.new(SPR, OpImmidiate8.new(spos * 8))

    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
  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
  code
end

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

Access the passing argument from caller



126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/ytljit/asmext_x64.rb', line 126

def gen_access_src(gen, inst, dst, src, src2)
  asm = gen.asm
  fainfo = gen.funcarg_info
  code = ""
  if @no < argpos2reg.size then
    code += asm.update_state(gen.mov(TMPR, argpos2reg[@no]))
  else
    spos = @no - argpos2reg.size
    offset = 8 + spos * 8
    code += asm.update_state(gen.mov(TMPR, OpIndirect.new(SPR, offset)))
  end
  code += asm.update_state(gen.send(inst, src, TMPR))
  code
end

#src_opecodeObject



61
62
63
64
65
66
67
68
69
# File 'lib/ytljit/asmext_x64.rb', line 61

def src_opecode
  if @no < argpos2reg.size then
    argpos2reg[@no]
  else
    # +1 means return address slot
    spos = @no - argpos2reg.size + 1
    OpIndirect.new(SPR, OpImmidiate8.new(spos * 8))
  end
end