Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 156 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ cargo_metadata = "0.20.0"
clap = "4.5.8"
colored = "2.1.0"
const-str = "0.5"
criterion = "0.8.2"
crossbeam = "0.8.4"
defer = "0.2.1"
derive_more = { version = "2.0.1", default-features = false, features = [
Expand Down Expand Up @@ -290,6 +291,7 @@ gear-wasm-builder = { path = "sdk/wasm-builder", default-features = false }
gear-wasm-optimizer = { path = "sdk/wasm-optimizer", default-features = false }
gear-wasm-gen = { path = "protocol/wasm-gen" }
gear-wasm-instrument = { path = "protocol/wasm-instrument", default-features = false }
gear-wasmtime-cache = { path = "protocol/wasmtime-cache" }
junit-common = { path = "vara/tools/regression-analysis/junit-common" }
actor-system-error = { path = "protocol/actor-system-error" }
pallet-gear = { path = "vara/pallets/gear", default-features = false }
Expand Down
1 change: 1 addition & 0 deletions ethexe/processor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ gprimitives = { workspace = true, features = ["std"] }
gear-runtime-interface = { workspace = true, default-features = false, features = ["std"] }
gear-sandbox-host.workspace = true
gear-lazy-pages.workspace = true
gear-wasmtime-cache.workspace = true
gear-wasm-instrument = { workspace = true, features = ["std"] }
core-processor.workspace = true

Expand Down
2 changes: 1 addition & 1 deletion ethexe/processor/src/host/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl InstanceCreator {
.macos_use_mach_ports(false);
let engine = wasmtime::Engine::new(&config)?;

let module = wasmtime::Module::new(&engine, runtime)?;
let module = gear_wasmtime_cache::get(&engine, &runtime)?;
let mut linker = wasmtime::Linker::new(&engine);

api::allocator::link(&mut linker)?;
Expand Down
1 change: 1 addition & 0 deletions protocol/lazy-pages/fuzzer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ arbitrary = { workspace = true, features = ["derive"] }
derive_more.workspace = true
gear-wasm-gen.workspace = true
gear-wasm-instrument.workspace = true
gear-wasmtime-cache.workspace = true
gear-lazy-pages.workspace = true
gear-lazy-pages-common.workspace = true
log.workspace = true
Expand Down
8 changes: 4 additions & 4 deletions protocol/lazy-pages/fuzzer/src/wasmtime_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use anyhow::{Context, Result, bail};
use gear_wasm_gen::SyscallName;
use gear_wasm_instrument::{GLOBAL_NAME_GAS, Module};
use wasmtime::{
Cache, CacheConfig, Config, Engine, Extern, Func, Instance, Linker, Memory, MemoryType,
Module as WasmtimeModule, Store, Strategy, Val,
Cache, CacheConfig, Config, Engine, Extern, Func, Instance, Linker, Memory, MemoryType, Store,
Strategy, Val,
};

#[derive(Clone)]
Expand Down Expand Up @@ -66,9 +66,9 @@ impl Runner for WasmtimeRunner {
.context("failed to create engine")?;
let mut store = Store::new(&engine, ());

let wasmtime_module = WasmtimeModule::new(
let wasmtime_module = gear_wasmtime_cache::get(
store.engine(),
module.serialize().map_err(anyhow::Error::msg)?,
&module.serialize().map_err(anyhow::Error::msg)?,
)?;

let ty = MemoryType::new(INITIAL_PAGES, None);
Expand Down
2 changes: 2 additions & 0 deletions protocol/sandbox/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ gear-sandbox-env.workspace = true

# embedded executor only
wasmtime = { workspace = true, optional = true }
gear-wasmtime-cache = { workspace = true, optional = true }

gear-workspace-hack.workspace = true

Expand All @@ -43,5 +44,6 @@ std = [
"gear-sandbox-interface/std",
"gear-sandbox-env/std",
"wasmtime",
"gear-wasmtime-cache",
]
strict = []
1 change: 1 addition & 0 deletions protocol/sandbox/host/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ sp-allocator = { workspace = true, features = ["std"] }
sp-wasm-interface-common = { workspace = true, features = ["std"] }
gear-sandbox-env = { workspace = true, features = ["std"] }
region.workspace = true
gear-wasmtime-cache.workspace = true

gear-workspace-hack.workspace = true

Expand Down
6 changes: 3 additions & 3 deletions protocol/sandbox/host/src/sandbox/wasmtime_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use gear_sandbox_env::{GLOBAL_NAME_GAS, HostError, Instantiate, WasmReturnValue}
use parity_scale_codec::{Decode, Encode};
use sp_wasm_interface_common::{Pointer, ReturnValue, Value, WordSize};
use std::rc::{Rc, Weak};
use wasmtime::{AsContextMut, Engine, ExternType, Linker, MemoryType, Module, Val};
use wasmtime::{AsContextMut, Engine, ExternType, Linker, MemoryType, Val};

type Store = wasmtime::Store<Option<FuncEnv>>;
pub type StoreRefCell = store_refcell::StoreRefCell<Store>;
Expand Down Expand Up @@ -243,8 +243,8 @@ pub fn instantiate(
) -> Result<SandboxInstance, InstantiationError> {
let mut store = context.store().borrow_mut();

let module =
Module::new(store.engine(), wasm).map_err(|_| InstantiationError::ModuleDecoding)?;
let module = gear_wasmtime_cache::get(store.engine(), wasm)
.map_err(|_| InstantiationError::ModuleDecoding)?;
let mut linker = Linker::new(store.engine());

for import in module.imports() {
Expand Down
Loading
Loading