Add a FuncEnvironment::make_direct_func() callback.

This allows the environment to control the signatures used for direct
function calls. The signature and calling convention may depend on
whether the function is imported or local.

Also add WasmRuntime::declare_func_{import,type} to notify the runtime
about imported and local functions. This is necessary so the runtime
knows what function indexes are referring to .

Since imported and local functions are now declared to the runtime, it
is no longer necessary to return hashes mapping between WebAssembly
indexes and Cretonne entities.

Also stop return null entries for the imported functions in the
TranslationResult. Just return a vector of local functions.
This commit is contained in:
Jakob Stoklund Olesen
2017-09-06 11:44:52 -07:00
parent 45b093ea59
commit dc2bee9cef
10 changed files with 154 additions and 223 deletions

View File

@@ -23,8 +23,7 @@ mod sections_translator;
mod state;
mod translation_utils;
pub use module_translator::{translate_module, TranslationResult, FunctionTranslation,
ImportMappings};
pub use runtime::{WasmRuntime, DummyRuntime};
pub use module_translator::{translate_module, TranslationResult};
pub use runtime::{FuncEnvironment, WasmRuntime, DummyRuntime};
pub use translation_utils::{Local, FunctionIndex, GlobalIndex, TableIndex, MemoryIndex, RawByte,
MemoryAddress, SignatureIndex, Global, GlobalInit, Table, Memory};