1 #[macro_use]
2 pub(crate) mod func;
3 
4 pub(crate) mod code;
5 pub(crate) mod code_memory;
6 pub(crate) mod debug;
7 pub(crate) mod externals;
8 pub(crate) mod gc;
9 pub(crate) mod instance;
10 pub(crate) mod instantiate;
11 pub(crate) mod limits;
12 pub(crate) mod linker;
13 pub(crate) mod memory;
14 pub(crate) mod module;
15 pub(crate) mod resources;
16 pub(crate) mod store;
17 pub(crate) mod trampoline;
18 pub(crate) mod trap;
19 pub(crate) mod type_registry;
20 pub(crate) mod types;
21 pub(crate) mod uninhabited;
22 pub(crate) mod v128;
23 pub(crate) mod values;
24 pub(crate) mod vm;
25 
26 #[cfg(feature = "component-model")]
27 pub mod component;
28 
29 cfg_if::cfg_if! {
30     if #[cfg(miri)] {
31         // no extensions on miri
32     } else if #[cfg(unix)] {
33         pub mod unix;
34     } else if #[cfg(windows)] {
35         pub mod windows;
36     } else {
37         // ... unknown os!
38     }
39 }
40 
41 pub use code_memory::CodeMemory;
42 pub use externals::*;
43 pub use func::*;
44 pub use gc::*;
45 pub use instance::{Instance, InstancePre};
46 pub use instantiate::CompiledModule;
47 pub use limits::*;
48 pub use linker::*;
49 pub use memory::*;
50 pub use module::{Module, ModuleExport};
51 pub use resources::*;
52 #[cfg(all(feature = "async", feature = "call-hook"))]
53 pub use store::CallHookHandler;
54 pub use store::{
55     AsContext, AsContextMut, CallHook, Store, StoreContext, StoreContextMut, UpdateDeadline,
56 };
57 pub use trap::*;
58 pub use types::*;
59 pub use v128::V128;
60 pub use values::*;
61 
62 pub(crate) use uninhabited::*;
63 
64 #[cfg(feature = "pooling-allocator")]
65 pub use vm::PoolConcurrencyLimitError;
66 
67 #[cfg(feature = "profiling")]
68 mod profiling;
69 #[cfg(feature = "profiling")]
70 pub use profiling::GuestProfiler;
71 
72 #[cfg(feature = "async")]
73 pub(crate) mod stack;
74 #[cfg(feature = "async")]
75 pub use stack::*;
76 
77 #[cfg(feature = "coredump")]
78 mod coredump;
79 #[cfg(feature = "coredump")]
80 pub use coredump::*;
81 
82 fn _assertions_runtime() {
83     use crate::_assert_send_and_sync;
84 
85     #[cfg(feature = "async")]
86     fn _assert_send<T: Send>(_t: T) {}
87 
88     _assert_send_and_sync::<Caller<'_, ()>>();
89     _assert_send_and_sync::<ExternRef>();
90     _assert_send_and_sync::<(Func, TypedFunc<(), ()>, Global, Table, Memory)>();
91     _assert_send_and_sync::<Instance>();
92     _assert_send_and_sync::<InstancePre<()>>();
93     _assert_send_and_sync::<InstancePre<*mut u8>>();
94     _assert_send_and_sync::<Linker<()>>();
95     _assert_send_and_sync::<Linker<*mut u8>>();
96     _assert_send_and_sync::<Module>();
97     _assert_send_and_sync::<Store<()>>();
98     _assert_send_and_sync::<StoreContext<'_, ()>>();
99     _assert_send_and_sync::<StoreContextMut<'_, ()>>();
100 
101     #[cfg(feature = "async")]
102     fn _call_async(s: &mut Store<()>, f: Func) {
103         _assert_send(f.call_async(&mut *s, &[], &mut []))
104     }
105     #[cfg(feature = "async")]
106     fn _typed_call_async(s: &mut Store<()>, f: TypedFunc<(), ()>) {
107         _assert_send(f.call_async(&mut *s, ()))
108     }
109     #[cfg(feature = "async")]
110     fn _instantiate_async(s: &mut Store<()>, m: &Module) {
111         _assert_send(Instance::new_async(s, m, &[]))
112     }
113 }
114