Closed Bug 1522081 Opened 6 years ago Closed 6 years ago

Update memory.init and table.init encodings

Categories

(Core :: JavaScript: WebAssembly, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla66
Tracking Status
firefox66 --- fixed

People

(Reporter: lth, Assigned: lth)

References

Details

Attachments

(1 file)

The current spec puts the data/elem segment index before the target memory/table index, and makes both fields mandatory, and does not leave space for any flags. So we should rearrange the order in which we read the fields and we read them unconditionally. Otherwise there should be no functional change.

Spec: https://github.com/WebAssembly/bulk-memory-operations/blob/master/proposals/bulk-memory-operations/Overview.md#instruction-encoding

Attachment #9038484 - Flags: review?(jseward)

I should mention, this sits on top of my patch for bug 1521780.

Comment on attachment 9038484 [details] [diff] [review] bug1522081-encode-memory-and-table-init.patch Review of attachment 9038484 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/wasm/WasmTextToBinary.cpp @@ +6350,5 @@ > return EncodeExpr(e, s.dst()) && EncodeExpr(e, s.src()) && > EncodeExpr(e, s.len()) && > e.writeOp(s.isMem() ? MiscOp::MemInit : MiscOp::TableInit) && > + e.writeVarU32(s.segIndex()) && > + e.writeVarU32(s.target().index()); A query that's more about the spec than the implementation. From this patch it's obvious that the intended type of both fields is "varuint32". But the spec has memory.init = FC 08 segment:varuint32 memory:0x00 table.init = FC 0C segment:varuint32 table:0x00 and it's unclear (to me, at least) whether the value 0x00 uniquely implies a type of varuint32. How do we know for example that it isn't a uint8 ? I'd be happier if the spec indicated varuint32 for both fields.
Attachment #9038484 - Flags: review?(jseward) → review+

Good point. I'll ask for spec clarification.

Pushed by lhansen@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/f632c68b2052 Update instruction encodings for memory.init / table.init. r=jseward
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla66
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: