Skip to content

Commit 325fb5a

Browse files
tekknolagiclaude
andcommitted
ZJIT: Fix HIR file persistence and aggregation script parsing
Write HIR source and address map files to ~/.zjit/ which survives samply's /tmp cleanup. Fix address map parser to handle function names containing spaces. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 70177e4 commit 325fb5a

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

tool/zjit_hir_aggregate.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,12 @@ def parse_address_map(path)
7373
File.readlines(path).each do |line|
7474
line.chomp!
7575
if line.start_with?("F ")
76+
# F zjit::name with spaces 0xaddr size
77+
# Parse from the end since name can contain spaces
7678
parts = line.split(" ")
77-
# F zjit::name 0xaddr size
78-
name = parts[1]
79-
code_addr = Integer(parts[2])
80-
code_size = Integer(parts[3])
79+
code_size = Integer(parts[-1])
80+
code_addr = Integer(parts[-2])
81+
name = parts[1...-2].join(" ")
8182
current_func = { name: name, code_addr: code_addr, code_size: code_size, debug_entries: [] }
8283
functions[code_addr] = current_func
8384
elsif line.strip =~ /^(0x[0-9a-f]+)\s+(\d+)$/ && current_func

zjit/src/codegen.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ fn get_jitdump() -> Option<&'static JitdumpWriter> {
4747
fn get_hir_file_path() -> &'static str {
4848
HIR_FILE_PATH.get_or_init(|| {
4949
let pid = std::process::id();
50-
// Write to home directory so samply's /tmp cleanup won't delete it
51-
let home = std::env::var("HOME").unwrap_or_else(|_| "/tmp".to_string());
50+
let home = std::env::var("HOME").unwrap_or_else(|_| ".".to_string());
5251
let dir = format!("{home}/.zjit");
5352
let _ = std::fs::create_dir_all(&dir);
5453
format!("{dir}/hir-{pid}.src")

0 commit comments

Comments
 (0)