Format files.
This commit is contained in:
@@ -12,7 +12,8 @@ use std::string::String;
|
|||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
use target_lexicon::Triple;
|
use target_lexicon::Triple;
|
||||||
use translation_utils::{
|
use translation_utils::{
|
||||||
DefinedFuncIndex, FuncIndex, Global, GlobalIndex, Memory, MemoryIndex, SignatureIndex, Table, TableIndex,
|
DefinedFuncIndex, FuncIndex, Global, GlobalIndex, Memory, MemoryIndex, SignatureIndex, Table,
|
||||||
|
TableIndex,
|
||||||
};
|
};
|
||||||
use wasmparser;
|
use wasmparser;
|
||||||
|
|
||||||
@@ -426,7 +427,8 @@ impl<'data> ModuleEnvironment<'data> for DummyEnvironment {
|
|||||||
fn define_function_body(&mut self, body_bytes: &'data [u8]) -> WasmResult<()> {
|
fn define_function_body(&mut self, body_bytes: &'data [u8]) -> WasmResult<()> {
|
||||||
let func = {
|
let func = {
|
||||||
let mut func_environ = DummyFuncEnvironment::new(&self.info);
|
let mut func_environ = DummyFuncEnvironment::new(&self.info);
|
||||||
let func_index = FuncIndex::new(self.get_num_func_imports() + self.info.function_bodies.len());
|
let func_index =
|
||||||
|
FuncIndex::new(self.get_num_func_imports() + self.info.function_bodies.len());
|
||||||
let name = get_func_name(func_index);
|
let name = get_func_name(func_index);
|
||||||
let sig = func_environ.vmctx_sig(self.get_func_type(func_index));
|
let sig = func_environ.vmctx_sig(self.get_func_type(func_index));
|
||||||
let mut func = ir::Function::with_name_signature(name, sig);
|
let mut func = ir::Function::with_name_signature(name, sig);
|
||||||
|
|||||||
@@ -50,8 +50,8 @@ pub use environ::{
|
|||||||
pub use func_translator::FuncTranslator;
|
pub use func_translator::FuncTranslator;
|
||||||
pub use module_translator::translate_module;
|
pub use module_translator::translate_module;
|
||||||
pub use translation_utils::{
|
pub use translation_utils::{
|
||||||
DefinedFuncIndex, FuncIndex, Global, GlobalIndex, GlobalInit, Memory, MemoryIndex, SignatureIndex, Table,
|
DefinedFuncIndex, FuncIndex, Global, GlobalIndex, GlobalInit, Memory, MemoryIndex,
|
||||||
TableIndex,
|
SignatureIndex, Table, TableIndex,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(not(feature = "std"))]
|
#[cfg(not(feature = "std"))]
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ use environ::{ModuleEnvironment, WasmError, WasmResult};
|
|||||||
use std::str::from_utf8;
|
use std::str::from_utf8;
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
use translation_utils::{
|
use translation_utils::{
|
||||||
type_to_type, FuncIndex, Global, GlobalIndex, GlobalInit, Memory, MemoryIndex,
|
type_to_type, FuncIndex, Global, GlobalIndex, GlobalInit, Memory, MemoryIndex, SignatureIndex,
|
||||||
SignatureIndex, Table, TableElementType, TableIndex,
|
Table, TableElementType, TableIndex,
|
||||||
};
|
};
|
||||||
use wasmparser;
|
use wasmparser;
|
||||||
use wasmparser::{
|
use wasmparser::{
|
||||||
@@ -383,8 +383,10 @@ pub fn parse_elements_section(
|
|||||||
};
|
};
|
||||||
match *parser.read() {
|
match *parser.read() {
|
||||||
ParserState::ElementSectionEntryBody(ref elements) => {
|
ParserState::ElementSectionEntryBody(ref elements) => {
|
||||||
let elems: Vec<FuncIndex> =
|
let elems: Vec<FuncIndex> = elements
|
||||||
elements.iter().map(|&x| FuncIndex::new(x as usize)).collect();
|
.iter()
|
||||||
|
.map(|&x| FuncIndex::new(x as usize))
|
||||||
|
.collect();
|
||||||
environ.declare_table_elements(table_index, base, offset, elems)
|
environ.declare_table_elements(table_index, base, offset, elems)
|
||||||
}
|
}
|
||||||
ParserState::Error(e) => return Err(WasmError::from_binary_reader_error(e)),
|
ParserState::Error(e) => return Err(WasmError::from_binary_reader_error(e)),
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ use wasmparser;
|
|||||||
pub struct FuncIndex(u32);
|
pub struct FuncIndex(u32);
|
||||||
entity_impl!(FuncIndex);
|
entity_impl!(FuncIndex);
|
||||||
|
|
||||||
/// Index type of a defined function inside the WebAssembly module.
|
/// Index type of a defined function inside the WebAssembly module.
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||||
pub struct DefinedFuncIndex(u32);
|
pub struct DefinedFuncIndex(u32);
|
||||||
entity_impl!(DefinedFuncIndex);
|
entity_impl!(DefinedFuncIndex);
|
||||||
|
|||||||
Reference in New Issue
Block a user