bytecodealliance / bytecodealliance/ComponentizeJS
Unable to call method on resource, works in Rust guest but not JS guest
- Linguagem predominante
- Rust
- Estrelas
- 391
- Forks
- 53
- Merge médio
- 3d 5h
- PRs com merge (30d)
- 1
Descrição
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.
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Direção de pesquisa
Reproduza o crash com o template `cube-js` e compare-o com o template funcional `cube-rust`, com foco na linha 194 de `game.js`. Em seguida, inspecione `node_modules/@bytecodealliance/ComponentizeJS`, a integração de `@rune-runtime/rollup-plugin-rune` e o trap relatado em `crates/rune/src/runtime/mod.rs:97`. A tarefa estará concluída quando o guest JavaScript puder chamar `pipeline.getBindGroupLayout(0)` sem o trap wasm `unreachable`.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- javascript, rust, wasm
- Domínio
- tooling
- Tipo de issue
- Bug
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Status de atividade
- Estagnada
- Clareza
- Precisa de esclarecimento
- Facilidade para iniciantes
- 30/100