Return type normalization, and change return errors from imported functions

This commit is contained in:
Lachlan Sneff
2019-04-22 11:42:52 -07:00
parent 85d9ca9ad2
commit 74b6ba4eaf
8 changed files with 115 additions and 109 deletions

View File

@ -2,7 +2,7 @@ use crate::syscalls::types::{__wasi_errno_t, __WASI_EFAULT};
use std::{cell::Cell, fmt, marker::PhantomData, mem};
use wasmer_runtime_core::{
memory::Memory,
types::{Type, ValueType, WasmExternType},
types::{ValueType, WasmExternType},
};
pub struct Array;
@ -73,12 +73,12 @@ impl<T: Copy + ValueType> WasmPtr<T, Array> {
}
unsafe impl<T: Copy, Ty> WasmExternType for WasmPtr<T, Ty> {
const TYPE: Type = Type::I32;
type Native = i32;
fn to_bits(self) -> u64 {
self.offset as u64
fn to_native(self) -> Self::Native {
self.offset as i32
}
fn from_bits(n: u64) -> Self {
fn from_native(n: Self::Native) -> Self {
Self {
offset: n as u32,
_phantom: PhantomData,