-
Notifications
You must be signed in to change notification settings - Fork 821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for the WASI ABI. #299
Conversation
@@ -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( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dtor
? maybe destructor
or finalizer
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, either of those is fine. dtor
was just short and it's common in the c++ world.
|
||
#[allow(clippy::mut_from_ref)] | ||
fn get_wasi_state(ctx: &Ctx) -> &mut WasiState { | ||
unsafe { &mut *(ctx.data as *mut WasiState) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One idea: we could differentiate between ModuleState, InstanceState, FunctionState (if we add that).
lib/wasi/src/state.rs
Outdated
Ok(Self { | ||
repo: RepoOpener::new() | ||
.create(true) | ||
.open("mem://foo", "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's call it something else
bors r+ |
299: Support for the WASI ABI. r=xmclark a=lachlansneff part of #297 Co-authored-by: Lachlan Sneff <lachlan.sneff@gmail.com> Co-authored-by: Mark McCaskey <mark@wasmer.io> Co-authored-by: bors[bot] <bors[bot]@users.noreply.github.com> Co-authored-by: Mark McCaskey <markmccaskey@users.noreply.github.com>
Adapted API to Wasmer 3.0
part of #297