Coverage Report

Created: 2024-10-16 07:58

/src/wasmer/lib/compiler-cranelift/src/translator/func_environ.rs
Line
Count
Source (jump to first uncovered line)
1
// This file contains code from external sources.
2
// Attributions: https://github.com/wasmerio/wasmer/blob/main/docs/ATTRIBUTIONS.md
3
4
//! All the runtime support necessary for the wasm to cranelift translation is formalized by the
5
//! traits `FunctionEnvMutironment`.
6
7
use super::func_state::FuncTranslationState;
8
use super::translation_utils::reference_type;
9
use core::convert::From;
10
use cranelift_codegen::cursor::FuncCursor;
11
use cranelift_codegen::ir::immediates::Offset32;
12
use cranelift_codegen::ir::{self, InstBuilder};
13
use cranelift_codegen::isa::TargetFrontendConfig;
14
use cranelift_frontend::FunctionBuilder;
15
use wasmer_compiler::wasmparser::{HeapType, Operator};
16
use wasmer_types::{
17
    FunctionIndex, FunctionType, GlobalIndex, LocalFunctionIndex, MemoryIndex, SignatureIndex,
18
    TableIndex, Type as WasmerType, WasmResult,
19
};
20
21
/// The value of a WebAssembly global variable.
22
#[derive(Clone, Copy)]
23
pub enum GlobalVariable {
24
    #[allow(dead_code)]
25
    /// This is a constant global with a value known at compile time.
26
    Const(ir::Value),
27
28
    /// This is a variable in memory that should be referenced through a `GlobalValue`.
29
    Memory {
30
        /// The address of the global variable storage.
31
        gv: ir::GlobalValue,
32
        /// An offset to add to the address.
33
        offset: Offset32,
34
        /// The global variable's type.
35
        ty: ir::Type,
36
    },
37
38
    #[allow(dead_code)]
39
    /// This is a global variable that needs to be handled by the environment.
40
    Custom,
41
}
42
43
#[allow(dead_code)]
44
/// How to return from functions.
45
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
46
pub enum ReturnMode {
47
    /// Use normal return instructions as needed.
48
    NormalReturns,
49
}
50
51
/// Environment affecting the translation of a WebAssembly.
52
pub trait TargetEnvironment {
53
    /// Get the information needed to produce Cranelift IR for the given target.
54
    fn target_config(&self) -> TargetFrontendConfig;
55
56
    /// Get the Cranelift integer type to use for native pointers.
57
    ///
58
    /// This returns `I64` for 64-bit architectures and `I32` for 32-bit architectures.
59
69.9k
    fn pointer_type(&self) -> ir::Type {
60
69.9k
        ir::Type::int(u16::from(self.target_config().pointer_bits())).unwrap()
61
69.9k
    }
<wasmer_compiler_cranelift::func_environ::FuncEnvironment as wasmer_compiler_cranelift::translator::func_environ::TargetEnvironment>::pointer_type
Line
Count
Source
59
69.9k
    fn pointer_type(&self) -> ir::Type {
60
69.9k
        ir::Type::int(u16::from(self.target_config().pointer_bits())).unwrap()
61
69.9k
    }
Unexecuted instantiation: <wasmer_compiler_cranelift::func_environ::FuncEnvironment as wasmer_compiler_cranelift::translator::func_environ::TargetEnvironment>::pointer_type
62
63
    /// Get the size of a native pointer, in bytes.
64
    #[allow(dead_code)]
65
0
    fn pointer_bytes(&self) -> u8 {
66
0
        self.target_config().pointer_bytes()
67
0
    }
Unexecuted instantiation: <wasmer_compiler_cranelift::func_environ::FuncEnvironment as wasmer_compiler_cranelift::translator::func_environ::TargetEnvironment>::pointer_bytes
Unexecuted instantiation: <wasmer_compiler_cranelift::func_environ::FuncEnvironment as wasmer_compiler_cranelift::translator::func_environ::TargetEnvironment>::pointer_bytes
68
69
    /// Get the Cranelift reference type to use for native references.
70
    ///
71
    /// This returns `R64` for 64-bit architectures and `R32` for 32-bit architectures.
72
0
    fn reference_type(&self) -> ir::Type {
73
0
        reference_type(self.target_config()).expect("expected reference type")
74
0
    }
Unexecuted instantiation: <wasmer_compiler_cranelift::func_environ::FuncEnvironment as wasmer_compiler_cranelift::translator::func_environ::TargetEnvironment>::reference_type
Unexecuted instantiation: <wasmer_compiler_cranelift::func_environ::FuncEnvironment as wasmer_compiler_cranelift::translator::func_environ::TargetEnvironment>::reference_type
75
}
76
77
/// Environment affecting the translation of a single WebAssembly function.
78
///
79
/// A `FuncEnvironment` trait object is required to translate a WebAssembly function to Cranelift
80
/// IR. The function environment provides information about the WebAssembly module as well as the
81
/// runtime environment.
82
pub trait FuncEnvironment: TargetEnvironment {
83
    /// Is the given parameter of the given function a wasm-level parameter, as opposed to a hidden
84
    /// parameter added for use by the implementation?
85
0
    fn is_wasm_parameter(&self, signature: &ir::Signature, index: usize) -> bool {
86
0
        signature.params[index].purpose == ir::ArgumentPurpose::Normal
87
0
    }
Unexecuted instantiation: <_ as wasmer_compiler_cranelift::translator::func_environ::FuncEnvironment>::is_wasm_parameter
Unexecuted instantiation: <_ as wasmer_compiler_cranelift::translator::func_environ::FuncEnvironment>::is_wasm_parameter
88
89
    /// Is the given return of the given function a wasm-level parameter, as
90
    /// opposed to a hidden parameter added for use by the implementation?
91
1.35k
    fn is_wasm_return(&self, signature: &ir::Signature, index: usize) -> bool {
92
1.35k
        signature.returns[index].purpose == ir::ArgumentPurpose::Normal
93
1.35k
    }
<wasmer_compiler_cranelift::func_environ::FuncEnvironment as wasmer_compiler_cranelift::translator::func_environ::FuncEnvironment>::is_wasm_return
Line
Count
Source
91
1.35k
    fn is_wasm_return(&self, signature: &ir::Signature, index: usize) -> bool {
92
1.35k
        signature.returns[index].purpose == ir::ArgumentPurpose::Normal
93
1.35k
    }
Unexecuted instantiation: <wasmer_compiler_cranelift::func_environ::FuncEnvironment as wasmer_compiler_cranelift::translator::func_environ::FuncEnvironment>::is_wasm_return
94
95
    /// Should the code be structured to use a single `fallthrough_return` instruction at the end
96
    /// of the function body, rather than `return` instructions as needed? This is used by VMs
97
    /// to append custom epilogues.
98
47.6k
    fn return_mode(&self) -> ReturnMode {
99
47.6k
        ReturnMode::NormalReturns
100
47.6k
    }
<wasmer_compiler_cranelift::func_environ::FuncEnvironment as wasmer_compiler_cranelift::translator::func_environ::FuncEnvironment>::return_mode
Line
Count
Source
98
47.6k
    fn return_mode(&self) -> ReturnMode {
99
47.6k
        ReturnMode::NormalReturns
100
47.6k
    }
Unexecuted instantiation: <wasmer_compiler_cranelift::func_environ::FuncEnvironment as wasmer_compiler_cranelift::translator::func_environ::FuncEnvironment>::return_mode
101
102
    /// Set up the necessary preamble definitions in `func` to access the global variable
103
    /// identified by `index`.
104
    ///
105
    /// The index space covers both imported globals and globals defined by the module.
106
    ///
107
    /// Return the global variable reference that should be used to access the global and the
108
    /// WebAssembly type of the global.
109
    fn make_global(
110
        &mut self,
111
        func: &mut ir::Function,
112
        index: GlobalIndex,
113
    ) -> WasmResult<GlobalVariable>;
114
115
    /// Set up the necessary preamble definitions in `func` to access the linear memory identified
116
    /// by `index`.
117
    ///
118
    /// The index space covers both imported and locally declared memories.
119
    fn make_heap(&mut self, func: &mut ir::Function, index: MemoryIndex) -> WasmResult<ir::Heap>;
120
121
    /// Set up the necessary preamble definitions in `func` to access the table identified
122
    /// by `index`.
123
    ///
124
    /// The index space covers both imported and locally declared tables.
125
    fn make_table(&mut self, func: &mut ir::Function, index: TableIndex) -> WasmResult<ir::Table>;
126
127
    /// Set up a signature definition in the preamble of `func` that can be used for an indirect
128
    /// call with signature `index`.
129
    ///
130
    /// The signature may contain additional arguments needed for an indirect call, but the
131
    /// arguments marked as `ArgumentPurpose::Normal` must correspond to the WebAssembly signature
132
    /// arguments.
133
    ///
134
    /// The signature will only be used for indirect calls, even if the module has direct function
135
    /// calls with the same WebAssembly type.
136
    fn make_indirect_sig(
137
        &mut self,
138
        func: &mut ir::Function,
139
        index: SignatureIndex,
140
    ) -> WasmResult<ir::SigRef>;
141
142
    /// Set up an external function definition in the preamble of `func` that can be used to
143
    /// directly call the function `index`.
144
    ///
145
    /// The index space covers both imported functions and functions defined in the current module.
146
    ///
147
    /// The function's signature may contain additional arguments needed for a direct call, but the
148
    /// arguments marked as `ArgumentPurpose::Normal` must correspond to the WebAssembly signature
149
    /// arguments.
150
    ///
151
    /// The function's signature will only be used for direct calls, even if the module has
152
    /// indirect calls with the same WebAssembly type.
153
    fn make_direct_func(
154
        &mut self,
155
        func: &mut ir::Function,
156
        index: FunctionIndex,
157
    ) -> WasmResult<ir::FuncRef>;
158
159
    /// Translate a `call_indirect` WebAssembly instruction at `pos`.
160
    ///
161
    /// Insert instructions at `pos` for an indirect call to the function `callee` in the table
162
    /// `table_index` with WebAssembly signature `sig_index`. The `callee` value will have type
163
    /// `i32`.
164
    ///
165
    /// The signature `sig_ref` was previously created by `make_indirect_sig()`.
166
    ///
167
    /// Return the call instruction whose results are the WebAssembly return values.
168
    #[allow(clippy::too_many_arguments)]
169
    fn translate_call_indirect(
170
        &mut self,
171
        pos: FuncCursor,
172
        table_index: TableIndex,
173
        table: ir::Table,
174
        sig_index: SignatureIndex,
175
        sig_ref: ir::SigRef,
176
        callee: ir::Value,
177
        call_args: &[ir::Value],
178
    ) -> WasmResult<ir::Inst>;
179
180
    /// Translate a `call` WebAssembly instruction at `pos`.
181
    ///
182
    /// Insert instructions at `pos` for a direct call to the function `callee_index`.
183
    ///
184
    /// The function reference `callee` was previously created by `make_direct_func()`.
185
    ///
186
    /// Return the call instruction whose results are the WebAssembly return values.
187
0
    fn translate_call(
188
0
        &mut self,
189
0
        mut pos: FuncCursor,
190
0
        _callee_index: FunctionIndex,
191
0
        callee: ir::FuncRef,
192
0
        call_args: &[ir::Value],
193
0
    ) -> WasmResult<ir::Inst> {
194
0
        Ok(pos.ins().call(callee, call_args))
195
0
    }
Unexecuted instantiation: <_ as wasmer_compiler_cranelift::translator::func_environ::FuncEnvironment>::translate_call
Unexecuted instantiation: <_ as wasmer_compiler_cranelift::translator::func_environ::FuncEnvironment>::translate_call
196
197
    /// Translate a `memory.grow` WebAssembly instruction.
198
    ///
199
    /// The `index` provided identifies the linear memory to grow, and `heap` is the heap reference
200
    /// returned by `make_heap` for the same index.
201
    ///
202
    /// The `val` value is the requested memory size in pages.
203
    ///
204
    /// Returns the old size (in pages) of the memory.
205
    fn translate_memory_grow(
206
        &mut self,
207
        pos: FuncCursor,
208
        index: MemoryIndex,
209
        heap: ir::Heap,
210
        val: ir::Value,
211
    ) -> WasmResult<ir::Value>;
212
213
    /// Translates a `memory.size` WebAssembly instruction.
214
    ///
215
    /// The `index` provided identifies the linear memory to query, and `heap` is the heap reference
216
    /// returned by `make_heap` for the same index.
217
    ///
218
    /// Returns the size in pages of the memory.
219
    fn translate_memory_size(
220
        &mut self,
221
        pos: FuncCursor,
222
        index: MemoryIndex,
223
        heap: ir::Heap,
224
    ) -> WasmResult<ir::Value>;
225
226
    /// Translate a `memory.copy` WebAssembly instruction.
227
    ///
228
    /// The `index` provided identifies the linear memory to query, and `heap` is the heap reference
229
    /// returned by `make_heap` for the same index.
230
    #[allow(clippy::too_many_arguments)]
231
    fn translate_memory_copy(
232
        &mut self,
233
        pos: FuncCursor,
234
        src_index: MemoryIndex,
235
        src_heap: ir::Heap,
236
        dst_index: MemoryIndex,
237
        dst_heap: ir::Heap,
238
        dst: ir::Value,
239
        src: ir::Value,
240
        len: ir::Value,
241
    ) -> WasmResult<()>;
242
243
    /// Translate a `memory.fill` WebAssembly instruction.
244
    ///
245
    /// The `index` provided identifies the linear memory to query, and `heap` is the heap reference
246
    /// returned by `make_heap` for the same index.
247
    fn translate_memory_fill(
248
        &mut self,
249
        pos: FuncCursor,
250
        index: MemoryIndex,
251
        heap: ir::Heap,
252
        dst: ir::Value,
253
        val: ir::Value,
254
        len: ir::Value,
255
    ) -> WasmResult<()>;
256
257
    /// Translate a `memory.init` WebAssembly instruction.
258
    ///
259
    /// The `index` provided identifies the linear memory to query, and `heap` is the heap reference
260
    /// returned by `make_heap` for the same index. `seg_index` is the index of the segment to copy
261
    /// from.
262
    #[allow(clippy::too_many_arguments)]
263
    fn translate_memory_init(
264
        &mut self,
265
        pos: FuncCursor,
266
        index: MemoryIndex,
267
        heap: ir::Heap,
268
        seg_index: u32,
269
        dst: ir::Value,
270
        src: ir::Value,
271
        len: ir::Value,
272
    ) -> WasmResult<()>;
273
274
    /// Translate a `data.drop` WebAssembly instruction.
275
    fn translate_data_drop(&mut self, pos: FuncCursor, seg_index: u32) -> WasmResult<()>;
276
277
    /// Translate a `table.size` WebAssembly instruction.
278
    fn translate_table_size(
279
        &mut self,
280
        pos: FuncCursor,
281
        index: TableIndex,
282
        table: ir::Table,
283
    ) -> WasmResult<ir::Value>;
284
285
    /// Translate a `table.grow` WebAssembly instruction.
286
    fn translate_table_grow(
287
        &mut self,
288
        pos: FuncCursor,
289
        table_index: TableIndex,
290
        table: ir::Table,
291
        delta: ir::Value,
292
        init_value: ir::Value,
293
    ) -> WasmResult<ir::Value>;
294
295
    /// Translate a `table.get` WebAssembly instruction.
296
    fn translate_table_get(
297
        &mut self,
298
        builder: &mut FunctionBuilder,
299
        table_index: TableIndex,
300
        table: ir::Table,
301
        index: ir::Value,
302
    ) -> WasmResult<ir::Value>;
303
304
    /// Translate a `table.set` WebAssembly instruction.
305
    fn translate_table_set(
306
        &mut self,
307
        builder: &mut FunctionBuilder,
308
        table_index: TableIndex,
309
        table: ir::Table,
310
        value: ir::Value,
311
        index: ir::Value,
312
    ) -> WasmResult<()>;
313
314
    /// Translate a `table.copy` WebAssembly instruction.
315
    #[allow(clippy::too_many_arguments)]
316
    fn translate_table_copy(
317
        &mut self,
318
        pos: FuncCursor,
319
        dst_table_index: TableIndex,
320
        dst_table: ir::Table,
321
        src_table_index: TableIndex,
322
        src_table: ir::Table,
323
        dst: ir::Value,
324
        src: ir::Value,
325
        len: ir::Value,
326
    ) -> WasmResult<()>;
327
328
    /// Translate a `table.fill` WebAssembly instruction.
329
    fn translate_table_fill(
330
        &mut self,
331
        pos: FuncCursor,
332
        table_index: TableIndex,
333
        dst: ir::Value,
334
        val: ir::Value,
335
        len: ir::Value,
336
    ) -> WasmResult<()>;
337
338
    /// Translate a `table.init` WebAssembly instruction.
339
    #[allow(clippy::too_many_arguments)]
340
    fn translate_table_init(
341
        &mut self,
342
        pos: FuncCursor,
343
        seg_index: u32,
344
        table_index: TableIndex,
345
        table: ir::Table,
346
        dst: ir::Value,
347
        src: ir::Value,
348
        len: ir::Value,
349
    ) -> WasmResult<()>;
350
351
    /// Translate a `elem.drop` WebAssembly instruction.
352
    fn translate_elem_drop(&mut self, pos: FuncCursor, seg_index: u32) -> WasmResult<()>;
353
354
    /// Translate a `ref.null T` WebAssembly instruction.
355
    ///
356
    /// By default, translates into a null reference type.
357
    ///
358
    /// Override this if you don't use Cranelift reference types for all Wasm
359
    /// reference types (e.g. you use a raw pointer for `funcref`s) or if the
360
    /// null sentinel is not a null reference type pointer for your type. If you
361
    /// override this method, then you should also override
362
    /// `translate_ref_is_null` as well.
363
    fn translate_ref_null(&mut self, pos: FuncCursor, ty: HeapType) -> WasmResult<ir::Value>;
364
    // {
365
    //     let _ = ty;
366
    //     Ok(pos.ins().null(self.reference_type(ty)))
367
    // }
368
369
    /// Translate a `ref.is_null` WebAssembly instruction.
370
    ///
371
    /// By default, assumes that `value` is a Cranelift reference type, and that
372
    /// a null Cranelift reference type is the null value for all Wasm reference
373
    /// types.
374
    ///
375
    /// If you override this method, you probably also want to override
376
    /// `translate_ref_null` as well.
377
0
    fn translate_ref_is_null(
378
0
        &mut self,
379
0
        mut pos: FuncCursor,
380
0
        value: ir::Value,
381
0
    ) -> WasmResult<ir::Value> {
382
0
        let is_null = pos.ins().is_null(value);
383
0
        Ok(pos.ins().uextend(ir::types::I64, is_null))
384
0
    }
Unexecuted instantiation: <_ as wasmer_compiler_cranelift::translator::func_environ::FuncEnvironment>::translate_ref_is_null
Unexecuted instantiation: <_ as wasmer_compiler_cranelift::translator::func_environ::FuncEnvironment>::translate_ref_is_null
385
386
    /// Translate a `ref.func` WebAssembly instruction.
387
    fn translate_ref_func(
388
        &mut self,
389
        pos: FuncCursor,
390
        func_index: FunctionIndex,
391
    ) -> WasmResult<ir::Value>;
392
393
    /// Translate a `global.get` WebAssembly instruction at `pos` for a global
394
    /// that is custom.
395
    fn translate_custom_global_get(
396
        &mut self,
397
        pos: FuncCursor,
398
        global_index: GlobalIndex,
399
    ) -> WasmResult<ir::Value>;
400
401
    /// Translate a `global.set` WebAssembly instruction at `pos` for a global
402
    /// that is custom.
403
    fn translate_custom_global_set(
404
        &mut self,
405
        pos: FuncCursor,
406
        global_index: GlobalIndex,
407
        val: ir::Value,
408
    ) -> WasmResult<()>;
409
410
    /// Translate an `i32.atomic.wait` or `i64.atomic.wait` WebAssembly instruction.
411
    /// The `index` provided identifies the linear memory containing the value
412
    /// to wait on, and `heap` is the heap reference returned by `make_heap`
413
    /// for the same index.  Whether the waited-on value is 32- or 64-bit can be
414
    /// determined by examining the type of `expected`, which must be only I32 or I64.
415
    ///
416
    /// Returns an i32, which is negative if the helper call failed.
417
    fn translate_atomic_wait(
418
        &mut self,
419
        pos: FuncCursor,
420
        index: MemoryIndex,
421
        heap: ir::Heap,
422
        addr: ir::Value,
423
        expected: ir::Value,
424
        timeout: ir::Value,
425
    ) -> WasmResult<ir::Value>;
426
427
    /// Translate an `atomic.notify` WebAssembly instruction.
428
    /// The `index` provided identifies the linear memory containing the value
429
    /// to wait on, and `heap` is the heap reference returned by `make_heap`
430
    /// for the same index.
431
    ///
432
    /// Returns an i64, which is negative if the helper call failed.
433
    fn translate_atomic_notify(
434
        &mut self,
435
        pos: FuncCursor,
436
        index: MemoryIndex,
437
        heap: ir::Heap,
438
        addr: ir::Value,
439
        count: ir::Value,
440
    ) -> WasmResult<ir::Value>;
441
442
    /// Emit code at the beginning of every wasm loop.
443
    ///
444
    /// This can be used to insert explicit interrupt or safepoint checking at
445
    /// the beginnings of loops.
446
75.8k
    fn translate_loop_header(&mut self, _pos: FuncCursor) -> WasmResult<()> {
447
75.8k
        // By default, don't emit anything.
448
75.8k
        Ok(())
449
75.8k
    }
<wasmer_compiler_cranelift::func_environ::FuncEnvironment as wasmer_compiler_cranelift::translator::func_environ::FuncEnvironment>::translate_loop_header
Line
Count
Source
446
75.8k
    fn translate_loop_header(&mut self, _pos: FuncCursor) -> WasmResult<()> {
447
75.8k
        // By default, don't emit anything.
448
75.8k
        Ok(())
449
75.8k
    }
Unexecuted instantiation: <wasmer_compiler_cranelift::func_environ::FuncEnvironment as wasmer_compiler_cranelift::translator::func_environ::FuncEnvironment>::translate_loop_header
450
451
    /// Optional callback for the `FunctionEnvMutironment` performing this translation to maintain
452
    /// internal state or prepare custom state for the operator to translate
453
2.46M
    fn before_translate_operator(
454
2.46M
        &mut self,
455
2.46M
        _op: &Operator,
456
2.46M
        _builder: &mut FunctionBuilder,
457
2.46M
        _state: &FuncTranslationState,
458
2.46M
    ) -> WasmResult<()> {
459
2.46M
        Ok(())
460
2.46M
    }
<wasmer_compiler_cranelift::func_environ::FuncEnvironment as wasmer_compiler_cranelift::translator::func_environ::FuncEnvironment>::before_translate_operator
Line
Count
Source
453
2.46M
    fn before_translate_operator(
454
2.46M
        &mut self,
455
2.46M
        _op: &Operator,
456
2.46M
        _builder: &mut FunctionBuilder,
457
2.46M
        _state: &FuncTranslationState,
458
2.46M
    ) -> WasmResult<()> {
459
2.46M
        Ok(())
460
2.46M
    }
Unexecuted instantiation: <wasmer_compiler_cranelift::func_environ::FuncEnvironment as wasmer_compiler_cranelift::translator::func_environ::FuncEnvironment>::before_translate_operator
461
462
    /// Optional callback for the `FunctionEnvMutironment` performing this translation to maintain
463
    /// internal state or finalize custom state for the operator that was translated
464
2.46M
    fn after_translate_operator(
465
2.46M
        &mut self,
466
2.46M
        _op: &Operator,
467
2.46M
        _builder: &mut FunctionBuilder,
468
2.46M
        _state: &FuncTranslationState,
469
2.46M
    ) -> WasmResult<()> {
470
2.46M
        Ok(())
471
2.46M
    }
<wasmer_compiler_cranelift::func_environ::FuncEnvironment as wasmer_compiler_cranelift::translator::func_environ::FuncEnvironment>::after_translate_operator
Line
Count
Source
464
2.46M
    fn after_translate_operator(
465
2.46M
        &mut self,
466
2.46M
        _op: &Operator,
467
2.46M
        _builder: &mut FunctionBuilder,
468
2.46M
        _state: &FuncTranslationState,
469
2.46M
    ) -> WasmResult<()> {
470
2.46M
        Ok(())
471
2.46M
    }
Unexecuted instantiation: <wasmer_compiler_cranelift::func_environ::FuncEnvironment as wasmer_compiler_cranelift::translator::func_environ::FuncEnvironment>::after_translate_operator
472
473
    /// Get the type of the global at the given index.
474
    #[allow(dead_code)]
475
    fn get_global_type(&self, global_index: GlobalIndex) -> Option<WasmerType>;
476
477
    /// Push a local declaration on to the stack to track the type of locals.
478
    fn push_local_decl_on_stack(&mut self, ty: WasmerType);
479
480
    /// Push locals for a the params of a function on to the stack.
481
    fn push_params_on_stack(&mut self, function_index: LocalFunctionIndex);
482
483
    /// Get the type of the local at the given index.
484
    #[allow(dead_code)]
485
    fn get_local_type(&self, local_index: u32) -> Option<WasmerType>;
486
487
    /// Get the types of all the current locals.
488
    #[allow(dead_code)]
489
    fn get_local_types(&self) -> &[WasmerType];
490
491
    /// Get the type of the local at the given index.
492
    #[allow(dead_code)]
493
    fn get_function_type(&self, function_index: FunctionIndex) -> Option<&FunctionType>;
494
495
    /// Get the type of a function with the given signature index.
496
    #[allow(dead_code)]
497
    fn get_function_sig(&self, sig_index: SignatureIndex) -> Option<&FunctionType>;
498
}