summaryrefslogtreecommitdiff
path: root/yjit_codegen.c
diff options
context:
space:
mode:
authorJohn Hawthorn <[email protected]>2021-05-21 20:18:58 -0700
committerAlan Wu <[email protected]>2021-10-20 18:19:39 -0400
commit69a2531249f17cb3a3bf0fde85256d5a20324344 (patch)
tree7fb640a3a0e24439f9b39ca65fd098d903a86b3c /yjit_codegen.c
parent2c93ef7ab33a122f6f37fd7cab0bef48c3965a36 (diff)
Implement gen_putstring
Diffstat (limited to 'yjit_codegen.c')
-rw-r--r--yjit_codegen.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/yjit_codegen.c b/yjit_codegen.c
index 692389fed9..e79e716794 100644
--- a/yjit_codegen.c
+++ b/yjit_codegen.c
@@ -1093,6 +1093,25 @@ gen_putobject(jitstate_t* jit, ctx_t* ctx)
}
static codegen_status_t
+gen_putstring(jitstate_t* jit, ctx_t* ctx)
+{
+ VALUE put_val = jit_get_arg(jit, 0);
+
+ // Save the PC and SP because the callee will allocate
+ jit_save_pc(jit, REG0);
+ jit_save_sp(jit, ctx);
+
+ mov(cb, C_ARG_REGS[0], REG_EC);
+ jit_mov_gc_ptr(jit, cb, C_ARG_REGS[1], put_val);
+ call_ptr(cb, REG0, (void *)rb_ec_str_resurrect);
+
+ x86opnd_t stack_top = ctx_stack_push(ctx, TYPE_STRING);
+ mov(cb, stack_top, RAX);
+
+ return YJIT_KEEP_COMPILING;
+}
+
+static codegen_status_t
gen_putobject_int2fix(jitstate_t* jit, ctx_t* ctx)
{
int opcode = jit_get_opcode(jit);
@@ -4001,6 +4020,7 @@ yjit_init_codegen(void)
yjit_reg_op(BIN(concatstrings), gen_concatstrings);
yjit_reg_op(BIN(putnil), gen_putnil);
yjit_reg_op(BIN(putobject), gen_putobject);
+ yjit_reg_op(BIN(putstring), gen_putstring);
yjit_reg_op(BIN(putobject_INT2FIX_0_), gen_putobject_int2fix);
yjit_reg_op(BIN(putobject_INT2FIX_1_), gen_putobject_int2fix);
yjit_reg_op(BIN(putself), gen_putself);