Fixed native compilation

This commit is contained in:
Syrus
2020-06-13 01:16:36 -07:00
parent 33bb4e369f
commit b7dc092256
2 changed files with 10 additions and 1 deletions

View File

@@ -176,7 +176,7 @@ macro_rules! impl_native_traits {
return Ok(results); return Ok(results);
} }
} else { } else {
/// Is a dynamic function // Is a dynamic function
if !self.has_env { if !self.has_env {
let ctx = self.vmctx as *mut VMDynamicFunctionContext<VMDynamicFunctionWithoutEnv>; let ctx = self.vmctx as *mut VMDynamicFunctionContext<VMDynamicFunctionWithoutEnv>;
let params_list = [ $( $x.to_native().to_value() ),* ]; let params_list = [ $( $x.to_native().to_value() ),* ];

View File

@@ -36,6 +36,7 @@ pub trait NativeWasmType {
fn to_binary(self) -> i128; fn to_binary(self) -> i128;
/// Convert self to a `Value` /// Convert self to a `Value`
#[inline]
fn to_value<T>(self) -> Value<T> fn to_value<T>(self) -> Value<T>
where where
Self: std::marker::Sized, Self: std::marker::Sized,
@@ -62,10 +63,12 @@ impl NativeWasmType for i32 {
self self
} }
#[inline]
fn to_binary(self) -> i128 { fn to_binary(self) -> i128 {
self as _ self as _
} }
#[inline]
fn from_binary(bits: i128) -> Self { fn from_binary(bits: i128) -> Self {
bits as _ bits as _
} }
@@ -84,10 +87,12 @@ impl NativeWasmType for i64 {
self self
} }
#[inline]
fn to_binary(self) -> i128 { fn to_binary(self) -> i128 {
self as _ self as _
} }
#[inline]
fn from_binary(bits: i128) -> Self { fn from_binary(bits: i128) -> Self {
bits as _ bits as _
} }
@@ -106,10 +111,12 @@ impl NativeWasmType for f32 {
self self
} }
#[inline]
fn to_binary(self) -> i128 { fn to_binary(self) -> i128 {
self.to_bits() as _ self.to_bits() as _
} }
#[inline]
fn from_binary(bits: i128) -> Self { fn from_binary(bits: i128) -> Self {
Self::from_bits(bits as _) Self::from_bits(bits as _)
} }
@@ -128,10 +135,12 @@ impl NativeWasmType for f64 {
self self
} }
#[inline]
fn to_binary(self) -> i128 { fn to_binary(self) -> i128 {
self.to_bits() as _ self.to_bits() as _
} }
#[inline]
fn from_binary(bits: i128) -> Self { fn from_binary(bits: i128) -> Self {
Self::from_bits(bits as _) Self::from_bits(bits as _)
} }