mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 10:01:17 +00:00
First step for generating host externals out of the function definition in sr-io (#3567)
* Adds new wrapper traits for wasm executor * Add new crate `substrate-wasm-interface` Thew new crate holds types and traits for the communicating between the wasm runtime and the host. * Rewrite externals with new macro etc * Fix vec initialization * Make executor tests working * Remove unused code + warnings * Introduce `Pointer` and `WordSize` for working with wasm * Fix tests and compilation * Fix compilation * Apply suggestions from code review Co-Authored-By: Sergei Pepyakin <sergei@parity.io> * Review feedback * Remove unused conversions * Make each host function its own struct `HostFunctions` now just returns these function structs. Each function can be executed by using one of the function structs. The inherent host functions are now moved to the "normal" host functions. * Remove byteorder * Add floating point types * Make pointer interface more safe * Add type alias for wasm-interface Result * More review comments
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
pub extern crate alloc;
|
||||
|
||||
extern "C" {
|
||||
fn ext_malloc(size: usize) -> *mut u8;
|
||||
fn ext_malloc(size: u32) -> *mut u8;
|
||||
fn ext_free(ptr: *mut u8);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ mod __impl {
|
||||
|
||||
unsafe impl GlobalAlloc for WasmAllocator {
|
||||
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
|
||||
super::ext_malloc(layout.size()) as *mut u8
|
||||
super::ext_malloc(layout.size() as u32) as *mut u8
|
||||
}
|
||||
|
||||
unsafe fn dealloc(&self, ptr: *mut u8, _layout: Layout) {
|
||||
|
||||
Reference in New Issue
Block a user