feat(deprecated) Add Ctx.module_info.

This commit is contained in:
Ivan Enderlin
2020-06-30 14:55:44 +02:00
parent dea04859e4
commit 8078f081be
2 changed files with 10 additions and 0 deletions

View File

@@ -38,6 +38,13 @@ pub struct Instance {
impl Instance {
pub(crate) fn new(pre_instance: Box<PreInstance>, new_instance: new::wasmer::Instance) -> Self {
// Initialize the `vm::Ctx`
{
let mut vmctx = pre_instance.vmctx.borrow_mut();
vmctx.module_info = new_instance.module().info() as *const _;
}
Self {
pre_instance,
exports: new_instance.exports.clone().into(),

View File

@@ -1,8 +1,10 @@
use crate::module::ModuleInfo;
use std::{ffi::c_void, ptr};
#[derive(Debug, Clone)]
#[repr(C)]
pub struct Ctx {
pub module_info: *const ModuleInfo,
pub data: *mut c_void,
pub data_finalizer: Option<fn(data: *mut c_void)>,
}
@@ -10,6 +12,7 @@ pub struct Ctx {
impl Ctx {
pub(crate) unsafe fn new_uninit() -> Self {
Self {
module_info: ptr::null(),
data: ptr::null_mut(),
data_finalizer: None,
}