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 d036a6b commit 0756139Copy full SHA for 0756139
wasm-utils/src/gas.rs
@@ -144,7 +144,11 @@ fn inject_inline_gas(module: elements::Module) -> elements::Module {
144
let global_gas_index = module.globals_space() as u32;
145
println!("total globals before injecting gas global: {:?}", global_gas_index);
146
147
- let b = builder::from_module(module);
+ let gas_func_index = module.functions_space() as u32;
148
+
149
+ let b = builder::from_module(module)
150
+ // the export is a workaround to add debug name "useGas"
151
+ .with_export(elements::ExportEntry::new("useGas".to_string(), elements::Internal::Function(gas_func_index)));
152
153
let mut b2 = b.global().mutable()
154
.value_type().i32().init_expr(elements::Instruction::I32Const(DEFAULT_START_GAS))
0 commit comments