Improve Runtime execution by caching runtime lookup (#276)

* Improve Runtime execution by caching runtime lookup

Cache whether the native or wasm runtime should be used for a given
code and if the latter, keep around the parsed wasmi::Module for faster
execution.

* Additional comment and code style fixes

* Fallback to WASM runtime if we can't call the version function

* The previous assumption that the wasm-code was compiled with rustc might be wrong now, that the code comes from the blockchain. Added Notes about that.
This commit is contained in:
Benjamin Kampmann
2018-07-05 14:37:48 +02:00
committed by Gav Wood
parent 181e7313d2
commit c8b4b61412
5 changed files with 81 additions and 18 deletions
+3
View File
@@ -2165,7 +2165,9 @@ dependencies = [
"ed25519 0.1.0",
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hex-literal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-hex 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.64 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2176,6 +2178,7 @@ dependencies = [
"substrate-serializer 0.1.0",
"substrate-state-machine 0.1.0",
"triehash 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"twox-hash 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"wabt 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmi 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
]