Implement call_indirect signature checking.

The call_indirect.wast spec test now passes.
This commit is contained in:
Dan Gohman
2018-12-05 08:46:17 -05:00
parent 57635eb62b
commit 96941a59af
11 changed files with 263 additions and 69 deletions

View File

@@ -55,6 +55,32 @@ impl VMOffsets {
}
}
/// Offsets for `wasmtime_execute::VMSignatureId`.
impl VMOffsets {
/// Return the size of `VMSignatureId`.
pub fn size_of_vmsignature_id(&self) -> u8 {
4
}
}
/// Offsets for `wasmtime_execute::VMCallerCheckedAnyfunc`.
impl VMOffsets {
/// The offset of the `func_ptr` field.
pub fn vmcaller_checked_anyfunc_func_ptr(&self) -> u8 {
0 * self.pointer_size
}
/// The offset of the `type_id` field.
pub fn vmcaller_checked_anyfunc_type_id(&self) -> u8 {
1 * self.pointer_size
}
/// Return the size of `VMTable`.
pub fn size_of_vmcaller_checked_anyfunc(&self) -> u8 {
2 * self.pointer_size
}
}
/// Offsets for `wasmtime_execute::VMContext`.
impl VMOffsets {
/// The offset of the `memories` field.
@@ -72,10 +98,15 @@ impl VMOffsets {
2 * self.pointer_size
}
/// The offset of the `signature_ids` field.
pub fn vmctx_signature_ids(&self) -> u8 {
3 * self.pointer_size
}
/// Return the size of `VMContext`.
#[allow(dead_code)]
pub fn size_of_vmctx(&self) -> u8 {
3 * self.pointer_size
4 * self.pointer_size
}
/// Return the offset from the `memories` pointer to `VMMemory` index `index`.