Closed Bug 1812128 Opened 2 years ago Closed 2 years ago

WasmParser.js doesn't support WebAssembly GC proposal

Categories

(DevTools :: Debugger, defect, P3)

Firefox 111
defect

Tracking

(firefox115 fixed)

RESOLVED FIXED
115 Branch
Tracking Status
firefox115 --- fixed

People

(Reporter: bashorov, Assigned: yury)

References

(Blocks 2 open bugs)

Details

Attachments

(3 files)

Steps to reproduce:

Firefox devtools unable to decompile wasm file generated by Kotlin/Wasm

Actual results:

It shows "Error occured during wast conversion : Unknown type kind: -49"

Expected results:

Decompiled wasm binary

Component: Untriaged → Debugger
OS: Unspecified → All
Product: Firefox → DevTools
Hardware: Unspecified → All
Blocks: wasm-tools
Severity: -- → S3
Priority: -- → P3
No longer blocks: wasm-tools

It looks like the issue is in WasmParser.js not supporting the new types being introduced in the WebAssembly GC proposal.

I'm not sure if WasmParser.js is maintained anymore. It may make sense to try to switch to a different library? The wasm team contributes to wasm-tools which has a Rust crate for converting bytecode to text. Maybe we could compile that crate to wasm and use that as a replacement in devtools?

Blocks: wasm-gc
Summary: Getting "Unknown type kind: -49" when trying to open wasm file generated by Kotlin/Wasm → WasmParser.js doesn't support WebAssembly GC proposal

(In reply to Ryan Hunt [:rhunt] from comment #1)

It looks like the issue is in WasmParser.js not supporting the new types being introduced in the WebAssembly GC proposal.

I'm not sure if WasmParser.js is maintained anymore. It may make sense to try to switch to a different library? The wasm team contributes to wasm-tools which has a Rust crate for converting bytecode to text. Maybe we could compile that crate to wasm and use that as a replacement in devtools?

The Chrome DevTools were using wasmparser.js at some point, and it is still in their codebase.

The main requirements for the bytecode-to-text library is to support mapping of bytecode offset to text lines (for debugging). I did not check if wasm-tools have this feature.

The Chrome DevTools were using wasmparser.js at some point, and it is still in their codebase.

AFAIK (at least inside source viewer/editor) they are using decompiler based on V8 internals.

Submitted https://github.com/wasdk/wasmparser/pull/133 with Wasm GC milestone 6 codes.

Assignee: nobody → ydelendik
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

Simple test that run something like:

(module
  (rec
    (type $t0  (struct (field f32)))
    (type $t1 (sub $t0 (struct (field f32) (field i32))))
  )

  (func $f0 (param (ref null $t0)) (result (ref null $t1))
    (ref.cast $t1
      (local.get 0)
    )
  )

  (func (export "main")
    (drop
      (call $f0
        (struct.new_default $t1)))
  )

)

(enable javascript.options.wasm_function_references javascript.options.wasm_gc)

Pushed by ydelendik@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2a4fdb257953 Update wasmparser.js to 5.6.0. r=devtools-reviewers,ochameau
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 115 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: