Skip to content

Commit 22bf039

Browse files
committed
stack-switching: VMArray -> VMHostArray
1 parent 7b72aa3 commit 22bf039

4 files changed

Lines changed: 17 additions & 17 deletions

File tree

crates/wasmtime/src/runtime/vm/stack_switching.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ impl VMStackLimits {
215215
#[derive(Debug, Clone)]
216216
/// Reference to a stack-allocated buffer ("array"), storing data of some type
217217
/// `T`.
218-
pub struct VMArray<T> {
218+
pub struct VMHostArray<T> {
219219
/// Number of currently occupied slots.
220220
pub length: u32,
221221
/// Number of slots in the data buffer. Note that this is *not* the size of
@@ -225,7 +225,7 @@ pub struct VMArray<T> {
225225
pub data: *mut T,
226226
}
227227

228-
impl<T> VMArray<T> {
228+
impl<T> VMHostArray<T> {
229229
/// Creates empty `Array`
230230
pub fn empty() -> Self {
231231
Self {
@@ -252,32 +252,32 @@ fn check_vm_array_offsets() {
252252
let module = Module::new();
253253
let offsets = VMOffsets::new(HostPtr, &module);
254254
assert_eq!(
255-
size_of::<VMArray<()>>(),
255+
size_of::<VMHostArray<()>>(),
256256
usize::from(offsets.ptr.size_of_vmarray())
257257
);
258258
assert_eq!(
259-
offset_of!(VMArray<()>, length),
259+
offset_of!(VMHostArray<()>, length),
260260
usize::from(offsets.ptr.vmarray_length())
261261
);
262262
assert_eq!(
263-
offset_of!(VMArray<()>, capacity),
263+
offset_of!(VMHostArray<()>, capacity),
264264
usize::from(offsets.ptr.vmarray_capacity())
265265
);
266266
assert_eq!(
267-
offset_of!(VMArray<()>, data),
267+
offset_of!(VMHostArray<()>, data),
268268
usize::from(offsets.ptr.vmarray_data())
269269
);
270270
}
271271

272272
/// Type used for passing payloads to and from continuations. The actual type
273273
/// argument should be wasmtime::runtime::vm::vmcontext::ValRaw, but we don't
274274
/// have access to that here.
275-
pub type VMPayloads = VMArray<u128>;
275+
pub type VMPayloads = VMHostArray<u128>;
276276

277277
/// Type for a list of handlers, represented by the handled tag. Thus, the
278278
/// stored data is actually `*mut VMTagDefinition`, but we don't havr access to
279279
/// that here.
280-
pub type VMHandlerList = VMArray<*mut u8>;
280+
pub type VMHandlerList = VMHostArray<*mut u8>;
281281

282282
/// The main type representing a continuation.
283283
#[repr(C)]
@@ -453,7 +453,7 @@ pub fn cont_new(
453453

454454
// The initialization function will allocate the actual args/return value buffer and
455455
// update this object (if needed).
456-
let contref_args_ptr = &mut contref.args as *mut _ as *mut VMArray<crate::ValRaw>;
456+
let contref_args_ptr = &mut contref.args as *mut _ as *mut VMHostArray<crate::ValRaw>;
457457

458458
contref.stack.initialize(
459459
func.cast::<crate::vm::VMFuncRef>(),

crates/wasmtime/src/runtime/vm/stack_switching/stack.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use anyhow::Result;
77
use core::ops::Range;
88

9-
use crate::runtime::vm::stack_switching::VMArray;
9+
use crate::runtime::vm::stack_switching::VMHostArray;
1010
use crate::runtime::vm::{VMContext, VMFuncRef, ValRaw};
1111

1212
cfg_if::cfg_if! {
@@ -104,7 +104,7 @@ impl VMContinuationStack {
104104
&self,
105105
func_ref: *const VMFuncRef,
106106
caller_vmctx: *mut VMContext,
107-
args: *mut VMArray<ValRaw>,
107+
args: *mut VMHostArray<ValRaw>,
108108
parameter_count: u32,
109109
return_value_count: u32,
110110
) {

crates/wasmtime/src/runtime/vm/stack_switching/stack/dummy.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use anyhow::Result;
22
use core::ops::Range;
33

4-
use crate::runtime::vm::stack_switching::VMArray;
4+
use crate::runtime::vm::stack_switching::VMHostArray;
55
use crate::runtime::vm::{VMContext, VMFuncRef, ValRaw};
66

77
#[allow(dead_code)]
@@ -67,7 +67,7 @@ impl VMContinuationStack {
6767
&self,
6868
_func_ref: *const VMFuncRef,
6969
_caller_vmctx: *mut VMContext,
70-
_args: *mut VMArray<ValRaw>,
70+
_args: *mut VMHostArray<ValRaw>,
7171
_parameter_count: u32,
7272
_return_value_count: u32,
7373
) {

crates/wasmtime/src/runtime/vm/stack_switching/stack/unix.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ use std::io;
6565
use std::ops::Range;
6666
use std::ptr;
6767

68-
use crate::runtime::vm::stack_switching::VMArray;
68+
use crate::runtime::vm::stack_switching::VMHostArray;
6969
use crate::runtime::vm::{VMContext, VMFuncRef, VMOpaqueContext, ValRaw};
7070

7171
#[derive(Debug, PartialEq, Eq)]
@@ -230,7 +230,7 @@ impl VMContinuationStack {
230230
&self,
231231
func_ref: *const VMFuncRef,
232232
caller_vmctx: *mut VMContext,
233-
args: *mut VMArray<ValRaw>,
233+
args: *mut VMHostArray<ValRaw>,
234234
parameter_count: u32,
235235
return_value_count: u32,
236236
) {
@@ -270,7 +270,7 @@ impl VMContinuationStack {
270270
// Data after the args buffer:
271271
(0x28 + s, func_ref as usize),
272272
(0x30 + s, caller_vmctx as usize),
273-
(0x38 + s, args as *mut VMArray<ValRaw> as usize),
273+
(0x38 + s, args as *mut VMHostArray<ValRaw> as usize),
274274
(0x40 + s, return_value_count as usize),
275275
];
276276

@@ -306,7 +306,7 @@ unsafe extern "C" {
306306
unsafe extern "C" fn fiber_start(
307307
func_ref: *const VMFuncRef,
308308
caller_vmctx: *mut VMContext,
309-
args: *mut VMArray<ValRaw>,
309+
args: *mut VMHostArray<ValRaw>,
310310
return_value_count: u32,
311311
) {
312312
unsafe {

0 commit comments

Comments
 (0)