-
Notifications
You must be signed in to change notification settings - Fork 829
Description
Hiya! It seems like Binaryen doesn't currently optimize away passive data segments that have no corresponding memory.init instruction. This would be incredibly helpful for Grain, as the compiler wouldn't know what data segments could be removed until after linking, where we rely on Binaryen optimizations. This was not a huge issue for us before because we loaded string/binary data into memory via i64s, and so if a function were unused the data would be optimized away with it.
It's not necessarily easy to see, but I have a WIP Grain PR that moves over to data segments open here: grain-lang/grain#1330
The last failing test is a regression test for module size, which went up with this change because a number of strings are left in the resulting wasm.
Let me know if that makes sense and if there's any additional information I can provide.