Skip to content

machinst x64: refactor to use types::[type] everywhere#2088

Merged
abrown merged 1 commit intobytecodealliance:mainfrom
abrown:refactor-types
Aug 5, 2020
Merged

machinst x64: refactor to use types::[type] everywhere#2088
abrown merged 1 commit intobytecodealliance:mainfrom
abrown:refactor-types

Conversation

@abrown
Copy link
Member

@abrown abrown commented Aug 3, 2020

This change is a pure refactoring--no change to functionality. It removes use crate::ir::types::* imports and uses instead types::I32, e.g., throughout the x64 code. Though it increases code verbosity, this change makes it more clear where the type identifiers come from (they are generated by cranelif-codegen-meta so without a prefix it is difficult to find their origin), avoids IDE confusion (e.g. CLion flags the un-prefixed identifiers as errors), and avoids importing unwanted identifiers into the namespace.

@abrown abrown requested a review from cfallin August 3, 2020 23:14
@abrown abrown added the cranelift:area:x64 Issues related to x64 codegen label Aug 3, 2020
@github-actions github-actions bot added the cranelift Issues related to the Cranelift code generator label Aug 3, 2020
@github-actions
Copy link

github-actions bot commented Aug 3, 2020

Subscribe to Label Action

cc @bnjbvr

Details This issue or pull request has been labeled: "cranelift", "cranelift:area:x64"

Thus the following users have been cc'd because of the following labels:

  • bnjbvr: cranelift

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

Copy link
Member

@cfallin cfallin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, this seems reasonable. @julian-seward1 or @bnjbvr may have different opinions here, but (i) many of the locations this refactor touches were inconsistent in the first place (there were some ir::types::X as well as bare X instances), and (ii) IMHO, a little extra explicitness is good when it's not so much to be cumbersome. So, +1 from me. Thanks!

@abrown
Copy link
Member Author

abrown commented Aug 4, 2020

cc: @jlb6740

@abrown abrown requested a review from julian-seward1 August 4, 2020 18:53
@jlb6740
Copy link
Contributor

jlb6740 commented Aug 4, 2020

@abrown Thanks, agree with everything said. As @cfallin said .. the use of types:: prefix is inconsistent so this does improve on that. As you said it does increase verbosity which I think can sometimes reduce readability when it is too redundant, but maybe this allows ide's and the programming to have to parse and deal with less ambiguity. So pros and cons .. I personally wouldn't mind either way. Interested in what others prefer.

This change is a pure refactoring--no change to functionality. It removes `use crate::ir::types::*` imports and uses instead `types::I32`, e.g., throughout the x64 code. Though it increases code verbosity, this change makes it more clear where the type identifiers come from (they are generated by `cranelif-codegen-meta` so without a prefix it is difficult to find their origin), avoids IDE confusion (e.g. CLion flags the un-prefixed identifiers as errors), and avoids importing unwanted identifiers into the namespace.
@abrown
Copy link
Member Author

abrown commented Aug 5, 2020

I plan on merging this before it gets too out-of-date (especially since #2100 removes the x64 CI check--I ran the x64 tests locally on the rebased version and the unrebased commit already passed the x64 CI check).

@abrown abrown merged commit 4cb36af into bytecodealliance:main Aug 5, 2020
@abrown abrown deleted the refactor-types branch August 5, 2020 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cranelift:area:x64 Issues related to x64 codegen cranelift Issues related to the Cranelift code generator

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants