mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-13 03:51:01 +00:00
the revive-explorer utility (#364)
A maintainable and more precise version of what was a hacky but useful script, exploring the compilers YUL lowering unit. It analyzes a given shared objects from the debug dump and outputs: - The count of each YUL statement translated. - A per YUL statement break-down of bytecode size contributed per. - Estimated `yul-phaser` cost parameters. Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
//! The lexical token location.
|
||||
|
||||
use std::hash::Hash;
|
||||
use std::hash::Hasher;
|
||||
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
@@ -48,6 +51,13 @@ impl PartialEq for Location {
|
||||
}
|
||||
}
|
||||
|
||||
impl Hash for Location {
|
||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
self.line.hash(state);
|
||||
self.column.hash(state);
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Display for Location {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{}:{}", self.line, self.column)
|
||||
|
||||
@@ -997,6 +997,8 @@ impl FunctionCall {
|
||||
}
|
||||
arguments.reverse();
|
||||
|
||||
context.set_debug_location(self.location.line, self.location.column, None)?;
|
||||
|
||||
Ok(arguments.try_into().expect("Always successful"))
|
||||
}
|
||||
|
||||
@@ -1014,6 +1016,8 @@ impl FunctionCall {
|
||||
}
|
||||
arguments.reverse();
|
||||
|
||||
context.set_debug_location(self.location.line, self.location.column, None)?;
|
||||
|
||||
Ok(arguments.try_into().expect("Always successful"))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,6 +196,7 @@ where
|
||||
&mut self,
|
||||
context: &mut revive_llvm_context::PolkaVMContext<D>,
|
||||
) -> anyhow::Result<()> {
|
||||
context.set_debug_location(self.location.line, self.location.column, None)?;
|
||||
let argument_types: Vec<_> = self
|
||||
.arguments
|
||||
.iter()
|
||||
|
||||
Reference in New Issue
Block a user