Fair reusing of wasm runtime instances (#3011)
* Add test from original bug report Original is from @pepyakin in 3d7b27f3421818e8d6de568e02fbc2947a06246b. I adapted it to work with the latest master. * No longer cleanup module instance * Replace runtime cache with synchronous clone * Fix test * Preserve initial runtime memory and restore it on fetch * Remove leftover comment * Fix style * Improve variable naming * Replace get_into() with get() * Handle missing memory export better * Return earlier when creating runtime first time * Improve comments * fmt * Fix #2967. * Eradicate `code` from `Error::InvalidCode` * tidy * A state snapshot doc. * Store multiple runtimes by hash. * Get rid of deref. * Docs * Use Self for instantiate_module * REVERT ME * Should be ok * Commit * Remove dbg * Use fast-memory's erase * Clean and undo hacks. * Introduce a dedicated error for heap_base * Ban the start function. * Clean, docs and refactor * Add rustflags. * Update Cargo.lock * Apply Basti's suggestions Co-Authored-By:Bastian Köcher <bkchr@users.noreply.github.com> * Rename allocates_huge_stack_array * Extend TestClientBuilder with set_heap_pages * Update the test. * Update core/executor/src/wasm_executor.rs Co-Authored-By:
Bastian Köcher <bkchr@users.noreply.github.com> * Update core/executor/src/wasm_runtimes_cache.rs Co-Authored-By:
Bastian Köcher <bkchr@users.noreply.github.com> * Update core/executor/src/error.rs Co-Authored-By:
Bastian Köcher <bkchr@users.noreply.github.com> * Update core/executor/src/error.rs Co-Authored-By:
Bastian Köcher <bkchr@users.noreply.github.com> * Fix tests. * Update cargo-lock * Use wasmi master * Use master wasmi * Move tests. * Use wasmi crates.io * Update Cargo.lock * Fix build.rs * Bump runtime version * Revert initial_heap_pages renaming * Bump wasmi up to 0.5.0 * Bump runtime version * Don't restore an instance every now and then * Update core/executor/src/wasm_runtimes_cache.rs Co-Authored-By:
DemiMarie-parity <48690212+DemiMarie-parity@users.noreply.github.com> * Propagate error in CacheError * Clarify the get_heap_base call in instantiation * Supply --export=__heap_base See https://reviews.llvm.org/D62744 Co-authored-by:
Jim Posen <jim.posen@gmail.com> * Bump version. * Use combinators for segments. * Fix build.rs * Fix build.rs for runtime-test
Showing
- substrate/Cargo.lock 10 additions, 5 deletionssubstrate/Cargo.lock
- substrate/core/client/src/genesis.rs 6 additions, 3 deletionssubstrate/core/client/src/genesis.rs
- substrate/core/executor/Cargo.toml 2 additions, 1 deletionsubstrate/core/executor/Cargo.toml
- substrate/core/executor/runtime-test/build.rs 5 additions, 2 deletionssubstrate/core/executor/runtime-test/build.rs
- substrate/core/executor/src/allocator.rs 17 additions, 37 deletionssubstrate/core/executor/src/allocator.rs
- substrate/core/executor/src/error.rs 9 additions, 2 deletionssubstrate/core/executor/src/error.rs
- substrate/core/executor/src/lib.rs 2 additions, 0 deletionssubstrate/core/executor/src/lib.rs
- substrate/core/executor/src/native_executor.rs 29 additions, 88 deletionssubstrate/core/executor/src/native_executor.rs
- substrate/core/executor/src/wasm_executor.rs 34 additions, 28 deletionssubstrate/core/executor/src/wasm_executor.rs
- substrate/core/executor/src/wasm_runtimes_cache.rs 331 additions, 0 deletionssubstrate/core/executor/src/wasm_runtimes_cache.rs
- substrate/core/primitives/Cargo.toml 1 addition, 1 deletionsubstrate/core/primitives/Cargo.toml
- substrate/core/sr-api-macros/tests/runtime_calls.rs 1 addition, 0 deletionssubstrate/core/sr-api-macros/tests/runtime_calls.rs
- substrate/core/sr-sandbox/Cargo.toml 1 addition, 1 deletionsubstrate/core/sr-sandbox/Cargo.toml
- substrate/core/test-runtime/Cargo.toml 1 addition, 0 deletionssubstrate/core/test-runtime/Cargo.toml
- substrate/core/test-runtime/build.rs 10 additions, 2 deletionssubstrate/core/test-runtime/build.rs
- substrate/core/test-runtime/client/src/lib.rs 24 additions, 12 deletionssubstrate/core/test-runtime/client/src/lib.rs
- substrate/core/test-runtime/src/genesismap.rs 8 additions, 2 deletionssubstrate/core/test-runtime/src/genesismap.rs
- substrate/core/test-runtime/src/lib.rs 113 additions, 0 deletionssubstrate/core/test-runtime/src/lib.rs
- substrate/node-template/runtime/build.rs 8 additions, 2 deletionssubstrate/node-template/runtime/build.rs
- substrate/node/executor/src/lib.rs 1 addition, 0 deletionssubstrate/node/executor/src/lib.rs
Please register or sign in to comment