Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions crates/environ/src/vmoffsets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,25 +276,25 @@ pub trait PtrSize {
self.size()
}

// Offsets within `VMArray`
// Offsets within `VMHostArray`

/// Return the offset of `VMArray::length`.
fn vmarray_length(&self) -> u8 {
/// Return the offset of `VMHostArray::length`.
fn vmhostarray_length(&self) -> u8 {
0
}

/// Return the offset of `VMArray::capacity`.
fn vmarray_capacity(&self) -> u8 {
/// Return the offset of `VMHostArray::capacity`.
fn vmhostarray_capacity(&self) -> u8 {
4
}

/// Return the offset of `VMArray::data`.
fn vmarray_data(&self) -> u8 {
/// Return the offset of `VMHostArray::data`.
fn vmhostarray_data(&self) -> u8 {
8
}

/// Return the size of `VMArray`.
fn size_of_vmarray(&self) -> u8 {
/// Return the size of `VMHostArray`.
fn size_of_vmhostarray(&self) -> u8 {
8 + self.size()
}

Expand All @@ -321,7 +321,7 @@ pub trait PtrSize {

/// Return the offset of `VMCommonStackInformation::first_switch_handler_index`.
fn vmcommon_stack_information_first_switch_handler_index(&self) -> u8 {
self.vmcommon_stack_information_handlers() + self.size_of_vmarray()
self.vmcommon_stack_information_handlers() + self.size_of_vmhostarray()
}

/// Return the size of `VMCommonStackInformation`.
Expand Down Expand Up @@ -372,7 +372,7 @@ pub trait PtrSize {

/// Return the offset of `VMContRef::values`.
fn vmcontref_values(&self) -> u8 {
self.vmcontref_args() + self.size_of_vmarray()
self.vmcontref_args() + self.size_of_vmhostarray()
}

/// Return the offset to the `magic` value in this `VMContext`.
Expand Down
8 changes: 4 additions & 4 deletions crates/wasmtime/src/runtime/vm/stack_switching.rs
Original file line number Diff line number Diff line change
Expand Up @@ -633,19 +633,19 @@ mod tests {
let offsets = VMOffsets::new(HostPtr, &module);
assert_eq!(
size_of::<VMHostArray<()>>(),
usize::from(offsets.ptr.size_of_vmarray())
usize::from(offsets.ptr.size_of_vmhostarray())
);
assert_eq!(
offset_of!(VMHostArray<()>, length),
usize::from(offsets.ptr.vmarray_length())
usize::from(offsets.ptr.vmhostarray_length())
);
assert_eq!(
offset_of!(VMHostArray<()>, capacity),
usize::from(offsets.ptr.vmarray_capacity())
usize::from(offsets.ptr.vmhostarray_capacity())
);
assert_eq!(
offset_of!(VMHostArray<()>, data),
usize::from(offsets.ptr.vmarray_data())
usize::from(offsets.ptr.vmhostarray_data())
);
}

Expand Down