mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-22 13:11:32 +00:00
feat(runtime) Get ready for tiering (#257)
* Add local_function field to context * Add local call indirection to llvm * local call indirection * Fix vm test * Fix cranelift local call indirection * Fix unwinding on nightly
This commit is contained in:
@ -40,6 +40,8 @@ pub struct Ctx {
|
||||
/// modules safely.
|
||||
pub(crate) dynamic_sigindices: *const SigId,
|
||||
|
||||
pub(crate) local_functions: *const *const Func,
|
||||
|
||||
local_backing: *mut LocalBacking,
|
||||
import_backing: *mut ImportBacking,
|
||||
module: *const ModuleInner,
|
||||
@ -66,6 +68,7 @@ impl Ctx {
|
||||
imported_funcs: import_backing.vm_functions.as_mut_ptr(),
|
||||
|
||||
dynamic_sigindices: local_backing.dynamic_sigindices.as_ptr(),
|
||||
local_functions: local_backing.local_functions.as_ptr(),
|
||||
|
||||
local_backing,
|
||||
import_backing,
|
||||
@ -95,6 +98,7 @@ impl Ctx {
|
||||
imported_funcs: import_backing.vm_functions.as_mut_ptr(),
|
||||
|
||||
dynamic_sigindices: local_backing.dynamic_sigindices.as_ptr(),
|
||||
local_functions: local_backing.local_functions.as_ptr(),
|
||||
|
||||
local_backing,
|
||||
import_backing,
|
||||
@ -173,6 +177,10 @@ impl Ctx {
|
||||
pub fn offset_signatures() -> u8 {
|
||||
7 * (mem::size_of::<usize>() as u8)
|
||||
}
|
||||
|
||||
pub fn offset_local_functions() -> u8 {
|
||||
8 * (mem::size_of::<usize>() as u8)
|
||||
}
|
||||
}
|
||||
|
||||
enum InnerFunc {}
|
||||
@ -363,6 +371,11 @@ mod vm_offset_tests {
|
||||
Ctx::offset_imported_funcs() as usize,
|
||||
offset_of!(Ctx => imported_funcs).get_byte_offset(),
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
Ctx::offset_local_functions() as usize,
|
||||
offset_of!(Ctx => local_functions).get_byte_offset(),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@ -470,6 +483,7 @@ mod vm_ctx_tests {
|
||||
vm_globals: Map::new().into_boxed_map(),
|
||||
|
||||
dynamic_sigindices: Map::new().into_boxed_map(),
|
||||
local_functions: Map::new().into_boxed_map(),
|
||||
};
|
||||
let mut import_backing = ImportBacking {
|
||||
memories: Map::new().into_boxed_map(),
|
||||
|
Reference in New Issue
Block a user