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

Wasm-opt not deduplicating repeated struct.gets on unchanged local

Abierto
#8,312 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
38/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
wasm
Área
compilers

Línea de trabajo

Empieza con wasm-opt y reproduce el patrón repetido de local.get/struct.get del issue. Sigue el comportamiento del optimizer para los locals que no cambian y determina dónde podrían reconocerse los struct.gets repetidos. Se considerará terminado cuando el patrón esté deduplicado, se preserve el flujo de control mostrado y se haya comprobado el impacto en el tamaño del código o el rendimiento.

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

Descripción

Consider the larger wasm snippet below. There are multiple instances of the same group of instructions:

local.get $var0
struct.get $#Top $field0

$var0 doesn't change between these struct.gets. I would expect wasm-opt to be able to identify this, do the lookup once and store it in a local prior to entering the block. This would save both code size and performance. We have some functions with hundreds of these patterns so the code size savings from this could be significant.

...
block $label1
  block $label0 (result (ref $#Top))
    local.get $var0
    br_on_non_null $label0
    local.get $var0
    global.get $C6307 SymbolConstant(#[]=)
    local.get $var4
    call $_typeArgumentsToList
    local.get $var3
    call $_positionalParametersToList
    local.get $var10
    call $_namedParametersToMap
    call $_Invocation.method
    call $NoSuchMethodError._throwWithInvocation
    unreachable
  end $label0
  local.tee $var0
  struct.get $#Top $field0
  i32.const 15
  i32.eq
  br_if $label1
  local.get $var0
  struct.get $#Top $field0
  i32.const 16
  i32.eq
  if
    local.get $var0
    ref.as_non_null
    local.get $var4
    local.get $var3
    global.get $C5979 WasmArray<Object>[0]
    call $__ConstMap&_HashFieldBase&MapMixin&_HashBase&_OperatorEqualsAndHashCode&_LinkedHashMapMixin&_MapCreateIndexMixin&_UnmodifiableMapMixin.[]= invocation type checker
    drop
    return
  end
  local.get $var0
  struct.get $#Top $field0
  i32.const 17
  i32.eq
  br_if $label1
  local.get $var0
  struct.get $#Top $field0
  i32.const 18
  i32.eq
  if
    local.get $var0
    ref.as_non_null
    local.get $var4
    local.get $var3
    global.get $C5979 WasmArray<Object>[0]
    i32.const 0
    call_indirect (param (ref $#Top) (ref $Array<_Type>) (ref $Array<Object?>) (ref $Array<Object?>)) (result (ref null $#Top)) $&
    drop
    return
  end
  local.get $var0
  struct.get $#Top $field0
  i32.const 51
  i32.eq
  if
    local.get $var0
    ref.as_non_null
    local.get $var4
    local.get $var3
    global.get $C5979 WasmArray<Object>[0]
    call $CrossappCacheStorage.[]= invocation type checker
    drop
    return
  end
...
Lenguaje dominante
WebAssembly
Estrellas
8.6k
Forks
892
Merge medio
1 d 18 h
PR fusionados (30 d)
79

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 WebAssembly/binaryen

Todos los issues de WebAssembly/binaryen

Issues similares

Más issues de Compilers

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.