diff options
| author | Takashi Kokubun <takashikkbn@gmail.com> | 2022-08-23 13:46:43 -0700 |
|---|---|---|
| committer | Takashi Kokubun <takashikkbn@gmail.com> | 2022-08-29 09:09:41 -0700 |
| commit | def3ade8a809a230648cdffbf4ab066b07fe7bf1 (patch) | |
| tree | 8d976629754280b8bf0777a846a7267900cd0f1e /yjit/src/codegen.rs | |
| parent | 54c7bc67a2d54311b77aca9233b23a9e7a1ca581 (diff) | |
Add --yjit-dump-disasm to dump every compiled code (https://github.com/Shopify/ruby/pull/430)
* Add --yjit-dump-disasm to dump every compiled code
* Just use get_option
* Carve out disasm_from_addr
* Avoid push_str with format!
* Share the logic through asm.compile
* This seems to negatively impact the compilation speed
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/6289
Diffstat (limited to 'yjit/src/codegen.rs')
| -rw-r--r-- | yjit/src/codegen.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs index 1336fe3c57..7c4c974345 100644 --- a/yjit/src/codegen.rs +++ b/yjit/src/codegen.rs @@ -622,9 +622,13 @@ pub fn gen_entry_prologue(cb: &mut CodeBlock, iseq: IseqPtr, insn_idx: u32) -> O cb.align_pos(64); let code_ptr = cb.get_write_ptr(); - add_comment(cb, "yjit entry"); let mut asm = Assembler::new(); + if get_option!(dump_disasm) { + asm.comment(&format!("YJIT entry: {}", iseq_get_location(iseq))); + } else { + asm.comment("YJIT entry"); + } asm.frame_setup(); @@ -748,6 +752,11 @@ pub fn gen_single_block( // Create a backend assembler instance let mut asm = Assembler::new(); + #[cfg(feature = "disasm")] + if get_option!(dump_disasm) { + asm.comment(&format!("Block: {} (ISEQ offset: {})", iseq_get_location(blockid.iseq), blockid.idx)); + } + // For each instruction to compile // NOTE: could rewrite this loop with a std::iter::Iterator while insn_idx < iseq_size { @@ -6049,8 +6058,8 @@ impl CodegenGlobals { half_size ); - let cb = CodeBlock::new(first_half); - let ocb = OutlinedCb::wrap(CodeBlock::new(second_half)); + let cb = CodeBlock::new(first_half, false); + let ocb = OutlinedCb::wrap(CodeBlock::new(second_half, true)); (cb, ocb) }; |
