mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-27 07:31:33 +00:00
Improved docs and fixed few typos
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
//! Installing signal handlers allows us to handle traps and out-of-bounds memory
|
//! Installing signal handlers allows us to handle traps and out-of-bounds memory
|
||||||
//! accesses that occur when runniing webassembly.
|
//! accesses that occur when running WebAssembly.
|
||||||
//!
|
//!
|
||||||
//! This code is inspired by: https://github.com/pepyakin/wasmtime/commit/625a2b6c0815b21996e111da51b9664feb174622
|
//! This code is inspired by: https://github.com/pepyakin/wasmtime/commit/625a2b6c0815b21996e111da51b9664feb174622
|
||||||
//!
|
//!
|
||||||
|
@ -17,7 +17,7 @@ use crate::{
|
|||||||
};
|
};
|
||||||
use std::slice;
|
use std::slice;
|
||||||
|
|
||||||
/// The `LocalBacking` "owns" the memory used by all the local resources.
|
/// The `LocalBacking` "owns" the memory used by all the local resources of an Instance.
|
||||||
/// That is, local memories, tables, and globals (as well as some additional
|
/// That is, local memories, tables, and globals (as well as some additional
|
||||||
/// data for the virtual call machinery).
|
/// data for the virtual call machinery).
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@ -103,7 +103,7 @@ impl LocalBacking {
|
|||||||
memories.into_boxed_map()
|
memories.into_boxed_map()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Initialize each local memory.
|
/// Initialize each locally-defined memory in the Module.
|
||||||
///
|
///
|
||||||
/// This involves copying in the data initializers.
|
/// This involves copying in the data initializers.
|
||||||
fn finalize_memories(
|
fn finalize_memories(
|
||||||
@ -178,7 +178,7 @@ impl LocalBacking {
|
|||||||
tables.into_boxed_map()
|
tables.into_boxed_map()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This initializes all of the local tables, e.g.
|
/// This initializes all of the locally-defined tables in the Module, e.g.
|
||||||
/// putting all the table elements (function pointers)
|
/// putting all the table elements (function pointers)
|
||||||
/// in the right places.
|
/// in the right places.
|
||||||
#[allow(clippy::cast_ptr_alignment)]
|
#[allow(clippy::cast_ptr_alignment)]
|
||||||
|
@ -11,7 +11,7 @@ pub type ResolveResult<T> = std::result::Result<T, ResolveError>;
|
|||||||
pub type ParseResult<T> = std::result::Result<T, ParseError>;
|
pub type ParseResult<T> = std::result::Result<T, ParseError>;
|
||||||
|
|
||||||
/// This is returned when the chosen compiler is unable to
|
/// This is returned when the chosen compiler is unable to
|
||||||
/// successfully compile the provided webassembly module into
|
/// successfully compile the provided WebAssembly module into
|
||||||
/// a `Module`.
|
/// a `Module`.
|
||||||
///
|
///
|
||||||
/// Comparing two `CompileError`s always evaluates to false.
|
/// Comparing two `CompileError`s always evaluates to false.
|
||||||
@ -114,7 +114,7 @@ impl std::fmt::Display for LinkError {
|
|||||||
impl std::error::Error for LinkError {}
|
impl std::error::Error for LinkError {}
|
||||||
|
|
||||||
/// This is the error type returned when calling
|
/// This is the error type returned when calling
|
||||||
/// a webassembly function.
|
/// a WebAssembly function.
|
||||||
///
|
///
|
||||||
/// The main way to do this is `Instance.call`.
|
/// The main way to do this is `Instance.call`.
|
||||||
///
|
///
|
||||||
@ -270,7 +270,7 @@ impl std::error::Error for CreationError {}
|
|||||||
|
|
||||||
/// The amalgamation of all errors that can occur
|
/// The amalgamation of all errors that can occur
|
||||||
/// during the compilation, instantiation, or execution
|
/// during the compilation, instantiation, or execution
|
||||||
/// of a webassembly module.
|
/// of a WebAssembly module.
|
||||||
///
|
///
|
||||||
/// Comparing two `Error`s always evaluates to false.
|
/// Comparing two `Error`s always evaluates to false.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -262,7 +262,7 @@ impl Instance {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Call an exported webassembly function given the export name.
|
/// Call an exported WebAssembly function given the export name.
|
||||||
/// Pass arguments by wrapping each one in the [`Value`] enum.
|
/// Pass arguments by wrapping each one in the [`Value`] enum.
|
||||||
/// The returned values are also each wrapped in a [`Value`].
|
/// The returned values are also each wrapped in a [`Value`].
|
||||||
///
|
///
|
||||||
@ -270,7 +270,7 @@ impl Instance {
|
|||||||
///
|
///
|
||||||
/// # Note:
|
/// # Note:
|
||||||
/// This returns `CallResult<Vec<Value>>` in order to support
|
/// This returns `CallResult<Vec<Value>>` in order to support
|
||||||
/// the future multi-value returns webassembly feature.
|
/// the future multi-value returns WebAssembly feature.
|
||||||
///
|
///
|
||||||
/// # Usage:
|
/// # Usage:
|
||||||
/// ```
|
/// ```
|
||||||
@ -601,7 +601,7 @@ pub struct DynFunc<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> DynFunc<'a> {
|
impl<'a> DynFunc<'a> {
|
||||||
/// Call an exported webassembly function safely.
|
/// Call an exported WebAssembly function safely.
|
||||||
///
|
///
|
||||||
/// Pass arguments by wrapping each one in the [`Value`] enum.
|
/// Pass arguments by wrapping each one in the [`Value`] enum.
|
||||||
/// The returned values are also each wrapped in a [`Value`].
|
/// The returned values are also each wrapped in a [`Value`].
|
||||||
@ -610,7 +610,7 @@ impl<'a> DynFunc<'a> {
|
|||||||
///
|
///
|
||||||
/// # Note:
|
/// # Note:
|
||||||
/// This returns `CallResult<Vec<Value>>` in order to support
|
/// This returns `CallResult<Vec<Value>>` in order to support
|
||||||
/// the future multi-value returns webassembly feature.
|
/// the future multi-value returns WebAssembly feature.
|
||||||
///
|
///
|
||||||
/// # Usage:
|
/// # Usage:
|
||||||
/// ```
|
/// ```
|
||||||
|
@ -11,7 +11,7 @@ use crate::{
|
|||||||
/// This is an internal-only api.
|
/// This is an internal-only api.
|
||||||
///
|
///
|
||||||
/// A static memory allocates 6GB of *virtual* memory when created
|
/// A static memory allocates 6GB of *virtual* memory when created
|
||||||
/// in order to allow the webassembly module to contain no bounds-checks.
|
/// in order to allow the WebAssembly module to contain no bounds-checks.
|
||||||
///
|
///
|
||||||
/// Additionally, static memories stay at a single virtual address, so there is no need
|
/// Additionally, static memories stay at a single virtual address, so there is no need
|
||||||
/// to reload its address on each use.
|
/// to reload its address on each use.
|
||||||
|
@ -11,8 +11,8 @@ use hashbrown::HashMap;
|
|||||||
|
|
||||||
/// The context of the currently running WebAssembly instance.
|
/// The context of the currently running WebAssembly instance.
|
||||||
///
|
///
|
||||||
/// This is implicitly passed to every webassembly function.
|
/// This is implicitly passed to every WebAssembly function.
|
||||||
/// Since this is per-module, each field has a statically
|
/// Since this is per-instance, each field has a statically
|
||||||
/// (as in after compiling the wasm) known size, so no
|
/// (as in after compiling the wasm) known size, so no
|
||||||
/// runtime checks are necessary.
|
/// runtime checks are necessary.
|
||||||
///
|
///
|
||||||
@ -38,7 +38,7 @@ pub struct Ctx {
|
|||||||
//// This is intended to be user-supplied, per-instance
|
//// This is intended to be user-supplied, per-instance
|
||||||
/// contextual data. There are currently some issue with it,
|
/// contextual data. There are currently some issue with it,
|
||||||
/// notably that it cannot be set before running the `start`
|
/// notably that it cannot be set before running the `start`
|
||||||
/// function in a webassembly module.
|
/// function in a WebAssembly module.
|
||||||
///
|
///
|
||||||
/// [#219](https://github.com/wasmerio/wasmer/pull/219) fixes that
|
/// [#219](https://github.com/wasmerio/wasmer/pull/219) fixes that
|
||||||
/// issue, as well as allowing the user to have *per-function*
|
/// issue, as well as allowing the user to have *per-function*
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
//! Installing signal handlers allows us to handle traps and out-of-bounds memory
|
//! Installing signal handlers allows us to handle traps and out-of-bounds memory
|
||||||
//! accesses that occur when runniing webassembly.
|
//! accesses that occur when runniing WebAssembly.
|
||||||
//!
|
//!
|
||||||
//! This code is inspired by: https://github.com/pepyakin/wasmtime/commit/625a2b6c0815b21996e111da51b9664feb174622
|
//! This code is inspired by: https://github.com/pepyakin/wasmtime/commit/625a2b6c0815b21996e111da51b9664feb174622
|
||||||
//!
|
//!
|
||||||
|
Reference in New Issue
Block a user