Module: YTLJit::InternalRubyType

Includes:
AbsArch
Included in:
Runtime
Defined in:
lib/ytljit/asmutil.rb

Constant Summary collapse

VALUE =
AsmType::MACHINE_WORD
P_VOID =
AsmType::Pointer.new(VALUE)
P_VALUE =
AsmType::Pointer.new(VALUE)
P_CHAR =
AsmType::Pointer.new(AsmType::INT8)
RBasic =
AsmType::Struct.new(
 VALUE, :flags,
 VALUE, :klass
)
RString =
AsmType::Struct.new(
 RBasic, :basic,
 AsmType::Union.new(
  AsmType::Struct.new(
   AsmType::INT32, :len,
   P_CHAR, :ptr,
   AsmType::Union.new(
     AsmType::INT32, :capa,
     VALUE, :shared,
   ), :aux
  ), :heap,
  AsmType::Array.new(
     AsmType::INT8,
     24
  ), :ary
 ), :as
)
RFloat =
AsmType::Struct.new(
 RBasic, :basic,
 AsmType::DOUBLE, :float_value
)
Arena =
AsmType::Struct.new(
  AsmType::MACHINE_WORD, :used,
  AsmType::MACHINE_WORD, :size,
  AsmType::Array.new(AsmType::INT8, 0), :body
)
RData =
AsmType::Struct.new(
RBasic, :basic,
P_VOID, :dmark,
P_VOID, :dfree,
AsmType::Pointer.new(Arena), :data)
RObject =
AsmType::Struct.new(
  RBasic, :basic,
  AsmType::Union.new(
    AsmType::Struct.new(
      AsmType::INT32, :numiv,
      P_VALUE, :ivptr,
      P_VOID, :iv_index_tbl
    ), :heap,
    AsmType::Array.new(VALUE, 3), :ary
  ), :as
)
EMBEDER_FLAG =
(1 << 13)

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

Class Method Summary collapse

Class Method Details

.rstring_ptr(str, csstart, cscont) ⇒ Object



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/ytljit/asmutil.rb', line 197

def self.rstring_ptr(str, csstart, cscont)
  cs_embed = CodeSpace.new

  asm = Assembler.new(csstart)
  rsstr = TypedData.new(InternalRubyType::RString, str)
  # asm.step_mode = true
  asm.with_retry do
    asm.mov(TMPR, rsstr[:basic][:flags])
    asm.and(TMPR, EMBEDER_FLAG)
    asm.jz(cs_embed.var_base_address)
    asm.mov(TMPR, rsstr[:as][:heap][:ptr])
    asm.jmp(cscont.var_base_address)
  end

  asm = Assembler.new(cs_embed)
  # asm.step_mode = true
  asm.with_retry do
    asm.mov(TMPR, rsstr[:as][:ary])
    asm.jmp(cscont.var_base_address)
  end
end