bytecodealliance / bytecodealliance/ComponentizeJS

Unable to call method on resource, works in Rust guest but not JS guest

未關閉
#148 4 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Rust
星號
391
分支
53
平均合併
3 天 5 小時
30 天內合併 PR
1

描述

I've got a bit of a challenging one here. It's hard to trace the issue because I don't have debug information available from SpiderMonkey (will traces from the engine be available via some debug mode at some point?)

I have a repro but it requires my toolchain. Shouldn't take long to set up:

1. Grab the latest `rune-cli` release from https://github.com/rune-runtime/rune/releases/tag/v0.1.11 (or use `curl -fsSL https://rune.sh/install.sh | bash` to install `rune` locally) -- I think you'll need a Mac for this for the time being.
2. Create a new directory, ie. `test` & cd into it
3. Run `rune new game --template cube-js` -- this will create a new Rune project in the current directory
4. Run `npm i`
5. Run `rune run`. Observe that the program crashes with [1]
7. In `game.js`, comment out line 194 and `rune run` again. Observe the program does not crash.

This invocation, `pipeline.getBindGroupLayout(0)` works in my Rust wasm32-wasip1 guest module (you can try it by doing `rune new game --template cube-rust`) Because of this, I believe there is a bug in ComponentizeJS. Without better debugging I can't say for certain.

If you need to debug the use of ComponentizeJS in my toolchain, you should refer to the module in `node_modules/@bytecodealliance/ComponentizeJS`, which is used by the `@rune-runtime/rollup-plugin-rune` Rollup plugin to build a wasm module for Rune.

[1]
```
Message: Game didn't initialize: error while executing at wasm backtrace:
0: 0x2f363 - !
1: 0x2f36c - !
2: 0x22ee52 - !
3: 0x7a8ac3 - !rune:runtime/guest#init

Caused by:
wasm trap: wasm `unreachable` instruction executed
Location: crates/rune/src/runtime/mod.rs:97
```

Guidance is appreciated. Thanks.

貢獻指南

這個儲存庫沒有索引到貢獻指南

研究方向

使用 `cube-js` 範本重現崩潰,並與正常運作的 `cube-rust` 範本比較,重點關注 `game.js` 第 194 行。接著檢查 `node_modules/@bytecodealliance/ComponentizeJS`、`@rune-runtime/rollup-plugin-rune` 整合,以及 `crates/rune/src/runtime/mod.rs:97` 回報的 trap。完成標準是 JavaScript guest 可以呼叫 `pipeline.getBindGroupLayout(0)`,且不會觸發 wasm `unreachable` trap。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
javascript, rust, wasm
領域
tooling
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
需要釐清
新手友好度
30/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。