rustwasm / walrus

Walrus is a WebAssembly transformation library 🌊🐘
https://docs.rs/walrus
Apache License 2.0
405 stars 62 forks source link

Function Id or index changes after emittimg the wasm module #254

Open pavanmikkilineni opened 11 months ago

pavanmikkilineni commented 11 months ago

Summary

I modified an existing wasm module added new functions to it after emitting the wasm module. when i parse the wasm module again the function id changed how do i maintain same function id after emitting the wasm module

// Call instrument_exit, passing the original function's ID as an argument instrumented_function .func_body() .i32_const(function.id().index() as i32) .call(instrument_exit_function_id);

also the order of the function changed after emitting changes the id of the functions but i want id to same.