Skip to content

Runtime: Consider moving Memory.compare primitive into the runtime. #2375

@spotandjake

Description

@spotandjake

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No fields configured for Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions