Initial wasm support

This commit is contained in:
Sebastian Miasojed
2024-08-29 17:28:31 +02:00
parent 41c8d4e955
commit 5ac67bdc0d
69 changed files with 2277 additions and 8937 deletions
+10 -9
View File
@@ -1,13 +1,12 @@
[package]
name = "revive-llvm-context"
version.workspace = true
license.workspace = true
edition.workspace = true
repository.workspace = true
version = "1.4.1"
authors = [
"Oleksandr Zarudnyi <a.zarudnyy@matterlabs.dev>",
"Cyrill Leutwiler <cyrill@parity.io>",
]
license = "MIT OR Apache-2.0"
edition = "2021"
description = "Shared front end code of the revive PolkaVM compilers"
[lib]
@@ -33,8 +32,10 @@ inkwell = { workspace = true }
polkavm-disassembler = { workspace = true }
polkavm-common = { workspace = true }
revive-common = { workspace = true }
pallet-contracts-pvm-llapi = { workspace = true }
revive-linker = { workspace = true }
revive-builtins = { workspace = true }
revive-stdlib = { workspace = true }
zkevm_opcode_defs = { git = "https://github.com/matter-labs/era-zkevm_opcode_defs", branch = "v1.4.1" }
revive-common = { path = "../common" }
pallet-contracts-pvm-llapi = { path = "../pallet-contracts-pvm-llapi" }
revive-linker = { path = "../linker" }
revive-builtins = { path = "../builtins" }
revive-stdlib = { path = "../stdlib" }
@@ -15,9 +15,6 @@ pub enum IRType {
LLVM,
/// Whether to dump the assembly code.
Assembly,
/// Whether to jump JSON
#[cfg(debug_assertions)]
JSON,
}
impl IRType {
@@ -29,8 +26,6 @@ impl IRType {
Self::EVMLA => revive_common::EXTENSION_EVMLA,
Self::LLVM => revive_common::EXTENSION_LLVM_SOURCE,
Self::Assembly => revive_common::EXTENSION_POLKAVM_ASSEMBLY,
#[cfg(debug_assertions)]
Self::JSON => revive_common::EXTENSION_JSON,
}
}
}
@@ -94,22 +94,6 @@ impl DebugConfig {
Ok(())
}
/// Dumps the stage output as a json file suitable for use with --recursive-process
#[cfg(debug_assertions)]
pub fn dump_stage_output(
&self,
contract_path: &str,
contract_suffix: Option<&str>,
stage_json: &Vec<u8>,
) -> anyhow::Result<()> {
let mut file_path = self.output_directory.to_owned();
let full_file_name = Self::full_file_name(contract_path, contract_suffix, IRType::JSON);
file_path.push(full_file_name);
std::fs::write(file_path, stage_json)?;
Ok(())
}
/// Creates a full file name, given the contract full path, suffix, and extension.
fn full_file_name(contract_path: &str, suffix: Option<&str>, ir_type: IRType) -> String {
let mut full_file_name = contract_path.replace('/', "_").replace(':', ".");