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

1use anyhow::Result;
2use core::ops::Range;
3
4use crate::runtime::vm::stack_switching::VMHostArray;
5use crate::runtime::vm::{VMContext, VMFuncRef, ValRaw};
6
7/// Making sure that this has the same size as the non-dummy version, to
8/// make some tests happy.
9#[derive(Debug)]
10#[repr(C)]
11pub struct VMContinuationStack {
12    _top: *mut u8,
13    _len: usize,
14    _match_size_on_unix: u8,
15}
16
17impl VMContinuationStack {
18    pub fn new(_size: usize) -> Result<Self> {
19        anyhow::bail!("Stack switching disabled or not implemented on this platform")
20    }
21
22    pub fn unallocated() -> Self {
23        panic!("Stack switching disabled or not implemented on this platform")
24    }
25
26    pub fn is_unallocated(&self) -> bool {
27        panic!("Stack switching disabled or not implemented on this platform")
28    }
29
30    pub unsafe fn from_raw_parts(_base: *mut u8, _guard_size: usize, _len: usize) -> Result<Self> {
31        anyhow::bail!("Stack switching disabled or not implemented on this platform")
32    }
33
34    pub fn is_from_raw_parts(&self) -> bool {
35        panic!("Stack switching disabled or not implemented on this platform")
36    }
37
38    pub fn top(&self) -> Option<*mut u8> {
39        panic!("Stack switching disabled or not implemented on this platform")
40    }
41
42    pub fn range(&self) -> Option<Range<usize>> {
43        panic!("Stack switching disabled or not implemented on this platform")
44    }
45
46    pub fn control_context_instruction_pointer(&self) -> usize {
47        panic!("Stack switching disabled or not implemented on this platform")
48    }
49
50    pub fn control_context_frame_pointer(&self) -> usize {
51        panic!("Stack switching disabled or not implemented on this platform")
52    }
53
54    pub fn control_context_stack_pointer(&self) -> usize {
55        panic!("Stack switching disabled or not implemented on this platform")
56    }
57
58    pub fn initialize(
59        &self,
60        _func_ref: *const VMFuncRef,
61        _caller_vmctx: *mut VMContext,
62        _args: *mut VMHostArray<ValRaw>,
63        _parameter_count: u32,
64        _return_value_count: u32,
65    ) {
66    }
67}