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:
21
lib/runtime/src/compilation.rs
Normal file
21
lib/runtime/src/compilation.rs
Normal 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 }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user