Add some docs.

This commit is contained in:
Sergey Pepyakin 2019-03-29 18:13:36 +01:00
parent 0267b20e6e
commit 716e8b5613
1 changed files with 10 additions and 5 deletions

View File

@ -21,15 +21,17 @@ const DEFAULT_FRAME_STACK_LIMIT: usize = 16384;
struct BlockFrame { struct BlockFrame {
/// Frame type. /// Frame type.
frame_type: BlockFrameType, frame_type: BlockFrameType,
/// A signature, which is a block signature type indicating the number and types of result values of the region. /// A signature, which is a block signature type indicating the number and types of result
/// values of the region.
block_type: BlockType, block_type: BlockType,
/// A label for reference to block instruction. /// A label for reference to block instruction.
begin_position: usize, begin_position: usize,
/// A limit integer value, which is an index into the value stack indicating where to reset it to on a branch to that label. /// A limit integer value, which is an index into the value stack indicating where to reset it
/// to on a branch to that label.
value_stack_len: usize, value_stack_len: usize,
/// Boolean which signals whether value stack became polymorphic. Value stack starts in non-polymorphic state and /// Boolean which signals whether value stack became polymorphic. Value stack starts in
/// becomes polymorphic only after an instruction that never passes control further is executed, /// a non-polymorphic state and becomes polymorphic only after an instruction that never passes
/// i.e. `unreachable`, `br` (but not `br_if`!), etc. /// control further is executed, i.e. `unreachable`, `br` (but not `br_if`!), etc.
polymorphic_stack: bool, polymorphic_stack: bool,
} }
@ -1783,6 +1785,9 @@ fn require_local(locals: &Locals, idx: u32) -> Result<ValueType, Error> {
Ok(locals.type_of_local(idx)?) Ok(locals.type_of_local(idx)?)
} }
/// Returns a relative depth on the stack of a local variable specified
/// by `idx`.
///
/// See stack layout definition in mod isa. /// See stack layout definition in mod isa.
fn relative_local_depth( fn relative_local_depth(
idx: u32, idx: u32,