Optimize codegen in Func::wrap (#1491)

This commit optimizes the codegen of `Func::wrap` such that if you do
something like `Func::wrap(&store, || {})` then the shim generated
contains zero code (as expected). In general this means that the extra
tidbits generated by wasmtime are all eligible to be entirely optimized
away so long as you don't actually rely on something.
This commit is contained in:
Alex Crichton
2020-04-10 12:52:06 -05:00
committed by GitHub
parent 41330e0d86
commit 7eea5d8d43
3 changed files with 10 additions and 2 deletions

View File

@@ -376,6 +376,7 @@ impl Instance {
}
/// Return a reference to the custom state attached to this instance.
#[inline]
pub fn host_state(&self) -> &dyn Any {
&*self.host_state
}
@@ -416,6 +417,7 @@ impl Instance {
}
/// Return the offset from the vmctx pointer to its containing Instance.
#[inline]
pub(crate) fn vmctx_offset() -> isize {
offset_of!(Self, vmctx) as isize
}