emscripten-core / emscripten-core/emscripten
Directly export functions with i64 in parameter list
- Langage dominant
- C++
- Étoiles
- 27.6k
- Forks
- 3.6k
- Merge moyen
- 1 j 14 h
- PR mergées (30 j)
- 125
Description
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?)
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par src/passes/LegalizeJSInterface.cpp de Binaryen et suivez la manière dont l'option exportOriginals est exposée par Emscripten. Déterminez si la ligne de commande peut préserver les exports i64 d'origine et si les appels wasm-to-wasm impliquent toujours des BigInts ; le travail est terminé lorsqu'une réponse concrète est fournie à ces deux questions.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- cpp, wasm
- Domaine
- compilers
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 25/100