YJIT: Protect strings from GC on String#<< (#7466)

Fix https://github.com/Shopify/yjit/issues/310

[Bug #19483]

Co-authored-by: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>
Co-authored-by: Jimmy Miller <jimmy.miller@shopify.com>
This commit is contained in:
Takashi Kokubun 2023-03-07 13:10:07 -08:00 committed by GitHub
parent 85a1738ab3
commit 33edcc1120
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
Notes: git 2023-03-07 21:10:28 +00:00
Merged-By: maximecb <maximecb@ruby-lang.org>

View File

@ -4288,6 +4288,9 @@ fn jit_rb_str_concat(
// Guard that the argument is of class String at runtime.
let arg_type = ctx.get_opnd_type(StackOpnd(0));
// Guard buffers from GC since rb_str_buf_append may allocate.
gen_save_sp(asm, ctx);
let concat_arg = ctx.stack_pop(1);
let recv = ctx.stack_pop(1);