Better wasm instance cache (#5109)

* Wasm instance cache

* Reduce slot locking

* Fixed test

* Dispose of instance in case of error

* Fixed benches

* Style, comments, some renames

* Replaced upgradable lock with mutex

* Bump dependencies

* Re-export CallInWasm

* Update client/executor/src/wasm_runtime.rs

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

* Update client/executor/src/native_executor.rs

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

* Update client/executor/src/native_executor.rs

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

* Update client/executor/src/wasm_runtime.rs

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

* Update client/executor/wasmtime/src/runtime.rs

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

* Update client/executor/src/wasm_runtime.rs

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

* Update client/executor/src/wasm_runtime.rs

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

* Update client/executor/src/wasm_runtime.rs

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

* Indents

* Whitespace

* Formatting

* Added issue link

Co-authored-by: Benjamin Kampmann <ben.kampmann@googlemail.com>
Co-authored-by: Gavin Wood <github@gavwood.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Benjamin Kampmann
2020-03-05 14:02:04 +01:00
committed by GitHub
parent 40b243f1c8
commit d3208aa7bc
19 changed files with 730 additions and 609 deletions
+4 -4
View File
@@ -91,7 +91,7 @@ fn construct_block<E: Externalities>(
};
// execute the block to get the real header.
executor.call::<_, NeverNativeValue, fn() -> _>(
executor.call::<NeverNativeValue, fn() -> _>(
ext,
"Core_initialize_block",
&header.encode(),
@@ -100,7 +100,7 @@ fn construct_block<E: Externalities>(
).0.unwrap();
for i in extrinsics.iter() {
executor.call::<_, NeverNativeValue, fn() -> _>(
executor.call::<NeverNativeValue, fn() -> _>(
ext,
"BlockBuilder_apply_extrinsic",
&i.encode(),
@@ -109,7 +109,7 @@ fn construct_block<E: Externalities>(
).0.unwrap();
}
let header = match executor.call::<_, NeverNativeValue, fn() -> _>(
let header = match executor.call::<NeverNativeValue, fn() -> _>(
ext,
"BlockBuilder_finalize_block",
&[0u8;0],
@@ -175,7 +175,7 @@ fn bench_execute_block(c: &mut Criterion) {
|| new_test_ext(&genesis_config),
|test_ext| {
for block in blocks.iter() {
executor.call::<_, NeverNativeValue, fn() -> _>(
executor.call::<NeverNativeValue, fn() -> _>(
&mut test_ext.ext(),
"Core_execute_block",
&block.0,
+1 -1
View File
@@ -71,7 +71,7 @@ pub fn executor_call<
native_call: Option<NC>,
) -> (Result<NativeOrEncoded<R>>, bool) {
let mut t = t.ext();
executor().call::<_, R, NC>(
executor().call::<R, NC>(
&mut t,
method,
data,