emscripten-core / emscripten-core/emscripten

Directly export functions with i64 in parameter list

Abierto
#20,122 4 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
C++
Estrellas
27.6k
Forks
3.6k
Merge medio
1 d 14 h
PR fusionados (30 d)
125

Descripción

I'm writing a dynamic recompiler that targets WebAssembly, and a particular problem that I have is that exported functions (i.e., callable from JavaScript) taking or receiving an i64 within their parameter lists are converted into ones that take in i32. I understand this is desirable behavior if you're calling from JS, but I'm curious if there's a way to expose these functions in their original state.

My use case is that the WASM modules that I create sometime need to call back into compiled C code to perform some complicated operation. In native code, this would be achieved by a direct call, but in the WASM world I need to use a function import (which are Emscripten's exports). The problem is that while Emscripten does in fact emit those functions in their original state, they aren't exported.

To my knowledge, this "legalization" is performed [here](https://github.com/WebAssembly/binaryen/blob/main/src/passes/LegalizeJSInterface.cpp), within Binaryen. Is there a way to control the `exportOriginals` option from the command line?

My questions are:
- Is this possible?
- Does this incur overhead? (even though the call is wasm-->wasm, does it force the creation of BigInts anyways?)

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza con src/passes/LegalizeJSInterface.cpp de Binaryen y sigue cómo se expone la opción exportOriginals desde Emscripten. Determina si la línea de comandos puede conservar las exportaciones i64 originales y si las llamadas wasm-to-wasm siguen implicando BigInts; se considera completado cuando se proporciona una respuesta concreta a ambas preguntas.

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

Evaluación

Stack tecnológico
cpp, wasm
Área
compilers
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.