ruby-changes:73151
From: Maxime <ko1@a...>
Date: Tue, 30 Aug 2022 00:57:13 +0900 (JST)
Subject: [ruby-changes:73151] c5ae52630f (master): Port gen_putself, log what can't be compiled in --yjit-dump-insns
https://git.ruby-lang.org/ruby.git/commit/?id=c5ae52630f From c5ae52630f9a362579608f27cfbd7a1f08c4d77f Mon Sep 17 00:00:00 2001 From: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@s...> Date: Mon, 20 Jun 2022 13:02:20 -0400 Subject: Port gen_putself, log what can't be compiled in --yjit-dump-insns --- yjit/src/codegen.rs | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs index b58caa0984..63e8bbcf59 100644 --- a/yjit/src/codegen.rs +++ b/yjit/src/codegen.rs @@ -24,17 +24,6 @@ use std::slice; https://github.com/ruby/ruby/blob/trunk/yjit/src/codegen.rs#L24 pub use crate::virtualmem::CodePtr; -// Callee-saved registers -//pub const REG_CFP: X86Opnd = R13; -//pub const REG_EC: X86Opnd = R12; -//pub const REG_SP: X86Opnd = RBX; - -// Scratch registers used by YJIT -//pub const REG0: X86Opnd = RAX; -//pub const REG0_32: X86Opnd = EAX; -//pub const REG0_8: X86Opnd = AL; -//pub const REG1: X86Opnd = RCX; - // A block that can be invalidated needs space to write a jump. // We'll reserve a minimum size for any block that could // be invalidated. In this case the JMP takes 5 bytes, but @@ -810,6 +799,10 @@ pub fn gen_single_block( https://github.com/ruby/ruby/blob/trunk/yjit/src/codegen.rs#L799 // If we can't compile this instruction // exit to the interpreter and stop compiling if status == CantCompile { + if get_option!(dump_insns) { + println!("can't compile {}", insn_name(opcode)); + } + let mut block = jit.block.borrow_mut(); // TODO: if the codegen function makes changes to ctx and then return YJIT_CANT_COMPILE, @@ -1017,24 +1010,24 @@ fn gen_putobject( https://github.com/ruby/ruby/blob/trunk/yjit/src/codegen.rs#L1010 KeepCompiling } -/* fn gen_putself( _jit: &mut JITState, ctx: &mut Context, - cb: &mut CodeBlock, + asm: &mut Assembler, _ocb: &mut OutlinedCb, ) -> CodegenStatus { - // Load self from CFP - let cf_opnd = mem_opnd((8 * SIZEOF_VALUE) as u8, REG_CFP, RUBY_OFFSET_CFP_SELF); - mov(cb, REG0, cf_opnd); // Write it on the stack - let stack_top: X86Opnd = ctx.stack_push_self(); - mov(cb, stack_top, REG0); + let stack_top = ctx.stack_push_self(); + asm.mov( + stack_top, + Opnd::mem((8 * SIZEOF_VALUE) as u8, CFP, RUBY_OFFSET_CFP_SELF) + ); KeepCompiling } +/* fn gen_putspecialobject( jit: &mut JITState, ctx: &mut Context, @@ -5967,7 +5960,7 @@ fn get_gen_fn(opcode: VALUE) -> Option<InsnGenFn> { https://github.com/ruby/ruby/blob/trunk/yjit/src/codegen.rs#L5960 YARVINSN_putobject => Some(gen_putobject), YARVINSN_putobject_INT2FIX_0_ => Some(gen_putobject_int2fix), YARVINSN_putobject_INT2FIX_1_ => Some(gen_putobject_int2fix), - //YARVINSN_putself => Some(gen_putself), + YARVINSN_putself => Some(gen_putself), //YARVINSN_putspecialobject => Some(gen_putspecialobject), //YARVINSN_setn => Some(gen_setn), //YARVINSN_topn => Some(gen_topn), @@ -6192,7 +6185,7 @@ impl CodegenGlobals { https://github.com/ruby/ruby/blob/trunk/yjit/src/codegen.rs#L6185 inline_cb: cb, outlined_cb: ocb, leave_exit_code: leave_exit_code, - stub_exit_code: /*stub_exit_code*/CodePtr::from(1 as *mut u8), + stub_exit_code: stub_exit_code, outline_full_cfunc_return_pos: /*cfunc_exit_code*/CodePtr::from(1 as *mut u8), global_inval_patches: Vec::new(), inline_frozen_bytes: 0, -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/