We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e4b98aa commit 0b769b0Copy full SHA for 0b769b0
wasm-utils/src/gas.rs
@@ -130,7 +130,11 @@ fn inject_inline_gas(module: elements::Module) -> elements::Module {
130
let global_gas_index = module.globals_space() as u32;
131
println!("total globals before injecting gas global: {:?}", global_gas_index);
132
133
- let b = builder::from_module(module);
+ let gas_func_index = module.functions_space() as u32;
134
+
135
+ let b = builder::from_module(module)
136
+ // the export is a workaround to add debug name "useGas"
137
+ .with_export(elements::ExportEntry::new("useGas".to_string(), elements::Internal::Function(gas_func_index)));
138
139
let mut b2 = b.global().mutable()
140
.value_type().i32().init_expr(elements::Instruction::I32Const(DEFAULT_START_GAS))
0 commit comments