WebAssembly / WebAssembly/binaryen

Add APIs for introspection of imports

Open
#4,643 0 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

As of right now, the current outward facing API (C, JS/TS, etc) allows you to enumerate all exports in a WASM module. These can be further introspected to get more specific info about that export.

However, there is no affordance for this on imports. This means the only real option is to enumerate all functions and see if each function is an import, enumerate all tables, etc. This is less than ideal.

In addition, for some reason there doesn't appear to be any way to determine whether memory is imported or not through the exposed APIs. There is also some additional metadata that would be useful on a few different object types that you can't get through the exposed APIs, which is tracked here: https://github.com/WebAssembly/binaryen/issues/3573. There a PR that was opened for that a while back but it looks like work on it stalled out before being merged.

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 inspecting the outward-facing C and JS/TS APIs that currently enumerate exports, then compare how imported functions, tables, memories, and other objects are represented. The work is done when callers can introspect imports directly, determine whether memory is imported, and the additional metadata tracked in issue 3573 is accounted for.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, javascript, typescript, wasm
Domain
api, compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.