Currently we have a primitive @wasm.memory_compare in the compiler however, there is no matching wasm instruction, and as such we bassically do this manually by generating the instructions needed. It may make more sense to move this into the runtime in the runtime/memory module, which is more inline with how we tend to handle this sort of thing especially as we move away from linear memory and towards wasm gc.
The advantages here:
- Less compiler complexity
- Easier to maintain
The dissadvantange of this change is there may be some slight overhead from the grain code vs raw wasm instructions but it should be negligable especially considering we don't use Memory.compare much in the runtime or stdlib anymore with the wasm gc change.
Currently we have a primitive
@wasm.memory_comparein the compiler however, there is no matching wasm instruction, and as such we bassically do this manually by generating the instructions needed. It may make more sense to move this into the runtime in theruntime/memorymodule, which is more inline with how we tend to handle this sort of thing especially as we move away from linear memory and towards wasm gc.The advantages here:
The dissadvantange of this change is there may be some slight overhead from the grain code vs raw wasm instructions but it should be negligable especially considering we don't use
Memory.comparemuch in the runtime or stdlib anymore with the wasm gc change.