mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-17 01:28:44 +00:00
feat(deprecated) Add Ctx.module_info.
This commit is contained in:
@@ -38,6 +38,13 @@ pub struct Instance {
|
|||||||
|
|
||||||
impl Instance {
|
impl Instance {
|
||||||
pub(crate) fn new(pre_instance: Box<PreInstance>, new_instance: new::wasmer::Instance) -> Self {
|
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 {
|
Self {
|
||||||
pre_instance,
|
pre_instance,
|
||||||
exports: new_instance.exports.clone().into(),
|
exports: new_instance.exports.clone().into(),
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
|
use crate::module::ModuleInfo;
|
||||||
use std::{ffi::c_void, ptr};
|
use std::{ffi::c_void, ptr};
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct Ctx {
|
pub struct Ctx {
|
||||||
|
pub module_info: *const ModuleInfo,
|
||||||
pub data: *mut c_void,
|
pub data: *mut c_void,
|
||||||
pub data_finalizer: Option<fn(data: *mut c_void)>,
|
pub data_finalizer: Option<fn(data: *mut c_void)>,
|
||||||
}
|
}
|
||||||
@@ -10,6 +12,7 @@ pub struct Ctx {
|
|||||||
impl Ctx {
|
impl Ctx {
|
||||||
pub(crate) unsafe fn new_uninit() -> Self {
|
pub(crate) unsafe fn new_uninit() -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
module_info: ptr::null(),
|
||||||
data: ptr::null_mut(),
|
data: ptr::null_mut(),
|
||||||
data_finalizer: None,
|
data_finalizer: None,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user