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
3124 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
) -> WasmResult<()> {
76
disabled()
77
}
78
79
pub fn translate_exn_throw_ref(
80
_func_env: &mut FuncEnvironment<'_>,
81
_builder: &mut FunctionBuilder<'_>,
82
_exnref: ir::Value,
83
) -> WasmResult<()> {
84
disabled()
85
}
86
87
pub fn translate_array_new(
88
_func_env: &mut FuncEnvironment<'_>,
89
_builder: &mut FunctionBuilder,
90
_array_type_index: TypeIndex,
91
_elem: ir::Value,
92
_len: ir::Value,
93
) -> WasmResult<ir::Value> {
94
disabled()
95
}
96
97
pub fn translate_array_new_default(
98
_func_env: &mut FuncEnvironment<'_>,
99
_builder: &mut FunctionBuilder,
100
_array_type_index: TypeIndex,
101
_len: ir::Value,
102
) -> WasmResult<ir::Value> {
103
disabled()
104
}
105
106
pub fn translate_array_new_fixed(
107
_func_env: &mut FuncEnvironment<'_>,
108
_builder: &mut FunctionBuilder,
109
_array_type_index: TypeIndex,
110
_elems: &[ir::Value],
111
) -> WasmResult<ir::Value> {
112
disabled()
113
}
114
115
pub fn translate_array_fill(
116
_func_env: &mut FuncEnvironment<'_>,
117
_builder: &mut FunctionBuilder<'_>,
118
_array_type_index: TypeIndex,
119
_array_ref: ir::Value,
120
_index: ir::Value,
121
_value: ir::Value,
122
_n: ir::Value,
123
) -> WasmResult<()> {
124
disabled()
125
}
126
127
pub fn translate_array_len(
128
_func_env: &mut FuncEnvironment<'_>,
129
_builder: &mut FunctionBuilder,
130
_array: ir::Value,
131
) -> WasmResult<ir::Value> {
132
disabled()
133
}
134
135
pub fn translate_array_get(
136
_func_env: &mut FuncEnvironment<'_>,
137
_builder: &mut FunctionBuilder,
138
_array_type_index: TypeIndex,
139
_array: ir::Value,
140
_index: ir::Value,
141
_extension: Option<Extension>,
142
) -> WasmResult<ir::Value> {
143
disabled()
144
}
145
146
pub fn translate_array_set(
147
_func_env: &mut FuncEnvironment<'_>,
148
_builder: &mut FunctionBuilder,
149
_array_type_index: TypeIndex,
150
_array: ir::Value,
151
_index: ir::Value,
152
_value: ir::Value,
153
) -> WasmResult<()> {
154
disabled()
155
}
156
157
pub fn translate_ref_test(
158
_func_env: &mut FuncEnvironment<'_>,
159
_builder: &mut FunctionBuilder<'_>,
160
_test_ty: WasmRefType,
161
_val: ir::Value,
162
_val_ty: WasmRefType,
163
) -> WasmResult<ir::Value> {
164
disabled()
165
}
166
167