Module: YTLJit::VM::UnboxedArrayUtil

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

Methods included from UnboxedObjectUtil

#compile_object_unboxed

Instance Method Details

#compile_array_unboxed(context) ⇒ Object



198
199
200
201
# File 'lib/ytljit/vm_inline_method.rb', line 198

def compile_array_unboxed(context)
  siz = ((@element_node_list[1..-1].max_by {|a| a[3][0]})[3][0]) + 1
  compile_object_unboxed(context, siz)
end

#gen_ref_element(context, slf, idx) ⇒ Object



203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/ytljit/vm_inline_method.rb', line 203

def gen_ref_element(context, slf, idx)
  asm = context.assembler
  if slf then
    context.start_using_reg(TMPR2)
    context = slf.compile(context)
    asm.with_retry do
      asm.mov(TMPR2, context.ret_reg)
    end
  end

  if idx.is_a?(Fixnum) then
    idxval = idx
  else
    context = idx.compile(context)
    idxval = context.ret_reg
  end
  asm.with_retry do
    if idxval.is_a?(Fixnum) then
      asm.mov(TMPR, idxval * 8)
    elsif idxval.is_a?(OpImmidiate)
      asm.mov(TMPR, idxval.value * 8)
    else
      if idxval != TMPR then
        asm.mov(TMPR, idxval)
      end
      asm.add(TMPR, TMPR) # * 2
      asm.add(TMPR, TMPR) # * 4
      asm.add(TMPR, TMPR) # * 8
    end
    asm.add(TMPR, TMPR2)
  end

  if slf then
    context.end_using_reg(TMPR2)
  end
  context.ret_reg = INDIRECT_TMPR
  context.ret_node = self

  context
end

#gen_set_element(context, slf, idx, val) ⇒ Object



244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
# File 'lib/ytljit/vm_inline_method.rb', line 244

def gen_set_element(context, slf, idx, val)
  asm = context.assembler
  if slf then
    context.start_using_reg(TMPR2)
    context = slf.compile(context)
    asm.with_retry do
      asm.mov(TMPR2, context.ret_reg)
    end
  end
  if idx.is_a?(Fixnum) then
    idxval = idx
  else
    context = idx.compile(context)
    idxval = context.ret_reg
  end

  asm.with_retry do
    if idxval.is_a?(Fixnum) then
      asm.mov(TMPR, idxval * 8)
    elsif idxval.is_a?(OpImmidiate)
      asm.mov(TMPR, idxval.value * 8)
    else
      asm.mov(TMPR, idxval)
      asm.add(TMPR, TMPR) # * 2
      asm.add(TMPR, TMPR) # * 4
      asm.add(TMPR, TMPR) # * 8
    end
    asm.add(TMPR2, TMPR)
  end
  context = val.compile(context)

  valreg = context.ret_reg
  asm.with_retry do
    if !valreg.is_a?(OpRegistor) then
      asm.mov(RETR, valreg)
      valreg = RETR
    end

    asm.mov(INDIRECT_TMPR2, valreg)
  end

  if slf then
    context.end_using_reg(TMPR2)
  end
  context.ret_reg = valreg
  context.ret_node = self
  context
end