Executor: Remove LegacyInstanceReuse strategy (#1486)

It seems the old strategy have been depracted more than one year. 
So maybe it's time to clean up old strategy for wasm executor.


---
polkadot address: 15ouFh2SHpGbHtDPsJ6cXQfes9Cx1gEFnJJsJVqPGzBSTudr

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: Koute <koute@users.noreply.github.com>
This commit is contained in:
yjh
2023-09-18 13:53:06 +08:00
committed by GitHub
parent cf5c195237
commit e38998801e
16 changed files with 20 additions and 710 deletions
+3 -27
View File
@@ -21,33 +21,9 @@ use sc_executor_common::{
error::{Error, Result},
util::checked_range,
};
use sp_wasm_interface::{Pointer, Value};
use sp_wasm_interface::Pointer;
use wasmtime::{AsContext, AsContextMut};
/// Converts a [`wasmtime::Val`] into a substrate runtime interface [`Value`].
///
/// Panics if the given value doesn't have a corresponding variant in `Value`.
pub fn from_wasmtime_val(val: wasmtime::Val) -> Value {
match val {
wasmtime::Val::I32(v) => Value::I32(v),
wasmtime::Val::I64(v) => Value::I64(v),
wasmtime::Val::F32(f_bits) => Value::F32(f_bits),
wasmtime::Val::F64(f_bits) => Value::F64(f_bits),
v => panic!("Given value type is unsupported by Substrate: {:?}", v),
}
}
/// Converts a sp_wasm_interface's [`Value`] into the corresponding variant in wasmtime's
/// [`wasmtime::Val`].
pub fn into_wasmtime_val(value: Value) -> wasmtime::Val {
match value {
Value::I32(v) => wasmtime::Val::I32(v),
Value::I64(v) => wasmtime::Val::I64(v),
Value::F32(f_bits) => wasmtime::Val::F32(f_bits),
Value::F64(f_bits) => wasmtime::Val::F64(f_bits),
}
}
/// Read data from the instance memory into a slice.
///
/// Returns an error if the read would go out of the memory bounds.
@@ -140,8 +116,8 @@ pub(crate) fn replace_strategy_if_broken(strategy: &mut InstantiationStrategy) {
// These strategies require a working `madvise` to be sound.
InstantiationStrategy::PoolingCopyOnWrite => InstantiationStrategy::Pooling,
InstantiationStrategy::RecreateInstanceCopyOnWrite |
InstantiationStrategy::LegacyInstanceReuse => InstantiationStrategy::RecreateInstance,
InstantiationStrategy::RecreateInstanceCopyOnWrite =>
InstantiationStrategy::RecreateInstance,
};
use std::sync::OnceLock;