ruby-changes:73256
From: Takashi <ko1@a...>
Date: Tue, 30 Aug 2022 01:05:10 +0900 (JST)
Subject: [ruby-changes:73256] 7908eabf6f (master): Port setivar to the new backend IR (https://github.com/Shopify/ruby/pull/362)
https://git.ruby-lang.org/ruby.git/commit/?id=7908eabf6f From 7908eabf6f639cf7ec84714418b6b1aa28825af7 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun <takashikkbn@g...> Date: Fri, 5 Aug 2022 08:58:08 -0700 Subject: 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@g...> --- yjit/src/codegen.rs | 27 ++++++++++++--------------- 1 file 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( https://github.com/ruby/ruby/blob/trunk/yjit/src/codegen.rs#L2139 ) } -/* 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( https://github.com/ruby/ruby/blob/trunk/yjit/src/codegen.rs#L2150 // 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> { https://github.com/ruby/ruby/blob/trunk/yjit/src/codegen.rs#L5974 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), -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/