1 //! Stubs for when pulley is disabled at compile time.
2 //!
3 //! Note that this is structured so that these structures are all zero-sized and
4 //! `Option<Thing>` is also zero-sized so there should be no runtime cost for
5 //! having these structures plumbed around.
6 
7 use crate::runtime::vm::{VMContext, VMOpaqueContext};
8 use crate::{Engine, ValRaw, error::OutOfMemory};
9 use core::convert::Infallible;
10 use core::marker;
11 use core::mem;
12 use core::ptr::NonNull;
13 use wasmtime_unwinder::Unwind;
14 
15 pub struct Interpreter {
16     empty: Infallible,
17 }
18 
19 const _: () = assert!(mem::size_of::<Interpreter>() == 0);
20 const _: () = assert!(mem::size_of::<Option<Interpreter>>() == 0);
21 
22 impl Interpreter {
new(_engine: &Engine) -> Result<Interpreter, OutOfMemory>23     pub fn new(_engine: &Engine) -> Result<Interpreter, OutOfMemory> {
24         unreachable!()
25     }
26 
as_interpreter_ref(&mut self) -> InterpreterRef<'_>27     pub fn as_interpreter_ref(&mut self) -> InterpreterRef<'_> {
28         match self.empty {}
29     }
30 
unwinder(&self) -> &'static dyn Unwind31     pub fn unwinder(&self) -> &'static dyn Unwind {
32         match self.empty {}
33     }
34 }
35 
36 pub struct InterpreterRef<'a> {
37     empty: Infallible,
38     _marker: marker::PhantomData<&'a mut Interpreter>,
39 }
40 
41 const _: () = assert!(mem::size_of::<InterpreterRef<'_>>() == 0);
42 const _: () = assert!(mem::size_of::<Option<InterpreterRef<'_>>>() == 0);
43 
44 impl InterpreterRef<'_> {
call( self, _bytecode: NonNull<u8>, _callee: NonNull<VMOpaqueContext>, _caller: NonNull<VMContext>, _args_and_results: NonNull<[ValRaw]>, ) -> bool45     pub unsafe fn call(
46         self,
47         _bytecode: NonNull<u8>,
48         _callee: NonNull<VMOpaqueContext>,
49         _caller: NonNull<VMContext>,
50         _args_and_results: NonNull<[ValRaw]>,
51     ) -> bool {
52         match self.empty {}
53     }
54 
resume_to_exception_handler( &mut self, _handler: &wasmtime_unwinder::Handler, _payload1: usize, _payload2: usize, )55     pub(crate) unsafe fn resume_to_exception_handler(
56         &mut self,
57         _handler: &wasmtime_unwinder::Handler,
58         _payload1: usize,
59         _payload2: usize,
60     ) {
61         match self.empty {}
62     }
63 }
64