Code review feedback.
* Make `FunctionInfo` public and `CompiledModule::func_info` return it. * Make the `StackMapLookup` trait unsafe. * Add comments for the purpose of `EngineHostFuncs`. * Rework ownership model of shared signatures: `SignatureCollection` in conjunction with `SignatureRegistry` is now used so that the `Engine`, `Store`, and `Module` don't need to worry about unregistering shared signatures. * Implement `Func::param_arity` and `Func::result_arity` in terms of `Func::ty`. * Make looking up a trampoline with the module registry more efficient by doing a binary search on the function's starting PC value for the owning module and then looking up the trampoline with only that module. * Remove reference to the shared signatures from `GlobalRegisteredModule`.
This commit is contained in:
@@ -742,14 +742,22 @@ impl VMExternRefActivationsTable {
|
||||
}
|
||||
|
||||
/// Used by the runtime to lookup a stack map from a PC value.
|
||||
pub trait StackMapLookup {
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// This trait is unsafe as it returns pointers to a stack map without
|
||||
/// any clear ownership.
|
||||
///
|
||||
/// It is the responsibility of the caller to not have the pointer outlive
|
||||
/// the stack map lookup trait object.
|
||||
pub unsafe trait StackMapLookup {
|
||||
/// Lookup the stack map at a program counter (PC) value.
|
||||
fn lookup(&self, pc: usize) -> Option<*const StackMap>;
|
||||
}
|
||||
|
||||
pub(crate) struct EmptyStackMapLookup;
|
||||
|
||||
impl StackMapLookup for EmptyStackMapLookup {
|
||||
unsafe impl StackMapLookup for EmptyStackMapLookup {
|
||||
fn lookup(&self, _pc: usize) -> Option<*const StackMap> {
|
||||
None
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user