Begin internal reorganization.

This begins reorganizing how translation and compilation occur, and
setting up infrastructure for imports/exports and relocations. It
splits parts out of StandaloneRuntime, forming Module, Compilation,
and Instance structs, which can be used more independently.

It also simplifies the command-line interface, in a step towards
making simple tools that just expose the functionality of the
libraries.
This commit is contained in:
Dan Gohman
2017-10-12 13:21:29 -07:00
parent 3d6f0f7045
commit ca1b461375
10 changed files with 607 additions and 868 deletions

View File

@@ -0,0 +1,21 @@
//! A `Compilation` contains the compiled function bodies for a WebAssembly
//! module.
use module::Module;
/// An Instance of a WebAssemby module.
#[derive(Debug)]
pub struct Compilation<'module> {
/// The module this `Instance` is instantiated from.
pub module: &'module Module,
/// Compiled machine code for the function bodies.
pub functions: Vec<Vec<u8>>,
}
impl<'module> Compilation<'module> {
/// Allocates the runtime data structures with the given flags.
pub fn new(module: &'module Module, functions: Vec<Vec<u8>>) -> Self {
Self { module, functions }
}
}