Skip to content

Commit

Permalink
chore: cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes committed Apr 28, 2024
1 parent 3b87dc6 commit 36988a0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
5 changes: 5 additions & 0 deletions crates/revm-jit-cli/src/benches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ pub fn get_benches() -> Vec<Bench> {
bytecode: hex::decode(include_str!("../../../data/uniswap_v2_pair.rt.hex")).unwrap(),
..Default::default()
},
Bench {
name: "seaport",
bytecode: hex::decode(include_str!("../../../data/seaport.rt.hex")).unwrap(),
..Default::default()
},
]
}

Expand Down
4 changes: 2 additions & 2 deletions crates/revm-jit-llvm/src/dh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ impl<'ctx> DiagnosticHandlerGuard<'ctx> {
match LLVMGetDiagInfoSeverity(di) {
LLVMDSError => error!(target: "llvm", "{msg}"),
LLVMDSWarning => warn!(target: "llvm", "{msg}"),
LLVMDSRemark => debug!(target: "llvm", "{msg}"),
LLVMDSNote => info!(target: "llvm", "{msg}"),
LLVMDSRemark => trace!(target: "llvm", "{msg}"),
LLVMDSNote => debug!(target: "llvm", "{msg}"),
}
}
}
Expand Down
13 changes: 2 additions & 11 deletions crates/revm-jit/src/compiler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,24 +459,15 @@ impl<B: Backend> EvmCompiler<B> {
}

fn dump_bytecode(dump_dir: &Path, bytecode: &Bytecode<'_>) -> Result<()> {
fn with_extra_ext(p: &Path, ext: &str) -> PathBuf {
p.with_file_name(format!("{}.{ext}", p.file_name().unwrap().to_str().unwrap()))
}

let fname = dump_dir.join("evm").with_extension(format!("{:?}", bytecode.spec_id));
fs::write(with_extra_ext(&fname, "bin"), bytecode.code)?;

fs::write(with_extra_ext(&fname, "hex"), revm_primitives::hex::encode(bytecode.code))?;

{
let file = fs::File::create(with_extra_ext(&fname, "txt"))?;
let file = fs::File::create(dump_dir.join("bytecode.txt"))?;
let mut writer = io::BufWriter::new(file);
write!(writer, "{bytecode}")?;
writer.flush()?;
}

{
let file = fs::File::create(with_extra_ext(&fname, "dbg.txt"))?;
let file = fs::File::create(dump_dir.join("bytecode.dbg.txt"))?;
let mut writer = io::BufWriter::new(file);
writeln!(writer, "{bytecode:#?}")?;
writer.flush()?;
Expand Down
1 change: 1 addition & 0 deletions data/seaport.rt.hex

Large diffs are not rendered by default.

0 comments on commit 36988a0

Please sign in to comment.