Skip to content

Commit

Permalink
feat: PoC MLIR codegen integration (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
hedgar2017 authored Sep 18, 2024
1 parent b681ae4 commit dd4a250
Show file tree
Hide file tree
Showing 16 changed files with 259 additions and 87 deletions.
39 changes: 19 additions & 20 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
# IDE
/.idea/
/.vscode/

# MacOS
/**/.DS_Store

# Backup files generated by rustfmt
/**/*.rs.bk

# Compiled files and executables
/target*/

# These are backup files generated by rustfmt
**/*.rs.bk
# Dependency locks
# /Cargo.lock
# /LLVM.lock

# The LLVM framework source
# LLVM framework source
/llvm/

# External compilers
/solc-bin*/*
/vyper-bin/*
/solc-bin*/
/vyper-bin*/

# The debug, trace, benchmark artifacts
# Debug and benchmark artifacts
/debug/
/trace/
/**/*.json
/**/*.txt

# The dependency locks
# /Cargo.lock
# /LLVM.lock

# IDE
/.idea/
/.vscode/

# MacOS
/**/.DS_Store
/*.json
/*.txt
11 changes: 5 additions & 6 deletions compiler_tester/src/compiler_tester/arguments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ pub struct Arguments {
#[structopt(long = "disable-value-simulator")]
pub disable_value_simulator: bool,

/// Path to the `zksolc` binary.
/// Path to the `zksolc` executable.
/// Is set to `zksolc` by default.
#[structopt(long = "zksolc")]
pub zksolc: Option<PathBuf>,

/// Path to the `zkvyper` binary.
/// Path to the `zkvyper` executable.
/// Is set to `zkvyper` by default.
#[structopt(long = "zkvyper")]
pub zkvyper: Option<PathBuf>,
Expand All @@ -78,8 +78,7 @@ pub struct Arguments {

/// Specify the target architecture.
/// Available arguments: `eravm`, `evm`.
/// The default is `eravm`.
#[structopt(long = "target", default_value = "eravm")]
#[structopt(long = "target")]
pub target: era_compiler_common::Target,

/// Specify the environment to run tests on.
Expand All @@ -93,11 +92,11 @@ pub struct Arguments {
#[structopt(long = "workflow", default_value = "run")]
pub workflow: compiler_tester::Workflow,

/// Path to the default `solc` binaries download configuration file.
/// Path to the default `solc` executables download configuration file.
#[structopt(long = "solc-bin-config-path")]
pub solc_bin_config_path: Option<PathBuf>,

/// Path to the default `vyper` binaries download configuration file.
/// Path to the default `vyper` executables download configuration file.
#[structopt(long = "vyper-bin-config-path")]
pub vyper_bin_config_path: Option<PathBuf>,

Expand Down
28 changes: 14 additions & 14 deletions compiler_tester/src/compiler_tester/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//!
//! The compiler tester binary.
//! The compiler tester executable.
//!
pub(crate) mod arguments;
Expand Down Expand Up @@ -106,12 +106,12 @@ fn main_inner(arguments: Arguments) -> anyhow::Result<()> {
(era_compiler_common::Target::EVM, Some(toolchain)) => toolchain,
(era_compiler_common::Target::EVM, None) => compiler_tester::Toolchain::Solc,
};
let binary_download_config_paths = vec![
let executable_download_config_paths = vec![
arguments.solc_bin_config_path.unwrap_or_else(|| {
PathBuf::from(match toolchain {
compiler_tester::Toolchain::IrLLVM => "./configs/solc-bin-default.json",
compiler_tester::Toolchain::Solc => "./configs/solc-bin-upstream.json",
compiler_tester::Toolchain::SolcLLVM => todo!(),
compiler_tester::Toolchain::SolcLLVM => "./configs/solc-bin-llvm.json",
})
}),
arguments
Expand Down Expand Up @@ -156,7 +156,7 @@ fn main_inner(arguments: Arguments) -> anyhow::Result<()> {
None
};
let vm = compiler_tester::EraVM::new(
binary_download_config_paths,
executable_download_config_paths,
PathBuf::from("./configs/solc-bin-system-contracts.json"),
system_contracts_debug_config,
arguments.system_contracts_load_path,
Expand All @@ -168,16 +168,16 @@ fn main_inner(arguments: Arguments) -> anyhow::Result<()> {
arguments.disable_deployer,
arguments.disable_value_simulator,
) {
(true, true) => {
compiler_tester.run_eravm::<compiler_tester::EraVMNativeDeployer, false>(vm)
}
(true, false) => {
compiler_tester.run_eravm::<compiler_tester::EraVMNativeDeployer, true>(vm)
}
(true, true) => compiler_tester
.run_eravm::<compiler_tester::EraVMNativeDeployer, false>(vm, toolchain),
(true, false) => compiler_tester
.run_eravm::<compiler_tester::EraVMNativeDeployer, true>(vm, toolchain),
(false, true) => compiler_tester
.run_eravm::<compiler_tester::EraVMSystemContractDeployer, false>(vm),
.run_eravm::<compiler_tester::EraVMSystemContractDeployer, false>(
vm, toolchain,
),
(false, false) => compiler_tester
.run_eravm::<compiler_tester::EraVMSystemContractDeployer, true>(vm),
.run_eravm::<compiler_tester::EraVMSystemContractDeployer, true>(vm, toolchain),
}
}
compiler_tester::Environment::FastVM => todo!(),
Expand All @@ -188,7 +188,7 @@ fn main_inner(arguments: Arguments) -> anyhow::Result<()> {
None
};
let vm = compiler_tester::EraVM::new(
binary_download_config_paths,
executable_download_config_paths,
PathBuf::from("./configs/solc-bin-system-contracts.json"),
system_contract_debug_config,
arguments.system_contracts_load_path,
Expand All @@ -202,7 +202,7 @@ fn main_inner(arguments: Arguments) -> anyhow::Result<()> {
)
}
compiler_tester::Environment::REVM => {
compiler_tester::EVM::download(binary_download_config_paths)?;
compiler_tester::EVM::download(executable_download_config_paths)?;
compiler_tester.run_revm(toolchain)
}
}?;
Expand Down
4 changes: 2 additions & 2 deletions compiler_tester/src/compilers/solidity/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl Default for SolidityCompiler {
}

impl SolidityCompiler {
/// The compiler binaries directory.
/// The compiler executables directory.
const DIRECTORY: &'static str = "solc-bin/";

/// The solc allow paths argument value.
Expand Down Expand Up @@ -136,7 +136,7 @@ impl SolidityCompiler {
})?;
if !entry_type.is_file() {
anyhow::bail!(
"Invalid `solc` binary file type: {}",
"Invalid `solc` executable file type: {}",
path.to_string_lossy()
);
}
Expand Down
Loading

0 comments on commit dd4a250

Please sign in to comment.