mirror of
https://github.com/fluencelabs/wasmer
synced 2025-07-27 13:22:00 +00:00
Merge branch 'master' into fix/update-debug-macro
This commit is contained in:
Cargo.lock
lib
clif-backend
emscripten
runtime-core
Cargo.toml
examples
src
backend.rsbacking.rserror.rsexport.rsglobal.rsimport.rsinstance.rslib.rsmacros.rsmemory.rs
memory
module.rssig_registry.rssys
table.rstable
types.rsunits.rsvm.rsvmcalls.rstests
runtime
src
@@ -13,8 +13,8 @@ macro_rules! debug {
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! export_func {
|
||||
($func:ident, [ $( $params:ident ),* ] -> [ $( $returns:ident ),* ]) => {{
|
||||
macro_rules! func {
|
||||
($func:ident, [ $( $params:ident ),* ] -> [ $( $returns:ident ),* ] ) => {{
|
||||
use $crate::{
|
||||
export::{Context, Export, FuncPointer},
|
||||
types::{FuncSig, Type},
|
||||
@@ -26,10 +26,10 @@ macro_rules! export_func {
|
||||
Export::Function {
|
||||
func: unsafe { FuncPointer::new(func as _) },
|
||||
ctx: Context::Internal,
|
||||
signature: FuncSig {
|
||||
params: vec![$($crate::__export_func_convert_type!($params),)*],
|
||||
returns: vec![$($crate::__export_func_convert_type!($returns),)*],
|
||||
},
|
||||
signature: FuncSig::new(
|
||||
&[$($crate::__export_func_convert_type!($params),)*] as &[Type],
|
||||
&[$($crate::__export_func_convert_type!($returns),)*] as &[Type],
|
||||
).into(),
|
||||
}
|
||||
}};
|
||||
}
|
||||
@@ -71,11 +71,11 @@ macro_rules! __export_func_convert_type {
|
||||
///
|
||||
/// # Usage:
|
||||
/// ```
|
||||
/// # use wasmer_runtime_core::imports;
|
||||
/// # use wasmer_runtime_core::{imports, func};
|
||||
/// # use wasmer_runtime_core::vm::Ctx;
|
||||
/// let import_object = imports! {
|
||||
/// "env" => {
|
||||
/// "foo" => foo<[i32] -> [i32]>,
|
||||
/// "foo" => func!(foo, [i32] -> [i32]),
|
||||
/// },
|
||||
/// };
|
||||
///
|
||||
@@ -105,13 +105,10 @@ macro_rules! imports {
|
||||
#[macro_export]
|
||||
#[doc(hidden)]
|
||||
macro_rules! __imports_internal {
|
||||
( { $( $imp_name:expr => $func:ident < [ $( $params:ident ),* ] -> [ $( $returns:ident ),* ] >, )* } ) => {{
|
||||
( { $( $imp_name:expr => $import_item:expr, )* } ) => {{
|
||||
let mut ns = Namespace::new();
|
||||
$(
|
||||
ns.insert($imp_name, $crate::export_func!(
|
||||
$func,
|
||||
[ $( $params ),* ] -> [ $( $returns )* ]
|
||||
));
|
||||
ns.insert($imp_name, $import_item);
|
||||
)*
|
||||
ns
|
||||
}};
|
||||
|
Reference in New Issue
Block a user