Add dynamic sigindices to the vm context.

This commit is contained in:
Lachlan Sneff
2019-03-03 21:26:34 -08:00
parent 51cf9dde05
commit 801979c40d
2 changed files with 33 additions and 2 deletions

View File

@ -34,6 +34,12 @@ pub struct Ctx {
/// A pointer to an array of imported functions, indexed by `FuncIndex`.
pub(crate) imported_funcs: *mut ImportedFunc,
/// A pointer to an array of signature ids. Conceptually, this maps
/// from a static, module-local signature id to a runtime-global
/// signature id. This is used to allow call-indirect to other
/// modules safely.
pub(crate) dynamic_sigindices: *const SigId,
local_backing: *mut LocalBacking,
import_backing: *mut ImportBacking,
module: *const ModuleInner,
@ -59,6 +65,8 @@ impl Ctx {
imported_globals: import_backing.vm_globals.as_mut_ptr(),
imported_funcs: import_backing.vm_functions.as_mut_ptr(),
dynamic_sigindices: local_backing.dynamic_sigindices.as_ptr(),
local_backing,
import_backing,
module,
@ -86,6 +94,8 @@ impl Ctx {
imported_globals: import_backing.vm_globals.as_mut_ptr(),
imported_funcs: import_backing.vm_functions.as_mut_ptr(),
dynamic_sigindices: local_backing.dynamic_sigindices.as_ptr(),
local_backing,
import_backing,
module,
@ -468,6 +478,8 @@ mod vm_ctx_tests {
vm_memories: Map::new().into_boxed_map(),
vm_tables: Map::new().into_boxed_map(),
vm_globals: Map::new().into_boxed_map(),
dynamic_sigindices: Map::new().into_boxed_map(),
};
let module = generate_module();
let data = &mut data as *mut _ as *mut c_void;