Dumped code from the wasm2cretonne repo.

Integrated wasm test suite translation as cretonne test

Fixes #146.
Fixes #143.
This commit is contained in:
Denis Merigoux
2017-08-10 16:05:04 -07:00
committed by Jakob Stoklund Olesen
parent e8276ed965
commit ee9989c4b9
20 changed files with 2804 additions and 5 deletions

27
lib/wasm/src/lib.rs Normal file
View File

@@ -0,0 +1,27 @@
//! Performs the translation from a wasm module in binary format to the in-memory representation
//! of the Cretonne IL. More particularly, it translates the code of all the functions bodies and
//! interacts with a runtime implementing the [`WasmRuntime`](trait.WasmRuntime.html) trait to
//! deal with tables, globals and linear memory.
//!
//! The crate provides a `DummyRuntime` trait that will allow to translate the code of the
//! functions but will fail at execution. You should use
//! [`wasmstandalone::StandaloneRuntime`](../wasmstandalone/struct.StandaloneRuntime.html) to be
//! able to execute the translated code.
//!
//! The main function of this module is [`translate_module`](fn.translate_module.html).
extern crate wasmparser;
extern crate cton_frontend;
extern crate cretonne;
mod module_translator;
mod translation_utils;
mod code_translator;
mod runtime;
mod sections_translator;
pub use module_translator::{translate_module, TranslationResult, FunctionTranslation,
ImportMappings};
pub use runtime::{WasmRuntime, DummyRuntime};
pub use translation_utils::{Local, FunctionIndex, GlobalIndex, TableIndex, MemoryIndex, RawByte,
MemoryAddress, SignatureIndex, Global, GlobalInit, Table, Memory};