Closed Bug 1607440 Opened 4 years ago Closed 4 years ago

Create an `Opcode` abstraction and use it for text->binary translation

Categories

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

enhancement

Tracking

()

RESOLVED FIXED
mozilla74
Tracking Status
firefox74 --- fixed

People

(Reporter: lth, Assigned: lth)

References

Details

Attachments

(2 files)

The text->binary translator has acquired some hacks to deal with the multiple opcode spaces, notably there is now both ConversionOperator (which takes an Op opcode) and an ExtraConversionOperator (which takes a MiscOp opcode). This situation gets much worse with SIMD, which will want to reuse BinaryOperator, UnaryOperator, Load, Store, and others, and it's just generally annoying. In addition it is vaguely untype-safe because the Token stores the opcodes in an undiscriminated union; it is true that we check the token kind when we extract the opcode, but this is unsatisfying and will again get worse with SIMD.

Instead, introduce a new abstraction Opcode which can compactly represent all opcodes of all kinds as a single datum, and switch text->binary to use this everywhere. As a result, we can remove the ExtraConversionOperator and some of the writeOp() primitives.

The Opcode wraps an Op, and if the Op is a prefix it also
carries the secondary opcode bits. Implicit constructors from Op,
MiscOp, etc to Opcode, ensures that this will be pretty painless
to use.

Switch from Op/MiscOp/ThreadOp to just Opcode everywhere, and
get rid of methods that are no longer needed.

Remove the now-unnecessary ExtraConversionOperator node.

Depends on D58940

Attachment #9119083 - Attachment description: Bug 1607440 - Introduce the Opcode abstraction. r?bbouvier → Bug 1607440 - Introduce the Opcode abstraction. r=bbouvier
Attachment #9119084 - Attachment description: Bug 1607440 - Simplify text->binary conversion with Opcode. r?bbouvier → Bug 1607440 - Simplify text->binary conversion with Opcode. r=bbouvier
Pushed by lhansen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/ab08fd062f82
Introduce the Opcode abstraction.  r=bbouvier
https://hg.mozilla.org/integration/autoland/rev/1895e3498222
Simplify text->binary conversion with Opcode. r=bbouvier
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla74
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: