emscripten-core / emscripten-core/emscripten

Directly export functions with i64 in parameter list

Aperta
#20,122 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
C++
Stelle
27.6k
Fork
3.6k
Merge medio
1g 6h
PR unite (30g)
109

Descrizione

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?)

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.