Skip to content

Commit ab01fcc

Browse files
authored
ZJIT: Let AssemblerPanicHook write into stderr (ruby#15019)
1 parent 980e184 commit ab01fcc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

zjit/src/backend/lir.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2290,7 +2290,7 @@ pub struct AssemblerPanicHook {
22902290
impl AssemblerPanicHook {
22912291
/// Maximum number of lines [`Self::dump_asm`] is allowed to dump by default.
22922292
/// When --zjit-dump-lir is given, this limit is ignored.
2293-
const MAX_DUMP_LINES: usize = 40;
2293+
const MAX_DUMP_LINES: usize = 10;
22942294

22952295
/// Install a panic hook to dump Assembler with insn_idx on dev builds.
22962296
/// This returns shared references to the previous hook and insn_idx.
@@ -2340,12 +2340,12 @@ impl AssemblerPanicHook {
23402340
(insn_idx.saturating_sub(Self::MAX_DUMP_LINES / 2), insn_idx.saturating_add(Self::MAX_DUMP_LINES / 2))
23412341
};
23422342

2343-
println!("Failed to compile LIR at insn_idx={insn_idx}:");
2343+
eprintln!("Failed to compile LIR at insn_idx={insn_idx}:");
23442344
for (idx, line) in lines.iter().enumerate().filter(|(idx, _)| (min_idx..=max_idx).contains(idx)) {
23452345
if idx == insn_idx && line.starts_with(" ") {
2346-
println!("{BOLD_BEGIN}=>{}{BOLD_END}", &line[" ".len()..]);
2346+
eprintln!("{BOLD_BEGIN}=>{}{BOLD_END}", &line[" ".len()..]);
23472347
} else {
2348-
println!("{line}");
2348+
eprintln!("{line}");
23492349
}
23502350
}
23512351
}

0 commit comments

Comments
 (0)