diff options
| author | Takashi Kokubun <takashikkbn@gmail.com> | 2022-08-05 08:58:08 -0700 |
|---|---|---|
| committer | Takashi Kokubun <takashikkbn@gmail.com> | 2022-08-29 08:47:07 -0700 |
| commit | 7908eabf6f639cf7ec84714418b6b1aa28825af7 (patch) | |
| tree | 93c91c6b509ea8af8ccd0c159e9abfd55bc733ac | |
| parent | a55a3f8ad1104870d7a92f6d296325a415ed6910 (diff) | |
Port setivar to the new backend IR (https://github.com/Shopify/ruby/pull/362)
* Port setivar to the new backend IR
* Add a few more setivar test cases
* Prefer const_ptr
Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com>
| -rw-r--r-- | yjit/src/codegen.rs | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs index 33de061095..58bc036756 100644 --- a/yjit/src/codegen.rs +++ b/yjit/src/codegen.rs @@ -2139,11 +2139,10 @@ fn gen_getinstancevariable( ) } -/* fn gen_setinstancevariable( jit: &mut JITState, ctx: &mut Context, - cb: &mut CodeBlock, + asm: &mut Assembler, _ocb: &mut OutlinedCb, ) -> CodegenStatus { let id = jit_get_arg(jit, 0); @@ -2151,27 +2150,25 @@ fn gen_setinstancevariable( // Save the PC and SP because the callee may allocate // Note that this modifies REG_SP, which is why we do it first - jit_prepare_routine_call(jit, ctx, cb, REG0); + jit_prepare_routine_call(jit, ctx, asm); // Get the operands from the stack let val_opnd = ctx.stack_pop(1); // Call rb_vm_setinstancevariable(iseq, obj, id, val, ic); - mov( - cb, - C_ARG_REGS[1], - mem_opnd(64, REG_CFP, RUBY_OFFSET_CFP_SELF), + asm.ccall( + rb_vm_setinstancevariable as *const u8, + vec![ + Opnd::const_ptr(jit.iseq as *const u8), + Opnd::mem(64, CFP, RUBY_OFFSET_CFP_SELF), + Opnd::UImm(id.into()), + val_opnd, + Opnd::const_ptr(ic as *const u8), + ] ); - mov(cb, C_ARG_REGS[3], val_opnd); - mov(cb, C_ARG_REGS[2], uimm_opnd(id.into())); - mov(cb, C_ARG_REGS[4], const_ptr_opnd(ic as *const u8)); - let iseq = VALUE(jit.iseq as usize); - jit_mov_gc_ptr(jit, cb, C_ARG_REGS[0], iseq); - call_ptr(cb, REG0, rb_vm_setinstancevariable as *const u8); KeepCompiling } -*/ fn gen_defined( jit: &mut JITState, @@ -5977,7 +5974,7 @@ fn get_gen_fn(opcode: VALUE) -> Option<InsnGenFn> { YARVINSN_checkkeyword => Some(gen_checkkeyword), YARVINSN_concatstrings => Some(gen_concatstrings), YARVINSN_getinstancevariable => Some(gen_getinstancevariable), - //YARVINSN_setinstancevariable => Some(gen_setinstancevariable), + YARVINSN_setinstancevariable => Some(gen_setinstancevariable), /* YARVINSN_opt_eq => Some(gen_opt_eq), |
