Skip to content

Optimization: transform stack-based bytecode to a custom register-based bytecode #21

@rdunnington

Description

@rdunnington

Stack-based VMs have inherent performance limitations that are not present in register-based VMs. To reach or surpass performance of other WASM interpreters, bytebox will need to implement a register-based VM. Additionally, observing that most non-trivial programs have an obscene amount of locals and gets/sets to get around the stack limitations, a huge optimization would be to recognize most of these gets/sets as noops once they have register storage. To do this, we will need to:

  1. Translate WASM bytecode into a sea-of-nodes IR format.
  2. Run optimization passes eliding unnecessary get/set.
  3. Lower the IR to a register-based bytecode.
  4. Write a new VM capable of interpreting the new bytecode format.

This approach will also pave the way for JITing the register ops into native at some future point.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions