summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2023-06-06 10:19:20 -0400
committerGitHub <noreply@github.com>2023-06-06 10:19:20 -0400
commit7577c101ed6452de3e72fadb43db595946acc701 (patch)
treedeed85a09fc431132145897d7e1982fd61c74e0c /lib
parentfae2f80d06f5058b40e91f62ba27fb01f2463d12 (diff)
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
Notes
Notes: Merged-By: maximecb <maximecb@ruby-lang.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/ruby_vm/rjit/insn_compiler.rb5
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/ruby_vm/rjit/insn_compiler.rb b/lib/ruby_vm/rjit/insn_compiler.rb
index 619f5078dc..d9a2ab52ae 100644
--- a/lib/ruby_vm/rjit/insn_compiler.rb
+++ b/lib/ruby_vm/rjit/insn_compiler.rb
@@ -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)