Avoid generating trampolines with --no-placeholders
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
Línea de trabajo
Comienza en src/ir/module-splitting.cpp, en las dos ubicaciones enlazadas, y revisa cómo wasm-split gestiona --no-placeholders. Investiga el número de trampolines y si Dart u otra información sobre la carga de módulos puede establecer el orden de dependencias. El trabajo se considera terminado cuando exista un contrato de entrada o de loader definido que permita de forma segura las reducciones de trampolines previstas.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
The wasm-split options --no-placeholders is used when the module loader can guarantee that secondary modules will be loaded before their functions are ever called. It currently has the effect of avoiding the creation of imported placeholder functions that are meant to lazily load secondary modules on demand, since these placeholders will never be run.
But we could also use the guarantee that the loader will have loaded modules before they are needed to avoid generating trampoline functions in many cases. We currently generate trampoline functions for two situations: 1) for secondary functions that are exported from the primary module (link), and 2) for secondary functions that are referenced from a different module (link).
For case 1), if modules are always loaded before they are needed, then exported secondary functions will never be called before their modules are loaded. We could therefore require the loader to append public secondary exports to the list of primary exports itself when it loads secondary modules rather than using a trampoline to provide the export from the primary module.
For case 2), we still need trampolines for secondary functions referenced from the primary module, since we cannot import those functions and we must have something to reference. But we might be able to avoid creating trampolines for secondary functions referenced from other secondary modules that we know will be loaded later. We would instead depend on the loader to append the exports from each loaded secondary module to the imports provided to the next, so later secondary modules could reference functions imported from earlier secondary modules directly.
The trouble here is knowing which secondary modules are "earlier" or "later" than others so we know which trampolines we can elide. The most explicit way to know this would be to have the user pass in a module dependence graph, perhaps as part of the manifest file. Alternatively we could depend on other information provided by the user. For example, we could provide a flag to let the user assert that modules only reference functions from earlier modules, which would then allow us to unconditionally skip inserting trampolines.
@biggs0125, is it the case that Dart modules will only reference functions provided by earlier Dart modules? If not, would it be feasible to pass a module dependence graph to wasm-split to help it improve its codegen?
@aheejin, does this optimization sound useful to you? It might be worth doing some preliminary investigation to see how many trampolines we are generating and how many are exported from the primary module and imported into secondary modules.
- Lenguaje dominante
- WebAssembly
- Estrellas
- 8.6k
- Forks
- 885
- Merge medio
- 2 d 1 h
- PR fusionados (30 d)
- 70
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de WebAssembly/binaryen
-
Dificultad 2/5 Medio día Aptitud para principiantes 76/100
WebAssembly/binaryen#9018 · 3 comentarios ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 52/100
WebAssembly/binaryen#9123 ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
WebAssembly/binaryen#9122 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
WebAssembly/binaryen#9086 · 2 comentarios ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
WebAssembly/binaryen#9038 · 5 comentarios ·
Todos los issues de WebAssembly/binaryen
Issues similares
-
compiler/runtime
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
objectionary/eo#8869 · 1 comentario ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
EricSpencer00/Resilient#4824 · 1 comentario ·
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
objectionary/jeo-maven-plugin#1758 ·
-
generics
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100