mirror of
https://github.com/fluencelabs/wasmer
synced 2025-04-24 01:42:13 +00:00
Make the internal
field private from outside.
This commit is contained in:
parent
a4ee873eae
commit
26e4278657
@ -406,10 +406,8 @@ impl ProtectedCaller for X64ExecutionContext {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
unsafe {
|
unsafe {
|
||||||
(
|
let vmctx = _vmctx as *mut vm::InternalCtx;
|
||||||
(**(*_vmctx).internal.memories).base,
|
((**(*vmctx).memories).base, (**(*vmctx).memories).bound)
|
||||||
(**(*_vmctx).internal.memories).bound,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
} else if _module.info.imported_memories.len() > 0 {
|
} else if _module.info.imported_memories.len() > 0 {
|
||||||
if _module.info.memories.len() != 0 || _module.info.imported_memories.len() != 1 {
|
if _module.info.memories.len() != 0 || _module.info.imported_memories.len() != 1 {
|
||||||
@ -418,9 +416,10 @@ impl ProtectedCaller for X64ExecutionContext {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
unsafe {
|
unsafe {
|
||||||
|
let vmctx = _vmctx as *mut vm::InternalCtx;
|
||||||
(
|
(
|
||||||
(**(*_vmctx).internal.imported_memories).base,
|
(**(*vmctx).imported_memories).base,
|
||||||
(**(*_vmctx).internal.imported_memories).bound,
|
(**(*vmctx).imported_memories).bound,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -5130,13 +5129,13 @@ unsafe extern "C" fn invoke_import(
|
|||||||
import_id: usize,
|
import_id: usize,
|
||||||
stack_top: *mut u8,
|
stack_top: *mut u8,
|
||||||
stack_base: *mut u8,
|
stack_base: *mut u8,
|
||||||
vmctx: *mut vm::Ctx,
|
_vmctx: *mut vm::Ctx,
|
||||||
_memory_base: *mut u8,
|
_memory_base: *mut u8,
|
||||||
) -> u64 {
|
) -> u64 {
|
||||||
let vmctx: &mut vm::Ctx = &mut *vmctx;
|
let vmctx: &mut vm::InternalCtx = &mut *(_vmctx as *mut vm::InternalCtx);
|
||||||
let import = (*vmctx.internal.imported_funcs.offset(import_id as isize)).func;
|
let import = (*vmctx.imported_funcs.offset(import_id as isize)).func;
|
||||||
|
|
||||||
CONSTRUCT_STACK_AND_CALL_NATIVE(stack_top, stack_base, vmctx, import)
|
CONSTRUCT_STACK_AND_CALL_NATIVE(stack_top, stack_base, _vmctx, import)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[repr(u64)]
|
#[repr(u64)]
|
||||||
@ -5160,16 +5159,17 @@ unsafe extern "C" fn call_indirect(
|
|||||||
assert!(stack_top as usize <= stack_base as usize);
|
assert!(stack_top as usize <= stack_base as usize);
|
||||||
|
|
||||||
let table: &LocalTable = match local_or_import {
|
let table: &LocalTable = match local_or_import {
|
||||||
CallIndirectLocalOrImport::Local => &*(*(*vmctx).internal.tables),
|
CallIndirectLocalOrImport::Local => &*(*(*(vmctx as *mut vm::InternalCtx)).tables),
|
||||||
CallIndirectLocalOrImport::Import => &*(*(*vmctx).internal.imported_tables),
|
CallIndirectLocalOrImport::Import => {
|
||||||
|
&*(*(*(vmctx as *mut vm::InternalCtx)).imported_tables)
|
||||||
|
}
|
||||||
};
|
};
|
||||||
if elem_index >= table.count as usize {
|
if elem_index >= table.count as usize {
|
||||||
eprintln!("element index out of bounds");
|
eprintln!("element index out of bounds");
|
||||||
protect_unix::trigger_trap();
|
protect_unix::trigger_trap();
|
||||||
}
|
}
|
||||||
let anyfunc = &*(table.base as *mut vm::Anyfunc).offset(elem_index as isize);
|
let anyfunc = &*(table.base as *mut vm::Anyfunc).offset(elem_index as isize);
|
||||||
let dynamic_sigindex = *(*vmctx)
|
let dynamic_sigindex = *(*(vmctx as *mut vm::InternalCtx))
|
||||||
.internal
|
|
||||||
.dynamic_sigindices
|
.dynamic_sigindices
|
||||||
.offset(sig_index as isize);
|
.offset(sig_index as isize);
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ use std::{ffi::c_void, mem, ptr};
|
|||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct Ctx {
|
pub struct Ctx {
|
||||||
// `internal` must be the first field of `Ctx`.
|
// `internal` must be the first field of `Ctx`.
|
||||||
pub internal: InternalCtx,
|
pub(crate) internal: InternalCtx,
|
||||||
|
|
||||||
pub(crate) local_functions: *const *const Func,
|
pub(crate) local_functions: *const *const Func,
|
||||||
|
|
||||||
@ -29,6 +29,7 @@ pub struct Ctx {
|
|||||||
/// The internal context of the currently running WebAssembly instance.
|
/// The internal context of the currently running WebAssembly instance.
|
||||||
///
|
///
|
||||||
///
|
///
|
||||||
|
#[doc(hidden)]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct InternalCtx {
|
pub struct InternalCtx {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user