Refactor stack IR / binary writer (NFC)#2250
Merged
aheejin merged 7 commits intoWebAssembly:masterfrom Jul 23, 2019
Merged
Conversation
Previously `StackWriter` and its subclasses had routines for all three modes (`Binaryen2Binary`, `Binaryen2Stack`, and `Stack2Binary`) within a single class. This splits routines for each in a separate class and also factors out binary writing into a separate class (`BinaryInstWriter`) so other classes can make use of it. The new classes are: - `BinaryInstWriter`: Binary instruction writer. Only responsible for emitting binary contents and no other logic - `BinaryenIRWriter`: Converts binaryen IR into something else - `BinaryenIRToBinaryWriter`: Writes binaryen IR to binary - `StackIRGenerator`: Converts binaryen IR to stack IR - `StackIRToBinaryWriter`: Writes stack IR to binary I didn't use the existing `***StackWriter` names because I couldn't exactly understand their meanings, but I can rename classes to resemble previous names if people suggest it.
kripken
approved these changes
Jul 22, 2019
Member
kripken
left a comment
There was a problem hiding this comment.
Very nice! Much better than before.
New names look good too.
Member
|
Looks like this CI problem is unrelated to your PR, I just saw it after I merged another green PR to master. It was green 2 days ago, but was red when it landed, so some CI infra change over the last day or so seems to be at fault, |
tlively
reviewed
Jul 23, 2019
Member
tlively
left a comment
There was a problem hiding this comment.
I think this organization looks much more robust 👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously
StackWriterand its subclasses had routines for all threemodes (
Binaryen2Binary,Binaryen2Stack, andStack2Binary) within asingle class. This splits routines for each in a separate class and
also factors out binary writing into a separate class
(
BinaryInstWriter) so other classes can make use of it.The new classes are:
BinaryInstWriter:Binary instruction writer. Only responsible for emitting binary
contents and no other logic
BinaryenIRWriter: Converts binaryen IR into something elseBinaryenIRToBinaryWriter: Writes binaryen IR to binaryStackIRGenerator: Converts binaryen IR to stack IRStackIRToBinaryWriter: Writes stack IR to binaryI didn't use the existing
***StackWriternames because I couldn'texactly understand their meanings, but I can rename classes to resemble
previous names if people suggest it.