mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-10 00:38:07 +00:00
Extract execution engines definitions into their own crates (#4489)
* Clean imports in wasmi_execution * Replace `interpret_runtime_api_result` with `pointer_and_len_from_u64`. * Extract sc-executor-common crate * Extract `sc-executor-wasmi` into its own crate * Extract `sc-executor-wasmtime` into its own crate. * Add missing headers. * Clean and docs * Docs for sc-executor-wasmi * Expand a comment about sandboxing * Fix assert_matches * Rename (un)pack_ptr_and_len and move them into util module * Remove wasmtime errors in sc-executor-common
This commit is contained in:
@@ -16,8 +16,6 @@
|
||||
|
||||
//! Utilities for defining the wasm host environment.
|
||||
|
||||
use sp_wasm_interface::{Pointer, WordSize};
|
||||
|
||||
/// Converts arguments into respective WASM types.
|
||||
#[macro_export]
|
||||
macro_rules! convert_args {
|
||||
@@ -173,14 +171,3 @@ macro_rules! impl_wasm_host_interface {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/// Runtime API functions return an i64 which encodes a pointer in the least-significant 32 bits
|
||||
/// and a length in the most-significant 32 bits. This interprets the returned value as a pointer,
|
||||
/// length tuple.
|
||||
pub fn interpret_runtime_api_result(retval: i64) -> (Pointer<u8>, WordSize) {
|
||||
let ptr = <Pointer<u8>>::new(retval as u32);
|
||||
// The first cast to u64 is necessary so that the right shift does not sign-extend.
|
||||
let len = ((retval as u64) >> 32) as WordSize;
|
||||
(ptr, len)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user