RESOLVED DUPLICATE of bug 287432 287397
Regression: dart2wasm hello world no longer runs after upgrading JSC
https://bugs.webkit.org/show_bug.cgi?id=287397
Summary Regression: dart2wasm hello world no longer runs after upgrading JSC
Martin Kustermann
Reported 2025-02-10 04:23:56 PST
Created attachment 474174 [details] Regression: dart2wasm hello world no longer runs after upgrading JSC It seems somewhere between JSC 288804 and 289733 the attached sample stopped from working. JSC 288804 ``` % third_party/jsc/jsc $PWD/pkg/dart2wasm/bin/run_wasm.js -- $PWD/hello.mjs $PWD/hello.wasm -- hello ``` JSC 289733 ``` % third_party/jsc/jsc $PWD/pkg/dart2wasm/bin/run_wasm.js -- $PWD/hello.mjs $PWD/hello.wasm -- Error: CompileError: WebAssembly.Module doesn't parse at byte 2945: get_global import kind index 0 is non-import Stack: undefined ``` The wasm file contains: ``` ... 2714| (tag $tag0 (param (ref $#Top)) (param (ref $_StringStackTrace_35))) 2722| (global $global0 (ref $Array<_Type>) (array.new_fixed $Array<_Type> 0)) ... 2931| (global $global13 (ref $_InterfaceType) (i32.const 12) (i32.const 0) (i32.const 0) (i32.const 144) (global.get $global0) (struct.new $_InterfaceType)) 2949| ... ``` So it seems it doesn't like `global.get $global0` here.
Attachments
Regression: dart2wasm hello world no longer runs after upgrading JSC (24.74 KB, application/gzip)
2025-02-10 04:23 PST, Martin Kustermann
no flags
Radar WebKit Bug Importer
Comment 1 2025-02-10 08:21:40 PST
daniel_liu4
Comment 2 2025-02-10 10:15:05 PST
From the Wasm spec about Constant Expressions at https://webassembly.github.io/spec/core/valid/instructions.html#constant-expressions, constant expressions are only allowed to refer to imported globals. Thus, `(global.get $global0)` must refer to an imported value, since it is used in a constant expression for the definition of `global13`. It seems that V8 and SpiderMonkey aren't checking this right now, but this check should be present for spec compliance.
Martin Kustermann
Comment 3 2025-02-10 12:47:11 PST
From my understanding it's very intentional that the GC extension allows globals to be composed objects of other (previously defined) globals - allowing the creation of DAG like data structure in the globals section. I can see that there seems to be two different specs * https://webassembly.github.io/spec/core/valid/instructions.html#constant-expressions * https://webassembly.github.io/gc/core/valid/instructions.html#constant-expressions The ladder has a much longer "Constant Expression" section which says """ Currently, constant expressions occurring in globals are further constrained in that contained instructions are only allowed to refer to imported or previously defined globals. ... """ So the "or previously defined globals" is the key here.
Alexey Proskuryakov
Comment 4 2025-02-10 13:54:44 PST
*** This bug has been marked as a duplicate of bug 287432 ***
Note You need to log in before you can comment on or make changes to this bug.