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