Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Add support for snapshotting tables

Abierto
#29 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
25/100
Tipo de issue
Nueva funcionalidad
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
rust, wasm
Área
devtools

Línea de trabajo

Comienza rastreando las rutas de instrumentación y snapshotting de Wizer descritas en el issue; no se indican archivos ni tests. Determina cómo representar las identidades de funcref entre instancias enlazadas y cómo gestionar las funciones importadas y WASI, preservando el comportamiento de inicialización de externref. La tarea estará terminada cuando ambos tipos de tabla puedan capturarse en snapshots con los casos de module-linking cubiertos.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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...

Lenguaje dominante
Rust
Estrellas
1.1k
Forks
64
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de bytecodealliance/wizer

Todos los issues de bytecodealliance/wizer

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.