mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-06-16 09:41:10 +00:00
Separate compilation and linker phases (#376)
Separate between compilation and linker phases to allow deploy time linking and back-porting era compiler changes to fix #91. Unlinked contract binaries (caused by missing libraries or missing factory dependencies in turn) are emitted as raw ELF object. Few drive by fixes: - #98 - A compiler panic on missing libraries definitions. - Fixes some incosistent type forwarding in JSON output (empty string vs. null object). - Remove the unused fallback for size optimization setting. - Remove the broken `--lvm-ir` mode. - CI workflow fixes. --------- Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com> Signed-off-by: xermicus <bigcyrill@hotmail.com> Signed-off-by: xermicus <cyrill@parity.io>
This commit is contained in:
@@ -1,51 +1,69 @@
|
||||
//! Process for compiling a single compilation unit.
|
||||
//! The input data.
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
use std::collections::BTreeSet;
|
||||
|
||||
use revive_common::MetadataHash;
|
||||
use revive_llvm_context::DebugConfig;
|
||||
use revive_llvm_context::OptimizerSettings;
|
||||
use revive_solc_json_interface::SolcStandardJsonInputSettingsPolkaVMMemory;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::project::contract::Contract;
|
||||
use crate::project::Project;
|
||||
use crate::SolcVersion;
|
||||
|
||||
/// The input data.
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct Input {
|
||||
/// The contract representation.
|
||||
pub contract: Contract,
|
||||
/// The project representation.
|
||||
pub project: Project,
|
||||
/// The `solc` compiler version.
|
||||
pub solc_version: Option<SolcVersion>,
|
||||
/// Whether to append the metadata hash.
|
||||
pub include_metadata_hash: bool,
|
||||
pub metadata_hash: MetadataHash,
|
||||
/// The optimizer settings.
|
||||
pub optimizer_settings: revive_llvm_context::OptimizerSettings,
|
||||
pub optimizer_settings: OptimizerSettings,
|
||||
/// The debug output config.
|
||||
pub debug_config: revive_llvm_context::DebugConfig,
|
||||
pub debug_config: DebugConfig,
|
||||
/// The extra LLVM arguments give used for manual control.
|
||||
pub llvm_arguments: Vec<String>,
|
||||
/// The PVM memory configuration.
|
||||
pub memory_config: SolcStandardJsonInputSettingsPolkaVMMemory,
|
||||
/// Missing unlinked libraries.
|
||||
pub missing_libraries: BTreeSet<String>,
|
||||
/// Factory dependencies.
|
||||
pub factory_dependencies: BTreeSet<String>,
|
||||
/// The mapping of auxiliary identifiers, e.g. Yul object names, to full contract paths.
|
||||
pub identifier_paths: BTreeMap<String, String>,
|
||||
}
|
||||
|
||||
impl Input {
|
||||
/// A shortcut constructor.
|
||||
pub fn new(
|
||||
contract: Contract,
|
||||
project: Project,
|
||||
include_metadata_hash: bool,
|
||||
optimizer_settings: revive_llvm_context::OptimizerSettings,
|
||||
debug_config: revive_llvm_context::DebugConfig,
|
||||
solc_version: Option<SolcVersion>,
|
||||
metadata_hash: MetadataHash,
|
||||
optimizer_settings: OptimizerSettings,
|
||||
debug_config: DebugConfig,
|
||||
llvm_arguments: Vec<String>,
|
||||
memory_config: SolcStandardJsonInputSettingsPolkaVMMemory,
|
||||
missing_libraries: BTreeSet<String>,
|
||||
factory_dependencies: BTreeSet<String>,
|
||||
identifier_paths: BTreeMap<String, String>,
|
||||
) -> Self {
|
||||
Self {
|
||||
contract,
|
||||
project,
|
||||
include_metadata_hash,
|
||||
solc_version,
|
||||
metadata_hash,
|
||||
optimizer_settings,
|
||||
debug_config,
|
||||
llvm_arguments,
|
||||
memory_config,
|
||||
missing_libraries,
|
||||
factory_dependencies,
|
||||
identifier_paths,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user