Save exit Wasm FP and PC in component-to-host trampolines (#4601)

* Wasmtime: Add a pointer to `VMRuntimeLimits` in component contexts

* Save exit Wasm FP and PC in component-to-host trampolines

Fixes #4535

* Add comment about why we deref the trampoline's FP

* Update some tests to use new `vmruntime_limits_*` methods
This commit is contained in:
Nick Fitzgerald
2022-08-04 08:27:30 -07:00
committed by GitHub
parent f69acd6187
commit 70ce288dc7
16 changed files with 206 additions and 149 deletions

View File

@@ -791,7 +791,7 @@ mod test_vmruntime_limits {
use super::VMRuntimeLimits;
use memoffset::offset_of;
use std::mem::size_of;
use wasmtime_environ::{Module, VMOffsets};
use wasmtime_environ::{Module, PtrSize, VMOffsets};
#[test]
fn field_offsets() {
@@ -799,27 +799,27 @@ mod test_vmruntime_limits {
let offsets = VMOffsets::new(size_of::<*mut u8>() as u8, &module);
assert_eq!(
offset_of!(VMRuntimeLimits, stack_limit),
usize::from(offsets.vmruntime_limits_stack_limit())
usize::from(offsets.ptr.vmruntime_limits_stack_limit())
);
assert_eq!(
offset_of!(VMRuntimeLimits, fuel_consumed),
usize::from(offsets.vmruntime_limits_fuel_consumed())
usize::from(offsets.ptr.vmruntime_limits_fuel_consumed())
);
assert_eq!(
offset_of!(VMRuntimeLimits, epoch_deadline),
usize::from(offsets.vmruntime_limits_epoch_deadline())
usize::from(offsets.ptr.vmruntime_limits_epoch_deadline())
);
assert_eq!(
offset_of!(VMRuntimeLimits, last_wasm_exit_fp),
usize::from(offsets.vmruntime_limits_last_wasm_exit_fp())
usize::from(offsets.ptr.vmruntime_limits_last_wasm_exit_fp())
);
assert_eq!(
offset_of!(VMRuntimeLimits, last_wasm_exit_pc),
usize::from(offsets.vmruntime_limits_last_wasm_exit_pc())
usize::from(offsets.ptr.vmruntime_limits_last_wasm_exit_pc())
);
assert_eq!(
offset_of!(VMRuntimeLimits, last_wasm_entry_sp),
usize::from(offsets.vmruntime_limits_last_wasm_entry_sp())
usize::from(offsets.ptr.vmruntime_limits_last_wasm_entry_sp())
);
}
}