emscripten-core / emscripten-core/emscripten
Directly export functions with i64 in parameter list
- 主要言語
- C++
- スター
- 27.6k
- フォーク
- 3.6k
- 平均マージ
- 1日 14時間
- マージ済み PR(30日)
- 125
説明
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?)
コントリビューションガイド
調査の方向性
Binaryen の src/passes/LegalizeJSInterface.cpp から始め、exportOriginals オプションが Emscripten からどのように公開されているかを追跡します。コマンドラインで元の i64 エクスポートを保持できるか、また wasm-to-wasm 呼び出しに引き続き BigInts が関与するかを確認します。両方の質問に対する具体的な回答を提示できれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- cpp, wasm
- 領域
- compilers
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 25/100