1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Port gen_concatstring to new backend IR (https://github.com/Shopify/ruby/pull/350)

* Port gen_concatstring to new backend IR

* Update yjit/src/codegen.rs

Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com>
This commit is contained in:
Zack Deveau 2022-08-02 13:09:51 -04:00 committed by Takashi Kokubun
parent 330c9e9850
commit dea4238544
No known key found for this signature in database
GPG key ID: 6FFC433B12EE23DD
2 changed files with 18 additions and 9 deletions

View file

@ -3103,3 +3103,11 @@ assert_equal '/true/', %q{
end
foo().inspect
}
# concatstrings
assert_equal '9001', %q{
def foo()
"#{9001}"
end
foo()
}

View file

@ -2278,32 +2278,33 @@ fn gen_checktype(
}
}
/*
fn gen_concatstrings(
jit: &mut JITState,
ctx: &mut Context,
cb: &mut CodeBlock,
asm: &mut Assembler,
_ocb: &mut OutlinedCb,
) -> CodegenStatus {
let n = jit_get_arg(jit, 0);
// Save the PC and SP because we are allocating
jit_prepare_routine_call(jit, ctx, cb, REG0);
jit_prepare_routine_call(jit, ctx, asm);
let values_ptr = ctx.sp_opnd(-((SIZEOF_VALUE as isize) * n.as_isize()));
// call rb_str_concat_literals(long n, const VALUE *strings);
mov(cb, C_ARG_REGS[0], imm_opnd(n.into()));
lea(cb, C_ARG_REGS[1], values_ptr);
call_ptr(cb, REG0, rb_str_concat_literals as *const u8);
let return_value = asm.ccall(
rb_str_concat_literals as *const u8,
vec![Opnd::UImm(n.into()), values_ptr]
);
ctx.stack_pop(n.as_usize());
let stack_ret = ctx.stack_push(Type::CString);
mov(cb, stack_ret, RAX);
asm.mov(stack_ret, return_value);
KeepCompiling
}
*/
fn guard_two_fixnums(ctx: &mut Context, asm: &mut Assembler, side_exit: CodePtr) {
// Get the stack operand types
@ -6015,8 +6016,8 @@ fn get_gen_fn(opcode: VALUE) -> Option<InsnGenFn> {
//YARVINSN_expandarray => Some(gen_expandarray),
YARVINSN_defined => Some(gen_defined),
YARVINSN_checkkeyword => Some(gen_checkkeyword),
/*
YARVINSN_concatstrings => Some(gen_concatstrings),
/*
YARVINSN_getinstancevariable => Some(gen_getinstancevariable),
YARVINSN_setinstancevariable => Some(gen_setinstancevariable),