1
0
mirror of https://github.com/fluencelabs/wasmer synced 2025-07-31 07:12:10 +00:00

Instance now pulls state from the ImportObject

This commit is contained in:
Lachlan Sneff
2019-03-28 11:56:31 -07:00
parent e3a6b7c9d8
commit 7b0992e44f
4 changed files with 19 additions and 6 deletions

@@ -63,7 +63,16 @@ impl Instance {
// Initialize the vm::Ctx in-place after the backing
// has been boxed.
unsafe {
*inner.vmctx = vm::Ctx::new(&mut inner.backing, &mut inner.import_backing, &module)
*inner.vmctx = match imports.call_state_creator() {
Some((data, dtor)) => vm::Ctx::new_with_data(
&mut inner.backing,
&mut inner.import_backing,
&module,
data,
dtor,
),
None => vm::Ctx::new(&mut inner.backing, &mut inner.import_backing, &module),
};
};
let instance = Instance {