Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Add support for snapshotting tables

Offen
#29 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
25/100
Issue-Typ
Feature
Klarheit
Muss geklärt werden
Aktivitätsstatus
Veraltet
Tech-Stack
rust, wasm
Bereich
devtools

Rechercherichtung

Beginne damit, Wizers im Issue beschriebenen Instrumentierungs- und Snapshotting-Pfade nachzuverfolgen; es werden keine Dateien oder Tests genannt. Ermittle, wie sich funcref-Identitäten über verknüpfte Instanzen hinweg darstellen lassen und wie importierte und WASI-Funktionen behandelt werden, wobei das Initialisierungsverhalten von externref erhalten bleibt. Erledigt ist die Aufgabe, wenn beide Tabellentypen mit abgedeckten module-linking-Fällen gesnapshottet werden können.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Right now there are two potential kinds of tables:

  • funcref tables
  • externref tables

The latter are easy to support, since Wasm can't construct an externref, only receive it from the outside world. As long as we don't allow any externrefs into the Wasm during initialization, then all we have to do is record the initialized size of these tables.

funcref tables are a little harder. Wasm can create funcrefs via the ref.func instruction. So we need a way to figure out which function each wasmtime::FuncRef in a table we are snapshotting is (i.e. what is the local function index of the ith table element?). wasmtime doesn't expose anything like that. I have an idea, however:

  • during Wizer's instrumentation phase:
    • add two new globals to the module: $wizer_getting_func_index and $wizer_func_index
    • add the following snippet to the start of every function in the module:
      block
        global.get $wizer_getting_func_index
        i32.eqz
        br_if 0
        i32.const <this function's local index>
        global.set $wizer_func_index
        unreachable
      end
      
  • then, during snapshotting, to get a given funcref's local function index, we set the $wizer_getting_func_index global non-zero, call the function, and then it will set its local function index to the $wizer_func_index global and trap.
  • the dummy functions we create for imports will need a similar dance, but implemented in native code rather than Wasm. Something similar for wasi functions too.

The one problem is that local function index isn't quite enough in the face of module linking. Instead we will need both the instance "id" (whatever that this; DFS index?) as well as the local function index in that instance. More to think about w.r.t. module linking here...

Vorherrschende Sprache
Rust
Sterne
1.1k
Forks
64
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus bytecodealliance/wizer

Alle Issues in bytecodealliance/wizer

Ähnliche Issues

Weitere Issues zu Rust

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.