Closed
Bug 1419781
Opened 7 years ago
Closed 7 years ago
wasmBinaryToText mistranslates a global export
Categories
(Core :: JavaScript Engine: JIT, defect, P3)
Core
JavaScript Engine: JIT
Tracking
()
RESOLVED
FIXED
mozilla59
Tracking | Status | |
---|---|---|
firefox59 | --- | fixed |
People
(Reporter: lth, Assigned: bbouvier)
References
Details
Attachments
(1 file)
971 bytes,
patch
|
lth
:
review+
|
Details | Diff | Splinter Review |
Input:
(module
(global (export "hi") i32 (i32.const 0)))
text->binary followed by binary->text:
(module
(global $global0 i32 (i32.const 0))
(export "hi" global0)
)
Observe the missing '$' in the export clause.
Updated•7 years ago
|
status-firefox59:
--- → affected
Priority: -- → P3
Reporter | ||
Comment 1•7 years ago
|
||
Something deeper is wrong here, maybe I don't understand the syntax properly. This can be parsed by wasmTextToBinary even though I thought it should not be:
(module
(global $global0 i32 (i32.const 0))
(export "hi" global0))
This cannot be converted:
(module
(global $global0 i32 (i32.const 0))
(export "hi" $global0))
This cannot be converted:
(module
(global $global33 i32 (i32.const 0))
(export "hi" global33))
This can:
(module
(global i32 (i32.const 0))
(export "hi" global0))
That is: (a) the label on the global is completely ignored and (b) the reference in the export clause is syntax, not a name.
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → INVALID
Assignee | ||
Comment 2•7 years ago
|
||
Congratulations, you've run into the "spaces are not meaningful" feature of our WAT parser! For instance, (module(globali32(i32.const0))(export"hi"global0)) is totally valid.
In the first example, (export "hi" global0)) is actually equivalent to (export "hi" global 0)), which is correct since there's one global which is indexed at 0.
In the second example, (export) used without the kind keyword will default to exporting a function, and if there's no function with index $global0, it won't work.
In the third example, (export "hi" global33)) is equivalent to (export "hi" global 33)), and there aren't 33 globals. What you want here is (export "hi" global $global33)).
In the fourth example, global at index 0 is exported.
Reporter | ||
Comment 3•7 years ago
|
||
(In reply to Benjamin Bouvier [:bbouvier] from comment #2)
> Congratulations, you've run into the "spaces are not meaningful" feature of
> our WAT parser!
I feel honored. Since you call it a "feature" I assume no bug has been filed? :-}
Thanks for the explanation, it makes sense now.
Assignee | ||
Comment 4•7 years ago
|
||
Assignee: lhansen → bbouvier
Status: RESOLVED → REOPENED
Attachment #8935034 -
Flags: review?(lhansen)
Resolution: INVALID → ---
Assignee | ||
Comment 5•7 years ago
|
||
> Since you call it a "feature" I assume no bug has been filed? :-}
We noticed it in the past, but didn't consider it critical; this path is only used for testing.
Reporter | ||
Comment 6•7 years ago
|
||
Comment on attachment 8935034 [details] [diff] [review]
render.patch
Review of attachment 8935034 [details] [diff] [review]:
-----------------------------------------------------------------
Oh, right. Excellent idea.
Attachment #8935034 -
Flags: review?(lhansen) → review+
Pushed by bbouvier@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/c5fced4aa8fd
Render a supplementary space when exporting a wasm global; r=lth
Comment 8•7 years ago
|
||
bugherder |
Status: REOPENED → RESOLVED
Closed: 7 years ago → 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
You need to log in
before you can comment on or make changes to this bug.
Description
•