mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
Unify length field for embedded and heap strings (#7908)
* Unify length field for embedded and heap strings The length field is of the same type and position in RString for both embedded and heap allocated strings, so we can unify it. * Remove RSTRING_EMBED_LEN
This commit is contained in:
parent
fae2f80d06
commit
7577c101ed
Notes:
git
2023-06-06 14:19:40 +00:00
Merged-By: maximecb <maximecb@ruby-lang.org>
9 changed files with 69 additions and 119 deletions
|
@ -2994,15 +2994,12 @@ module RubyVM::RJIT
|
|||
# @param ctx [RubyVM::RJIT::Context]
|
||||
# @param asm [RubyVM::RJIT::Assembler]
|
||||
def jit_rb_str_empty_p(jit, ctx, asm, argc, known_recv_class)
|
||||
# Assume same offset to len embedded or not so we can use one code path to read the length
|
||||
#assert_equal(C.RString.offsetof(:as, :heap, :len), C.RString.offsetof(:as, :embed, :len))
|
||||
|
||||
recv_opnd = ctx.stack_pop(1)
|
||||
out_opnd = ctx.stack_push(Type::UnknownImm)
|
||||
|
||||
asm.comment('get string length')
|
||||
asm.mov(:rax, recv_opnd)
|
||||
str_len_opnd = [:rax, C.RString.offsetof(:as, :heap, :len)]
|
||||
str_len_opnd = [:rax, C.RString.offsetof(:len)]
|
||||
|
||||
asm.cmp(str_len_opnd, 0)
|
||||
asm.mov(:rax, Qfalse)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue