Merge remote-tracking branch 'origin/main' into resolc.js

This commit is contained in:
Sebastian Miasojed
2024-11-06 15:04:34 +01:00
143 changed files with 14572 additions and 5271 deletions
+15 -23
View File
@@ -58,10 +58,6 @@ pub struct Arguments {
#[structopt(long = "fallback-Oz")]
pub fallback_to_optimizing_for_size: bool,
/// Disable the system request memoization.
#[structopt(long = "disable-system-request-memoization")]
pub disable_system_request_memoization: bool,
/// Disable the `solc` optimizer.
/// Use it if your project uses the `MSIZE` instruction, or in other cases.
/// Beware that it will prevent libraries from being inlined.
@@ -75,7 +71,7 @@ pub struct Arguments {
pub solc: Option<String>,
/// The EVM target version to generate IR for.
/// See https://github.com/xermicus/revive/blob/main/crates/common/src/evm_version.rs for reference.
/// See https://github.com/paritytech/revive/blob/main/crates/common/src/evm_version.rs for reference.
#[structopt(long = "evm-version")]
pub evm_version: Option<String>,
@@ -119,13 +115,6 @@ pub struct Arguments {
#[structopt(long = "force-evmla")]
pub force_evmla: bool,
/// Enable system contract compilation mode.
/// In this mode PolkaVM extensions are enabled. For example, calls to addresses `0xFFFF` and below
/// are substituted by special PolkaVM instructions.
/// In the Yul mode, the `verbatim_*` instruction family is available.
#[structopt(long = "system-mode")]
pub is_system_mode: bool,
/// Set metadata hash mode.
/// The only supported value is `none` that disables appending the metadata hash.
/// Is enabled by default.
@@ -185,6 +174,20 @@ impl Arguments {
anyhow::bail!("No other options are allowed while getting the compiler version.");
}
#[cfg(debug_assertions)]
if self.recursive_process_input.is_some() && !self.recursive_process {
anyhow::bail!("--process-input can be only used when --recursive-process is given");
}
#[cfg(debug_assertions)]
if self.recursive_process
&& ((self.recursive_process_input.is_none() && std::env::args().count() > 2)
|| (self.recursive_process_input.is_some() && std::env::args().count() > 4))
{
anyhow::bail!("No other options are allowed in recursive mode.");
}
#[cfg(not(debug_assertions))]
if self.recursive_process && std::env::args().count() > 2 {
anyhow::bail!("No other options are allowed in recursive mode.");
}
@@ -243,12 +246,6 @@ impl Arguments {
if self.solc.is_some() {
anyhow::bail!("`solc` is not used in LLVM IR and PolkaVM assembly modes.");
}
if self.is_system_mode {
anyhow::bail!(
"System contract mode is not supported in LLVM IR and PolkaVM assembly modes."
);
}
}
if self.combined_json.is_some() {
@@ -295,11 +292,6 @@ impl Arguments {
"Falling back to -Oz must specified in standard JSON input settings."
);
}
if self.disable_system_request_memoization {
anyhow::bail!(
"Disabling the system request memoization must specified in standard JSON input settings."
);
}
if self.metadata_hash.is_some() {
anyhow::bail!("Metadata hash mode must specified in standard JSON input settings.");
}
+2 -11
View File
@@ -34,10 +34,9 @@ fn main_inner() -> anyhow::Result<()> {
if arguments.version {
println!(
"{} v{} (LLVM build {:?})",
"{} version {}",
env!("CARGO_PKG_DESCRIPTION"),
env!("CARGO_PKG_VERSION"),
inkwell::support::get_llvm_version()
revive_solidity::ResolcVersion::default().long
);
return Ok(());
}
@@ -106,9 +105,6 @@ fn main_inner() -> anyhow::Result<()> {
if arguments.fallback_to_optimizing_for_size {
optimizer_settings.enable_fallback_to_size();
}
if arguments.disable_system_request_memoization {
optimizer_settings.disable_system_request_memoization();
}
optimizer_settings.is_verify_each_enabled = arguments.llvm_verify_each;
optimizer_settings.is_debug_logging_enabled = arguments.llvm_debug_logging;
@@ -126,7 +122,6 @@ fn main_inner() -> anyhow::Result<()> {
input_files.as_slice(),
&mut solc,
optimizer_settings,
arguments.is_system_mode,
include_metadata_hash,
debug_config,
)
@@ -134,7 +129,6 @@ fn main_inner() -> anyhow::Result<()> {
revive_solidity::llvm_ir(
input_files.as_slice(),
optimizer_settings,
arguments.is_system_mode,
include_metadata_hash,
debug_config,
)
@@ -143,7 +137,6 @@ fn main_inner() -> anyhow::Result<()> {
&mut solc,
arguments.detect_missing_libraries,
arguments.force_evmla,
arguments.is_system_mode,
arguments.base_path,
arguments.include_paths,
arguments.allow_paths,
@@ -160,7 +153,6 @@ fn main_inner() -> anyhow::Result<()> {
!arguments.disable_solc_optimizer,
optimizer_settings,
arguments.force_evmla,
arguments.is_system_mode,
include_metadata_hash,
arguments.base_path,
arguments.include_paths,
@@ -181,7 +173,6 @@ fn main_inner() -> anyhow::Result<()> {
!arguments.disable_solc_optimizer,
optimizer_settings,
arguments.force_evmla,
arguments.is_system_mode,
include_metadata_hash,
arguments.base_path,
arguments.include_paths,