File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
crates/wasmi/src/engine/translator/translator2 Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change 1
1
#![ expect( dead_code, unused_imports, unused_variables) ]
2
2
3
+ #[ macro_use]
4
+ mod utils;
3
5
mod instrs;
4
6
mod layout;
5
7
#[ cfg( feature = "simd" ) ]
6
8
mod simd;
7
9
mod stack;
8
- mod utils;
9
10
mod visit;
10
11
11
12
use self :: {
@@ -18,8 +19,10 @@ use crate::{
18
19
core:: FuelCostsProvider ,
19
20
engine:: {
20
21
translator:: { Instr , LabelRegistry , WasmTranslator } ,
22
+ BlockType ,
21
23
CompiledFuncEntity ,
22
24
} ,
25
+ ir:: Instruction ,
23
26
module:: { FuncIdx , ModuleHeader , WasmiValueType } ,
24
27
Engine ,
25
28
Error ,
@@ -143,15 +146,22 @@ impl FuncTranslator {
143
146
. then ( || config. fuel_costs ( ) )
144
147
. cloned ( ) ;
145
148
let FuncTranslatorAllocations {
146
- stack,
149
+ mut stack,
147
150
layout,
148
- labels,
149
- instrs,
151
+ mut labels,
152
+ mut instrs,
150
153
} = {
151
154
let mut alloc = alloc;
152
155
alloc. reset ( ) ;
153
156
alloc
154
157
} ;
158
+ let func_ty = module. get_type_of_func ( func) ;
159
+ let block_ty = BlockType :: func_type ( func_ty) ;
160
+ let end_label = labels. new_label ( ) ;
161
+ let consume_fuel = fuel_costs
162
+ . as_ref ( )
163
+ . map ( |_| instrs. push_instr ( Instruction :: consume_fuel ( 1 ) ) ) ;
164
+ stack. push_block ( block_ty, end_label, consume_fuel) ?;
155
165
Ok ( Self {
156
166
func,
157
167
engine,
You can’t perform that action at this time.
0 commit comments