mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-29 16:41:33 +00:00
Added extra assertions in Emscripten. Fixed #244
This commit is contained in:
@ -34,11 +34,13 @@ pub fn is_emscripten_module(module: &Module) -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_emscripten_table_size(module: &Module) -> (u32, Option<u32>) {
|
pub fn get_emscripten_table_size(module: &Module) -> (u32, Option<u32>) {
|
||||||
|
assert!(module.info().imported_tables.len() > 0, "Emscripten requires at least one imported table" );
|
||||||
let (_, table) = &module.info().imported_tables[ImportedTableIndex::new(0)];
|
let (_, table) = &module.info().imported_tables[ImportedTableIndex::new(0)];
|
||||||
(table.minimum, table.maximum)
|
(table.minimum, table.maximum)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_emscripten_memory_size(module: &Module) -> (Pages, Option<Pages>, bool) {
|
pub fn get_emscripten_memory_size(module: &Module) -> (Pages, Option<Pages>, bool) {
|
||||||
|
assert!(module.info().imported_tables.len() > 0, "Emscripten requires at least one imported memory" );
|
||||||
let (_, memory) = &module.info().imported_memories[ImportedMemoryIndex::new(0)];
|
let (_, memory) = &module.info().imported_memories[ImportedMemoryIndex::new(0)];
|
||||||
(memory.minimum, memory.maximum, memory.shared)
|
(memory.minimum, memory.maximum, memory.shared)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user