@@ -30,7 +30,7 @@ use self::{
30
30
use crate :: {
31
31
core:: { FuelCostsProvider , Typed , TypedVal } ,
32
32
engine:: {
33
- translator:: { Instr , LabelRef , LabelRegistry , WasmTranslator } ,
33
+ translator:: { utils :: FuelInfo , Instr , LabelRef , LabelRegistry , WasmTranslator } ,
34
34
BlockType ,
35
35
CompiledFuncEntity ,
36
36
TranslationError ,
@@ -235,6 +235,11 @@ impl FuncTranslator {
235
235
& self . engine
236
236
}
237
237
238
+ /// Returns `true` if fuel metering is enabled.
239
+ fn is_fuel_metering_enabled ( & self ) -> bool {
240
+ self . engine . config ( ) . get_consume_fuel ( )
241
+ }
242
+
238
243
/// Translates the end of a Wasm `block` control frame.
239
244
fn translate_end_block ( & mut self , frame : BlockControlFrame ) -> Result < ( ) , Error > {
240
245
if self . stack . is_control_empty ( ) {
@@ -245,6 +250,13 @@ impl FuncTranslator {
245
250
246
251
/// Translates the end of the Wasm function enclosing Wasm `block`.
247
252
fn translate_end_func ( & mut self , frame : BlockControlFrame ) -> Result < ( ) , Error > {
253
+ let fuel_info = match ( frame. consume_fuel_instr ( ) , & self . fuel_costs ) {
254
+ ( Some ( consume_fuel) , Some ( fuel_costs) ) => {
255
+ FuelInfo :: some ( fuel_costs. clone ( ) , consume_fuel)
256
+ }
257
+ ( None , None ) => FuelInfo :: None ,
258
+ _ => unreachable ! ( ) ,
259
+ } ;
248
260
todo ! ( )
249
261
}
250
262
0 commit comments