ruby-changes:73225
From: Noah <ko1@a...>
Date: Tue, 30 Aug 2022 01:03:06 +0900 (JST)
Subject: [ruby-changes:73225] c9a947e5d8 (master): Port and test checkkeyword (https://github.com/Shopify/ruby/pull/339)
https://git.ruby-lang.org/ruby.git/commit/?id=c9a947e5d8 From c9a947e5d81088907f774ddfbcd274a88ba7d8ff Mon Sep 17 00:00:00 2001 From: Noah Gibbs <the.codefolio.guy@g...> Date: Mon, 25 Jul 2022 15:38:09 +0100 Subject: Port and test checkkeyword (https://github.com/Shopify/ruby/pull/339) --- yjit/src/codegen.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs index e122d67910..e29e570de1 100644 --- a/yjit/src/codegen.rs +++ b/yjit/src/codegen.rs @@ -1765,13 +1765,12 @@ fn gen_putstring( https://github.com/ruby/ruby/blob/trunk/yjit/src/codegen.rs#L1765 KeepCompiling } -/* // Push Qtrue or Qfalse depending on whether the given keyword was supplied by // the caller fn gen_checkkeyword( jit: &mut JITState, ctx: &mut Context, - cb: &mut CodeBlock, + asm: &mut Assembler, _ocb: &mut OutlinedCb, ) -> CodegenStatus { // When a keyword is unspecified past index 32, a hash will be used @@ -1787,27 +1786,26 @@ fn gen_checkkeyword( https://github.com/ruby/ruby/blob/trunk/yjit/src/codegen.rs#L1786 let index: i64 = jit_get_arg(jit, 1).as_i64(); // Load environment pointer EP - gen_get_ep(cb, REG0, 0); + let ep_opnd = gen_get_ep(asm, 0); // VALUE kw_bits = *(ep - bits); - let bits_opnd = mem_opnd(64, REG0, (SIZEOF_VALUE as i32) * -bits_offset); + let bits_opnd = Opnd::mem(64, ep_opnd, (SIZEOF_VALUE as i32) * -bits_offset); // unsigned int b = (unsigned int)FIX2ULONG(kw_bits); // if ((b & (0x01 << idx))) { // // We can skip the FIX2ULONG conversion by shifting the bit we test let bit_test: i64 = 0x01 << (index + 1); - test(cb, bits_opnd, imm_opnd(bit_test)); - mov(cb, REG0, uimm_opnd(Qfalse.into())); - mov(cb, REG1, uimm_opnd(Qtrue.into())); - cmovz(cb, REG0, REG1); + asm.test(bits_opnd, Opnd::Imm(bit_test)); + let ret_opnd = asm.csel_z(Qtrue.into(), Qfalse.into()); let stack_ret = ctx.stack_push(Type::UnknownImm); - mov(cb, stack_ret, REG0); + asm.mov(stack_ret, ret_opnd); KeepCompiling } +/* fn gen_jnz_to_target0( cb: &mut CodeBlock, target0: CodePtr, @@ -6002,7 +6000,9 @@ fn get_gen_fn(opcode: VALUE) -> Option<InsnGenFn> { https://github.com/ruby/ruby/blob/trunk/yjit/src/codegen.rs#L6000 /* 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), -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/