Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bytecodealliance
GitHub Repository: bytecodealliance/wasmtime
Path: blob/main/crates/cranelift/src/func_environ/gc/disabled.rs
1693 views
1
//! `GcCompiler` implementation when GC support is disabled.
2
3
use super::GcCompiler;
4
use crate::func_environ::{Extension, FuncEnvironment};
5
use cranelift_codegen::ir;
6
use cranelift_frontend::FunctionBuilder;
7
use smallvec::SmallVec;
8
use wasmtime_environ::{TagIndex, TypeIndex, WasmRefType, WasmResult, wasm_unsupported};
9
10
fn disabled<T>() -> WasmResult<T> {
11
Err(wasm_unsupported!(
12
"support for Wasm GC disabled at compile time because the `gc` cargo \
13
feature was not enabled"
14
))
15
}
16
17
/// Get the default GC compiler.
18
pub fn gc_compiler(_: &FuncEnvironment<'_>) -> WasmResult<Box<dyn GcCompiler>> {
19
disabled()
20
}
21
22
pub fn translate_struct_new(
23
_func_env: &mut FuncEnvironment<'_>,
24
_builder: &mut FunctionBuilder<'_>,
25
_struct_type_index: TypeIndex,
26
_fields: &[ir::Value],
27
) -> WasmResult<ir::Value> {
28
disabled()
29
}
30
31
pub fn translate_struct_new_default(
32
_func_env: &mut FuncEnvironment<'_>,
33
_builder: &mut FunctionBuilder<'_>,
34
_struct_type_index: TypeIndex,
35
) -> WasmResult<ir::Value> {
36
disabled()
37
}
38
39
pub fn translate_struct_get(
40
_func_env: &mut FuncEnvironment<'_>,
41
_builder: &mut FunctionBuilder<'_>,
42
_struct_type_index: TypeIndex,
43
_field_index: u32,
44
_struct_ref: ir::Value,
45
_extension: Option<Extension>,
46
) -> WasmResult<ir::Value> {
47
disabled()
48
}
49
50
pub fn translate_struct_set(
51
_func_env: &mut FuncEnvironment<'_>,
52
_builder: &mut FunctionBuilder<'_>,
53
_struct_type_index: TypeIndex,
54
_field_index: u32,
55
_struct_ref: ir::Value,
56
_new_val: ir::Value,
57
) -> WasmResult<()> {
58
disabled()
59
}
60
61
pub fn translate_exn_unbox(
62
_func_env: &mut FuncEnvironment<'_>,
63
_builder: &mut FunctionBuilder<'_>,
64
_tag_index: TagIndex,
65
_exn_ref: ir::Value,
66
) -> WasmResult<SmallVec<[ir::Value; 4]>> {
67
disabled()
68
}
69
70
pub fn translate_exn_throw(
71
_func_env: &mut FuncEnvironment<'_>,
72
_builder: &mut FunctionBuilder<'_>,
73
_tag_index: TagIndex,
74
_args: &[ir::Value],
75
_handlers: impl IntoIterator<Item = (Option<ir::ExceptionTag>, ir::Block)>,
76
) -> WasmResult<()> {
77
disabled()
78
}
79
80
pub fn translate_exn_throw_ref(
81
_func_env: &mut FuncEnvironment<'_>,
82
_builder: &mut FunctionBuilder<'_>,
83
_exnref: ir::Value,
84
_handlers: impl IntoIterator<Item = (Option<ir::ExceptionTag>, ir::Block)>,
85
) -> WasmResult<()> {
86
disabled()
87
}
88
89
pub fn translate_array_new(
90
_func_env: &mut FuncEnvironment<'_>,
91
_builder: &mut FunctionBuilder,
92
_array_type_index: TypeIndex,
93
_elem: ir::Value,
94
_len: ir::Value,
95
) -> WasmResult<ir::Value> {
96
disabled()
97
}
98
99
pub fn translate_array_new_default(
100
_func_env: &mut FuncEnvironment<'_>,
101
_builder: &mut FunctionBuilder,
102
_array_type_index: TypeIndex,
103
_len: ir::Value,
104
) -> WasmResult<ir::Value> {
105
disabled()
106
}
107
108
pub fn translate_array_new_fixed(
109
_func_env: &mut FuncEnvironment<'_>,
110
_builder: &mut FunctionBuilder,
111
_array_type_index: TypeIndex,
112
_elems: &[ir::Value],
113
) -> WasmResult<ir::Value> {
114
disabled()
115
}
116
117
pub fn translate_array_fill(
118
_func_env: &mut FuncEnvironment<'_>,
119
_builder: &mut FunctionBuilder<'_>,
120
_array_type_index: TypeIndex,
121
_array_ref: ir::Value,
122
_index: ir::Value,
123
_value: ir::Value,
124
_n: ir::Value,
125
) -> WasmResult<()> {
126
disabled()
127
}
128
129
pub fn translate_array_len(
130
_func_env: &mut FuncEnvironment<'_>,
131
_builder: &mut FunctionBuilder,
132
_array: ir::Value,
133
) -> WasmResult<ir::Value> {
134
disabled()
135
}
136
137
pub fn translate_array_get(
138
_func_env: &mut FuncEnvironment<'_>,
139
_builder: &mut FunctionBuilder,
140
_array_type_index: TypeIndex,
141
_array: ir::Value,
142
_index: ir::Value,
143
_extension: Option<Extension>,
144
) -> WasmResult<ir::Value> {
145
disabled()
146
}
147
148
pub fn translate_array_set(
149
_func_env: &mut FuncEnvironment<'_>,
150
_builder: &mut FunctionBuilder,
151
_array_type_index: TypeIndex,
152
_array: ir::Value,
153
_index: ir::Value,
154
_value: ir::Value,
155
) -> WasmResult<()> {
156
disabled()
157
}
158
159
pub fn translate_ref_test(
160
_func_env: &mut FuncEnvironment<'_>,
161
_builder: &mut FunctionBuilder<'_>,
162
_test_ty: WasmRefType,
163
_val: ir::Value,
164
_val_ty: WasmRefType,
165
) -> WasmResult<ir::Value> {
166
disabled()
167
}
168
169