Skip to content
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

Making VMOffsets accessible from the InstanceHandle #2032

Closed
Geal opened this issue Jan 21, 2021 · 3 comments · Fixed by #2040
Closed

Making VMOffsets accessible from the InstanceHandle #2032

Geal opened this issue Jan 21, 2021 · 3 comments · Fixed by #2040
Assignees
Labels
🎉 enhancement New feature! 📦 lib-vm About wasmer-vm

Comments

@Geal
Copy link

Geal commented Jan 21, 2021

Hello! In my project, I have to rewrite parts of the VM context, and for that I use the wasm_vm::VMOffsets structure.
Right now, to access it, I write:

// with handle a &wasmer_vm::InstanceHandle
let module = handle.module_ref();
let vmoffsets = VMOffsets::new(std::mem::size_of::<*mut u8>() as u8, module);

Would it be possible to add a method to InstanceHandle so that it can directly return a VMOffsets that makes sense for it? Making sure that it has the same pointer size, etc.

@Geal Geal added the 🎉 enhancement New feature! label Jan 21, 2021
@Hywan Hywan self-assigned this Jan 21, 2021
@Hywan Hywan added the 📦 lib-vm About wasmer-vm label Jan 21, 2021
@Hywan
Copy link
Contributor

Hywan commented Jan 21, 2021

Sure, I think it's perfectly fine to add such feature. InstanceAllocator already has this API (which is private), so I guess it's fine to expose it publicly through InstanceHandle or even InstanceRef.

Hywan added a commit to Hywan/wasmer that referenced this issue Jan 22, 2021
The idea is to share the `VMOffsets` of a given `Instance` through
`InstanceHandle` for advanced users.

See wasmerio#2032.
@Hywan
Copy link
Contributor

Hywan commented Jan 22, 2021

Would #2040 solve your issue @Geal?

@Geal
Copy link
Author

Geal commented Jan 22, 2021

yes, thanks

@bors bors bot closed this as completed in fa0938c Jan 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎉 enhancement New feature! 📦 lib-vm About wasmer-vm
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants