mirror of
https://github.com/fluencelabs/wasmer
synced 2025-03-30 22:41:03 +00:00
remove feature flag on custom sections
This commit is contained in:
parent
4cee16220b
commit
f2488ac410
@ -39,7 +39,7 @@ glob = "0.2.11"
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["fast-tests"]
|
default = ["fast-tests"]
|
||||||
vfs = ["wasmer-runtime-abi", "wasmer-runtime-core/vfs", "wasmer-emscripten/vfs", "wasmer-clif-backend/vfs", "wasmer-llvm-backend/vfs"]
|
vfs = ["wasmer-runtime-abi", "wasmer-emscripten/vfs"]
|
||||||
debug = ["wasmer-clif-backend/debug", "wasmer-runtime-core/debug"]
|
debug = ["wasmer-clif-backend/debug", "wasmer-runtime-core/debug"]
|
||||||
# This feature will allow cargo test to run much faster
|
# This feature will allow cargo test to run much faster
|
||||||
fast-tests = []
|
fast-tests = []
|
||||||
|
@ -37,4 +37,3 @@ wasmer-win-exception-handler = { path = "../win-exception-handler", version = "0
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
debug = ["wasmer-runtime-core/debug"]
|
debug = ["wasmer-runtime-core/debug"]
|
||||||
vfs = ["wasmer-runtime-core/vfs"]
|
|
||||||
|
@ -51,7 +51,6 @@ impl Module {
|
|||||||
namespace_table: StringTable::new(),
|
namespace_table: StringTable::new(),
|
||||||
name_table: StringTable::new(),
|
name_table: StringTable::new(),
|
||||||
|
|
||||||
#[cfg(feature = "vfs")]
|
|
||||||
custom_sections: HashMap::new(),
|
custom_sections: HashMap::new(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -32,4 +32,4 @@ glob = "0.2.11"
|
|||||||
[features]
|
[features]
|
||||||
clif = []
|
clif = []
|
||||||
llvm = []
|
llvm = []
|
||||||
vfs = ["wasmer-runtime-core/vfs", "wasmer-clif-backend/vfs", "wasmer-llvm-backend/vfs", "wasmer-runtime-abi"]
|
vfs = ["wasmer-runtime-abi"]
|
||||||
|
@ -28,4 +28,3 @@ wabt = "0.7.4"
|
|||||||
[features]
|
[features]
|
||||||
debug = ["wasmer-runtime-core/debug"]
|
debug = ["wasmer-runtime-core/debug"]
|
||||||
disasm = ["capstone"]
|
disasm = ["capstone"]
|
||||||
vfs = ["wasmer-runtime-core/vfs"]
|
|
||||||
|
@ -18,7 +18,6 @@ use wasmparser::{
|
|||||||
SectionCode, Type as WpType,
|
SectionCode, Type as WpType,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature = "vfs")]
|
|
||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
|
|
||||||
pub fn read_module(wasm: &[u8]) -> Result<(ModuleInfo, CodeSectionReader), BinaryReaderError> {
|
pub fn read_module(wasm: &[u8]) -> Result<(ModuleInfo, CodeSectionReader), BinaryReaderError> {
|
||||||
@ -46,7 +45,6 @@ pub fn read_module(wasm: &[u8]) -> Result<(ModuleInfo, CodeSectionReader), Binar
|
|||||||
namespace_table: StringTable::new(),
|
namespace_table: StringTable::new(),
|
||||||
name_table: StringTable::new(),
|
name_table: StringTable::new(),
|
||||||
|
|
||||||
#[cfg(feature = "vfs")]
|
|
||||||
custom_sections: HashMap::new(),
|
custom_sections: HashMap::new(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ repository = "https://github.com/wasmerio/wasmer"
|
|||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
wasmer-runtime-core = { path = "../runtime-core", features = ["vfs"] }
|
wasmer-runtime-core = { path = "../runtime-core" }
|
||||||
hashbrown = "0.1"
|
hashbrown = "0.1"
|
||||||
failure = "0.1"
|
failure = "0.1"
|
||||||
tar = "0.4"
|
tar = "0.4"
|
||||||
|
@ -45,4 +45,3 @@ field-offset = "0.1.1"
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
debug = []
|
debug = []
|
||||||
vfs = []
|
|
||||||
|
@ -8,7 +8,6 @@ pub type LinkResult<T> = std::result::Result<T, Vec<LinkError>>;
|
|||||||
pub type RuntimeResult<T> = std::result::Result<T, RuntimeError>;
|
pub type RuntimeResult<T> = std::result::Result<T, RuntimeError>;
|
||||||
pub type CallResult<T> = std::result::Result<T, CallError>;
|
pub type CallResult<T> = std::result::Result<T, CallError>;
|
||||||
pub type ResolveResult<T> = std::result::Result<T, ResolveError>;
|
pub type ResolveResult<T> = std::result::Result<T, ResolveError>;
|
||||||
#[cfg(feature = "vfs")]
|
|
||||||
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
|
||||||
@ -448,13 +447,11 @@ impl Into<GrowError> for MemoryProtectionError {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "vfs")]
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum ParseError {
|
pub enum ParseError {
|
||||||
BinaryReadError,
|
BinaryReadError,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "vfs")]
|
|
||||||
impl From<wasmparser::BinaryReaderError> for ParseError {
|
impl From<wasmparser::BinaryReaderError> for ParseError {
|
||||||
fn from(_: wasmparser::BinaryReaderError) -> Self {
|
fn from(_: wasmparser::BinaryReaderError) -> Self {
|
||||||
ParseError::BinaryReadError
|
ParseError::BinaryReadError
|
||||||
|
@ -67,14 +67,9 @@ pub fn compile_with(
|
|||||||
compiler: &dyn backend::Compiler,
|
compiler: &dyn backend::Compiler,
|
||||||
) -> CompileResult<module::Module> {
|
) -> CompileResult<module::Module> {
|
||||||
let token = backend::Token::generate();
|
let token = backend::Token::generate();
|
||||||
compiler.compile(wasm, token).map(|inner| {
|
compiler.compile(wasm, token).map(|mut inner| {
|
||||||
#[cfg(feature = "vfs")]
|
|
||||||
let inner = {
|
|
||||||
let mut inner = inner;
|
|
||||||
let inner_info: &mut crate::module::ModuleInfo = &mut inner.info;
|
let inner_info: &mut crate::module::ModuleInfo = &mut inner.info;
|
||||||
inner_info.import_custom_sections(wasm).unwrap();
|
inner_info.import_custom_sections(wasm).unwrap();
|
||||||
inner
|
|
||||||
};
|
|
||||||
module::Module::new(Arc::new(inner))
|
module::Module::new(Arc::new(inner))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -57,12 +57,10 @@ pub struct ModuleInfo {
|
|||||||
pub namespace_table: StringTable<NamespaceIndex>,
|
pub namespace_table: StringTable<NamespaceIndex>,
|
||||||
pub name_table: StringTable<NameIndex>,
|
pub name_table: StringTable<NameIndex>,
|
||||||
|
|
||||||
#[cfg(feature = "vfs")]
|
|
||||||
pub custom_sections: HashMap<String, Vec<u8>>,
|
pub custom_sections: HashMap<String, Vec<u8>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ModuleInfo {
|
impl ModuleInfo {
|
||||||
#[cfg(feature = "vfs")]
|
|
||||||
pub fn import_custom_sections(&mut self, wasm: &[u8]) -> crate::error::ParseResult<()> {
|
pub fn import_custom_sections(&mut self, wasm: &[u8]) -> crate::error::ParseResult<()> {
|
||||||
let mut parser = wasmparser::ModuleReader::new(wasm)?;
|
let mut parser = wasmparser::ModuleReader::new(wasm)?;
|
||||||
while !parser.eof() {
|
while !parser.eof() {
|
||||||
|
@ -592,7 +592,6 @@ mod vm_ctx_tests {
|
|||||||
namespace_table: StringTable::new(),
|
namespace_table: StringTable::new(),
|
||||||
name_table: StringTable::new(),
|
name_table: StringTable::new(),
|
||||||
|
|
||||||
#[cfg(feature = "vfs")]
|
|
||||||
custom_sections: HashMap::new(),
|
custom_sections: HashMap::new(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user