Skip to content

Commit

Permalink
v0.9.43 update (bifrost-platform#5)
Browse files Browse the repository at this point in the history
* Executor: Remove `LegacyInstanceReuse` strategy (polkadot-sdk#1486)

* sc-executor: Increase maximum instance count (polkadot-sdk#1856)
  • Loading branch information
alstjd0921 authored and helin6 committed Jan 8, 2024
1 parent cf3f9be commit 23a85ad
Show file tree
Hide file tree
Showing 18 changed files with 124 additions and 733 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

8 changes: 0 additions & 8 deletions 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
6 changes: 3 additions & 3 deletions client/cli/src/params/runtime_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use std::str::FromStr;
/// Parameters used to config runtime.
#[derive(Debug, Clone, Args)]
pub struct RuntimeParams {
/// The size of the instances cache for each runtime. The values higher than 256 are illegal.
/// The size of the instances cache for each runtime. The values higher than 32 are illegal.
#[arg(long, default_value_t = 8, value_parser = parse_max_runtime_instances)]
pub max_runtime_instances: usize,

Expand All @@ -35,8 +35,8 @@ fn parse_max_runtime_instances(s: &str) -> Result<usize, String> {
let max_runtime_instances = usize::from_str(s)
.map_err(|_err| format!("Illegal `--max-runtime-instances` value: {s}"))?;

if max_runtime_instances > 256 {
Err(format!("Illegal `--max-runtime-instances` value: {max_runtime_instances} is more than the allowed maximum of `256` "))
if max_runtime_instances > 32 {
Err(format!("Illegal `--max-runtime-instances` value: {max_runtime_instances} is more than the allowed maximum of `32` "))
} else {
Ok(max_runtime_instances)
}
Expand Down
7 changes: 0 additions & 7 deletions client/executor/benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,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
87 changes: 0 additions & 87 deletions client/executor/common/src/runtime_blob/data_segments_snapshot.rs

This file was deleted.

112 changes: 0 additions & 112 deletions client/executor/common/src/runtime_blob/globals_snapshot.rs

This file was deleted.

4 changes: 0 additions & 4 deletions 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;
23 changes: 4 additions & 19 deletions client/executor/common/src/runtime_blob/runtime_blob.rs
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 @@ -151,7 +146,7 @@ impl RuntimeBlob {
.entries_mut()
.push(ExportEntry::new(memory_name, Internal::Memory(0)));

break
break;
}

Ok(())
Expand All @@ -171,7 +166,7 @@ impl RuntimeBlob {
.ok_or_else(|| WasmError::Other("no memory section found".into()))?;

if memory_section.entries().is_empty() {
return Err(WasmError::Other("memory section is empty".into()))
return Err(WasmError::Other("memory section is empty".into()));
}
for memory_ty in memory_section.entries_mut() {
let initial = memory_ty.limits().initial();
Expand All @@ -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
10 changes: 0 additions & 10 deletions client/executor/common/src/wasm_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,6 @@ pub trait WasmInstance: Send {
///
/// This method is only suitable for getting immutable globals.
fn get_global_const(&mut self, name: &str) -> Result<Option<Value>, Error>;

/// **Testing Only**. This function returns the base address of the linear memory.
///
/// This is meant to be the starting address of the memory mapped area for the linear memory.
///
/// This function is intended only for a specific test that measures physical memory
/// consumption.
fn linear_memory_base_ptr(&self) -> Option<*const u8> {
None
}
}

/// Defines the heap pages allocation strategy the wasm runtime should use.
Expand Down
Loading

0 comments on commit 23a85ad

Please sign in to comment.