mirror of
https://github.com/fluencelabs/parity-wasm
synced 2025-06-23 19:52:02 +00:00
comments
This commit is contained in:
@ -12,5 +12,6 @@ keywords = ["wasm", "webassembly", "bytecode", "serde", "interpreter"]
|
||||
exclude = [ "res/*", "spec/*" ]
|
||||
|
||||
[dependencies]
|
||||
log = "0.3"
|
||||
byteorder = "1.0"
|
||||
parking_lot = "0.4"
|
@ -427,7 +427,6 @@ impl Deserialize for VarUint1 {
|
||||
fn deserialize<R: io::Read>(reader: &mut R) -> Result<Self, Self::Error> {
|
||||
let mut u8buf = [0u8; 1];
|
||||
reader.read_exact(&mut u8buf)?;
|
||||
// todo check range
|
||||
match u8buf[0] {
|
||||
0 => Ok(VarUint1(false)),
|
||||
1 => Ok(VarUint1(true)),
|
||||
|
@ -40,7 +40,7 @@ pub enum ExportEntryType {
|
||||
|
||||
/// Module instance API.
|
||||
pub trait ModuleInstanceInterface {
|
||||
/// Run instantiation-time procedures (validation and start function call). Module is not completely validated until this call.
|
||||
/// Run instantiation-time procedures (validation and start function [if any] call). Module is not completely validated until this call.
|
||||
fn instantiate<'a>(&self, is_user_module: bool, externals: Option<&'a HashMap<String, Arc<ModuleInstanceInterface + 'a>>>) -> Result<(), Error>;
|
||||
/// Execute function with the given index.
|
||||
fn execute_index(&self, index: u32, params: ExecutionParams) -> Result<Option<RuntimeValue>, Error>;
|
||||
|
@ -858,7 +858,7 @@ impl Interpreter {
|
||||
loop {
|
||||
let instruction = &body[context.position];
|
||||
|
||||
// println!("=== RUNNING {:?}", instruction); // TODO: trace
|
||||
debug!(target: "interpreter", "running {:?}", instruction);
|
||||
match Interpreter::run_instruction(context, instruction)? {
|
||||
InstructionOutcome::RunInstruction => (),
|
||||
InstructionOutcome::RunNextInstruction => context.position += 1,
|
||||
|
@ -77,7 +77,7 @@ impl Validator {
|
||||
}
|
||||
|
||||
pub fn validate_instruction(context: &mut FunctionValidationContext, opcode: &Opcode) -> Result<InstructionOutcome, Error> {
|
||||
// println!("=== VALIDATING {:?}: {:?}", opcode, context.value_stack);
|
||||
debug!(target: "validator", "validating {:?}", opcode);
|
||||
match opcode {
|
||||
&Opcode::Unreachable => Ok(InstructionOutcome::Unreachable),
|
||||
&Opcode::Nop => Ok(InstructionOutcome::RunNextInstruction),
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
#![warn(missing_docs)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
extern crate byteorder;
|
||||
extern crate parking_lot;
|
||||
|
||||
|
Reference in New Issue
Block a user