Enable shared memory in emscripten

This commit is contained in:
Syrus 2019-07-06 17:29:24 -07:00
parent 24e7c1b263
commit b1f868dc52
2 changed files with 4 additions and 4 deletions

View File

@ -440,13 +440,13 @@ impl EmscriptenGlobals {
} }
let (table_min, table_max) = get_emscripten_table_size(&module); let (table_min, table_max) = get_emscripten_table_size(&module);
let (memory_min, memory_max) = get_emscripten_memory_size(&module); let (memory_min, memory_max, shared) = get_emscripten_memory_size(&module);
// Memory initialization // Memory initialization
let memory_type = MemoryDescriptor { let memory_type = MemoryDescriptor {
minimum: memory_min, minimum: memory_min,
maximum: memory_max, maximum: memory_max,
shared: false, shared: shared,
}; };
let memory = Memory::new(memory_type).unwrap(); let memory = Memory::new(memory_type).unwrap();

View File

@ -36,9 +36,9 @@ pub fn get_emscripten_table_size(module: &Module) -> (u32, Option<u32>) {
(table.minimum, table.maximum) (table.minimum, table.maximum)
} }
pub fn get_emscripten_memory_size(module: &Module) -> (Pages, Option<Pages>) { pub fn get_emscripten_memory_size(module: &Module) -> (Pages, Option<Pages>, bool) {
let (_, memory) = &module.info().imported_memories[ImportedMemoryIndex::new(0)]; let (_, memory) = &module.info().imported_memories[ImportedMemoryIndex::new(0)];
(memory.minimum, memory.maximum) (memory.minimum, memory.maximum, memory.shared)
} }
/// Reads values written by `-s EMIT_EMSCRIPTEN_METADATA=1` /// Reads values written by `-s EMIT_EMSCRIPTEN_METADATA=1`