Add caching. (#134)

* Allow a module to have a different signature registry than the process-specific

* Add core ability to build compiled code caches

* Remove timing printouts

* Serialize/Deserialize memories to reduce copies

* Work more on api

* Relocate local functions relatively before external functions

* Fix incorrect definition in test

* merge errors caused by merge

* Fix emscripten compile

* Fix review comments
This commit is contained in:
Lachlan Sneff
2019-02-06 16:26:45 -08:00
committed by GitHub
parent 2f2f86a4de
commit 8fe9b7eac2
34 changed files with 1768 additions and 291 deletions

View File

@ -15,8 +15,14 @@ use wasmer_runtime_core::{
/// We check if a provided module is an Emscripten generated one
pub fn is_emscripten_module(module: &Module) -> bool {
for (_, import_name) in &module.0.imported_functions {
if import_name.name == "_emscripten_memcpy_big" && import_name.namespace == "env" {
for (_, import_name) in &module.0.info.imported_functions {
let namespace = module
.0
.info
.namespace_table
.get(import_name.namespace_index);
let field = module.0.info.name_table.get(import_name.name_index);
if field == "_emscripten_memcpy_big" && namespace == "env" {
return true;
}
}
@ -24,12 +30,12 @@ pub fn is_emscripten_module(module: &Module) -> bool {
}
pub fn get_emscripten_table_size(module: &Module) -> (u32, Option<u32>) {
let (_, table) = &module.0.imported_tables[ImportedTableIndex::new(0)];
let (_, table) = &module.0.info.imported_tables[ImportedTableIndex::new(0)];
(table.minimum, table.maximum)
}
pub fn get_emscripten_memory_size(module: &Module) -> (Pages, Option<Pages>) {
let (_, memory) = &module.0.imported_memories[ImportedMemoryIndex::new(0)];
let (_, memory) = &module.0.info.imported_memories[ImportedMemoryIndex::new(0)];
(memory.minimum, memory.maximum)
}