Closed Bug 1249480 Opened 8 years ago Closed 6 years ago

Ensure that the order of signature definitions is preserved in WASM text files.

Categories

(Core :: JavaScript: WebAssembly, defect, P5)

defect

Tracking

()

RESOLVED WONTFIX

People

(Reporter: mbx, Assigned: mbx)

References

Details

Attachments

(1 file)

Currently, the list of function signatures is shared between declared and defined signatures. This is messing up signature indexing, for example the following example should not work:

(module (func (param i32)) (func (type 0))

"(func (param i32))" should not define an indexable signature, only (type ...) expressions should do that.
Blocks: wasm
Attached patch sig.patchSplinter Review
Attachment #8721077 - Flags: review?(luke)
Looking for feedback, WasmDeclaredSigBaseIndex stuff feels a bit messy.
Assignee: nobody → mbebenita
This patch keeps declared signatures in a separate list from the defined signatures and encodes references to them as |WasmDeclaredSigBaseIndex + index|. During resolution, any WasmRef that points to a declared signature (by testing if (index >= WasmDeclaredSigBaseIndex|), adds the declared signature to the defined list of signatures, or uses an existing index, thus maintaining the invariant that no two signatures in the defined signature list are alike.
Oops, I forgot about this patch, sorry!  I'm not sure I understand with comment 0 for why
  (module (func (param i32)) (func (type 0)))
shouldn't work.  In ml-proto, functions implicitly append and use a new signature and, since all signatures have indices, they would be accessible via (type 0).
Perhaps I'm not reading the spec right. I assumed that only explicitly defined types can be indexed explicitly. 

(module 
 (func (param i32)) 
 (func (type 0)) <-- I assumed this would be an error.
)
Well, since the s-expr language isn't really part of wasm proper (unless it later became the official text format), the "spec" is mostly "what ml-proto/host/parser.mly" does.  What it does is to append every signature to the 1 array of types.  The difference is that (type (func ..)) is an explicit declaration that always adds a new entry to the end of the list and (func (param ...) (result ...)) is an implicit declaration that attempts to reuse a previous entry if possible but, if not, it does add an entry to the list.  Only (type ...) allows you to name an entry but the names are purely optional labels for indices.
Comment on attachment 8721077 [details] [diff] [review]
sig.patch

Canceling based on my current understanding; feel free to re-request if I'm wrong.
Attachment #8721077 - Flags: review?(luke)
Michael, what do you think the way forward is, here?
Flags: needinfo?(mbebenita)
Priority: -- → P5
Per policy at https://wiki.mozilla.org/Bug_Triage/Projects/Bug_Handling/Bug_Husbandry#Inactive_Bugs. If this bug is not an enhancement request or a bug not present in a supported release of Firefox, then it may be reopened.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → INACTIVE
Status: RESOLVED → REOPENED
Resolution: INACTIVE → ---
Component: JavaScript Engine: JIT → Javascript: Web Assembly
Status: REOPENED → RESOLVED
Closed: 6 years ago6 years ago
Resolution: --- → WONTFIX
Flags: needinfo?(mbebenita)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: