This commit is contained in:
Svyatoslav Nikolsky
2017-06-13 13:36:37 +03:00
parent 0ee2826943
commit 7bc0f8a068
6 changed files with 6 additions and 4 deletions

View File

@ -12,5 +12,6 @@ keywords = ["wasm", "webassembly", "bytecode", "serde", "interpreter"]
exclude = [ "res/*", "spec/*" ]
[dependencies]
log = "0.3"
byteorder = "1.0"
parking_lot = "0.4"

View File

@ -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)),

View File

@ -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>;

View File

@ -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,

View File

@ -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),

View File

@ -2,6 +2,8 @@
#![warn(missing_docs)]
#[macro_use]
extern crate log;
extern crate byteorder;
extern crate parking_lot;