Add FuncEnvironment trait.
This trait is used to provide the environment necessary to translate a single WebAssembly function without having other global data structures for the WebAssembly module. The WasmRuntime trait extends the FuncEnvironment trait for those uses that want to parse a whole WebAssembly module. - Change the handling of WebAssembly globals to use the FuncEnvironment trait as well as the new GlobalVar infrastructure in Cretonne. The runtime is not consulted on the translation of each get_global/get_global instruction. Instead it gets to create the GlobalVar declaration in the function preamble the first time the global is used. - Change the handling of heap load/store instructions to use the new Heap infrastructure in Cretonne. The runtime is called to create the Heap declaration in the preamble. It is not involved in individual load/store instructions.
This commit is contained in:
@@ -26,7 +26,10 @@ pub struct FunctionBuilder<'a, Variable: 'a>
|
||||
where
|
||||
Variable: EntityRef + Hash + Default,
|
||||
{
|
||||
func: &'a mut Function,
|
||||
/// The function currently being built.
|
||||
/// This field is public so the function can be re-borrowed.
|
||||
pub func: &'a mut Function,
|
||||
|
||||
builder: &'a mut ILBuilder<Variable>,
|
||||
position: Position,
|
||||
pristine: bool,
|
||||
|
||||
Reference in New Issue
Block a user