summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com>2022-07-20 16:43:19 -0400
committerTakashi Kokubun <takashikkbn@gmail.com>2022-08-29 08:47:03 -0700
commit85872eecddf0e5a13ba2218bb2068e99d5ce1313 (patch)
treecfc729a7e38147cf4a72d3fe5e947b42e0497049
parent8d2560f1f533c078ed23d71084129ce13ba33abf (diff)
Port over newrange
-rw-r--r--yjit/src/codegen.rs22
1 files changed, 14 insertions, 8 deletions
diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs
index d1965d3be3..611c42c562 100644
--- a/yjit/src/codegen.rs
+++ b/yjit/src/codegen.rs
@@ -1253,32 +1253,38 @@ fn gen_splatarray(
KeepCompiling
}
+*/
// new range initialized from top 2 values
fn gen_newrange(
jit: &mut JITState,
ctx: &mut Context,
- cb: &mut CodeBlock,
+ asm: &mut Assembler,
_ocb: &mut OutlinedCb,
) -> CodegenStatus {
let flag = jit_get_arg(jit, 0);
// rb_range_new() allocates and can raise
- jit_prepare_routine_call(jit, ctx, cb, REG0);
+ jit_prepare_routine_call(jit, ctx, asm);
// val = rb_range_new(low, high, (int)flag);
- mov(cb, C_ARG_REGS[0], ctx.stack_opnd(1));
- mov(cb, C_ARG_REGS[1], ctx.stack_opnd(0));
- mov(cb, C_ARG_REGS[2], uimm_opnd(flag.into()));
- call_ptr(cb, REG0, rb_range_new as *const u8);
+ let range_opnd = asm.ccall(
+ rb_range_new as *const u8,
+ vec![
+ ctx.stack_opnd(1),
+ ctx.stack_opnd(0),
+ flag.into()
+ ]
+ );
ctx.stack_pop(2);
let stack_ret = ctx.stack_push(Type::UnknownHeap);
- mov(cb, stack_ret, RAX);
+ asm.mov(stack_ret, range_opnd);
KeepCompiling
}
+/*
fn guard_object_is_heap(
cb: &mut CodeBlock,
object_opnd: X86Opnd,
@@ -5995,8 +6001,8 @@ fn get_gen_fn(opcode: VALUE) -> Option<InsnGenFn> {
YARVINSN_opt_str_freeze => Some(gen_opt_str_freeze),
YARVINSN_opt_str_uminus => Some(gen_opt_str_uminus),
YARVINSN_splatarray => Some(gen_splatarray),
- YARVINSN_newrange => Some(gen_newrange),
*/
+ YARVINSN_newrange => Some(gen_newrange),
YARVINSN_putstring => Some(gen_putstring),
/*
YARVINSN_expandarray => Some(gen_expandarray),