Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Executor: Remove LegacyInstanceReuse strategy #1486

Merged
merged 19 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
8 changes: 0 additions & 8 deletions substrate/client/cli/src/arg_enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@ pub enum WasmtimeInstantiationStrategy {

/// Recreate the instance from scratch on every instantiation. Very slow.
RecreateInstance,

/// Legacy instance reuse mechanism. DEPRECATED. Will be removed in the future.
///
/// Should only be used in case of encountering any issues with the new default
/// instantiation strategy.
LegacyInstanceReuse,
}

/// The default [`WasmtimeInstantiationStrategy`].
Expand Down Expand Up @@ -92,8 +86,6 @@ pub fn execution_method_from_cli(
sc_service::config::WasmtimeInstantiationStrategy::Pooling,
WasmtimeInstantiationStrategy::RecreateInstance =>
sc_service::config::WasmtimeInstantiationStrategy::RecreateInstance,
WasmtimeInstantiationStrategy::LegacyInstanceReuse =>
sc_service::config::WasmtimeInstantiationStrategy::LegacyInstanceReuse,
},
}
}
Expand Down
7 changes: 0 additions & 7 deletions substrate/client/executor/benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,6 @@ fn bench_call_instance(c: &mut Criterion) {
let _ = env_logger::try_init();

let strategies = [
(
"legacy_instance_reuse",
Method::Compiled {
instantiation_strategy: InstantiationStrategy::LegacyInstanceReuse,
precompile: false,
},
),
(
"recreate_instance_vanilla",
Method::Compiled {
Expand Down

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions substrate/client/executor/common/src/runtime_blob/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@
//! is free of any floating point operations, which is a useful step towards making instances
//! produced from such a module deterministic.

mod data_segments_snapshot;
mod globals_snapshot;
mod runtime_blob;

pub use data_segments_snapshot::DataSegmentsSnapshot;
pub use globals_snapshot::{ExposedMutableGlobalsSet, GlobalsSnapshot, InstanceGlobals};
pub use runtime_blob::RuntimeBlob;
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ use crate::{error::WasmError, wasm_runtime::HeapAllocStrategy};
use wasm_instrument::{
export_mutable_globals,
parity_wasm::elements::{
deserialize_buffer, serialize, DataSegment, ExportEntry, External, Internal, MemorySection,
MemoryType, Module, Section,
deserialize_buffer, serialize, ExportEntry, External, Internal, MemorySection, MemoryType,
Module, Section,
},
};

Expand Down Expand Up @@ -52,11 +52,6 @@ impl RuntimeBlob {
Ok(Self { raw_module })
}

/// Extract the data segments from the given wasm code.
pub(super) fn data_segments(&self) -> Vec<DataSegment> {
self.raw_module.data_section().map(|ds| ds.entries()).unwrap_or(&[]).to_vec()
}

/// The number of globals defined in locally in this module.
pub fn declared_globals_count(&self) -> u32 {
self.raw_module
Expand Down Expand Up @@ -190,16 +185,6 @@ impl RuntimeBlob {
Ok(())
}

/// Returns an iterator of all globals which were exported by [`expose_mutable_globals`].
pub(super) fn exported_internal_global_names(&self) -> impl Iterator<Item = &str> {
let exports = self.raw_module.export_section().map(|es| es.entries()).unwrap_or(&[]);
exports.iter().filter_map(|export| match export.internal() {
Internal::Global(_) if export.field().starts_with("exported_internal_global") =>
Some(export.field()),
_ => None,
})
}

/// Scans the wasm blob for the first section with the name that matches the given. Returns the
/// contents of the custom section if found or `None` otherwise.
pub fn custom_section_contents(&self, section_name: &str) -> Option<&[u8]> {
Expand Down
3 changes: 1 addition & 2 deletions substrate/client/executor/src/integration_tests/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ fn memory_consumption_compiled() {

if std::env::var("RUN_TEST").is_ok() {
memory_consumption(WasmExecutionMethod::Compiled {
instantiation_strategy:
sc_executor_wasmtime::InstantiationStrategy::LegacyInstanceReuse,
instantiation_strategy: sc_executor_wasmtime::InstantiationStrategy::PoolingCopyOnWrite,
yjhmelody marked this conversation as resolved.
Show resolved Hide resolved
});
} else {
// We need to run the test in isolation, to not getting interfered by the other tests.
Expand Down
8 changes: 0 additions & 8 deletions substrate/client/executor/src/integration_tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,6 @@ macro_rules! test_wasm_execution {
instantiation_strategy: sc_executor_wasmtime::InstantiationStrategy::Pooling
});
}

#[test]
fn [<$method_name _compiled_legacy_instance_reuse>]() {
let _ = sp_tracing::try_init_simple();
$method_name(WasmExecutionMethod::Compiled {
instantiation_strategy: sc_executor_wasmtime::InstantiationStrategy::LegacyInstanceReuse
});
}
}
};
}
Expand Down
Loading
Loading