Opt-out from fast instance reuse and foundation for other refactorings (#8394)

* Establish the runtime_blob module

Seed it with the existing contents of the `util` module.

* Port wasmtime mutable globals instrumentation into runtime blob APIs

* Opt-out from fast instance reuse

* Minor clean up

* Spaces

* Docs clean up

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Factor out the expects

* Fix the suggestion

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Sergei Shulepov
2021-04-06 19:21:34 +03:00
committed by GitHub
parent 6a8c6b2b0a
commit b2a6ad0553
15 changed files with 592 additions and 285 deletions
+3 -6
View File
@@ -36,7 +36,7 @@ use sc_executor_common::{
error::{Error, WasmError},
sandbox,
};
use sc_executor_common::util::{DataSegmentsSnapshot, WasmModuleInfo};
use sc_executor_common::runtime_blob::{RuntimeBlob, DataSegmentsSnapshot};
struct FunctionExecutor<'a> {
sandbox_store: sandbox::Store<wasmi::FuncRef>,
@@ -661,11 +661,8 @@ pub fn create_runtime(
)
.map_err(|e| WasmError::Instantiation(e.to_string()))?;
let data_segments_snapshot = DataSegmentsSnapshot::take(
&WasmModuleInfo::new(code)
.ok_or_else(|| WasmError::Other("cannot deserialize module".to_string()))?,
)
.map_err(|e| WasmError::Other(e.to_string()))?;
let data_segments_snapshot = DataSegmentsSnapshot::take(&RuntimeBlob::new(code)?)
.map_err(|e| WasmError::Other(e.to_string()))?;
let global_vals_snapshot = GlobalValsSnapshot::take(&instance);
(data_segments_snapshot, global_vals_snapshot)