WebAssembly / WebAssembly/binaryen

Machine-generate instruction implementation code?

Open
#2,414 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
WebAssembly
Stars
8.6k
Forks
885
Avg merge
1d 19h
Merged PRs (30d)
69

Description

I think we can simplify the checklist of things to do for new instructions,

https://github.com/WebAssembly/binaryen/blob/master/Contributing.md#adding-support-for-new-instructions

We already generate the wast parser using a python script. We can do something similar for core C++ code, generating code for each of the items in that list, starting from a high level declarative format something like

{
  "classes": [
    {
      "name": "Binary",
      "fields": [
        { "name": "op", "type": "BinaryOp" },
        { "name": "left", "type": "Expression*" },
        { "name": "right", "type": "Expression*" }
      }
    }
  ]
}

Practically speaking, we can create the declaration file, then implement the items in that checklist one by one in separate PRs (no need for a single huge change).

Thoughts?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the “Adding support for new instructions” section in Contributing.md and reviewing the existing Python script that generates the wast parser. Determine whether a high-level declaration format and C++ code generation can cover the checklist incrementally. Done would require an agreed declaration format and a scoped implementation plan, since this issue is still seeking design feedback.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python, wasm
Domain
compilers, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.