Module: YTLJit::InternalRubyType

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

Constant Summary collapse

VALUE =
AsmType::MACHINE_WORD
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
)
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

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



160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/ytljit/asmutil.rb', line 160

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