-
Notifications
You must be signed in to change notification settings - Fork 824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose wasmer::{CraneliftOptLevel, LLVMOptLevel} #1894
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to rename this type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not strictly necessary, but with this rename we avoid naming collisions in the
wasmer::
high level API namespace. In the not too far future there is probablywasmer::OptimizationLevel
for the LLVM version, making it hard to reason about to which backends the types belong.The other option would be use have
pub use wasmer_compiler_cranelift::{Cranelift, OptLevel as CraneliftOptLevel};
, which gives uswasmer_compiler_cranelift::OptLevel
andwasmer::CraneliftOptLevel
. But in my opinion this creates more confusion than it helps.What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about this change.
You think is likely companies will use two compilers within the same codebase? This PR moves into prefixing all the public-facing objects of compilers with
CompilernameXXX
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, we do. I don't know much about other use cases. But even if they don't: the caller code
use wasmer::OptLevel;
should not refer to compiler X in one project and compiler Y in a different project, right?Right. It is based on the idea that you promoted recently: make all high level API available in the
wasmer::
namespace. This is a noble goal, but hard to get right. In #1730 we were fighting imports, #1872 documents a conflict now we have at least very similar names for multiple compilers.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's a good idea to rename
OptLevel
toCraneliftOptLevel
here, since we already have theCranelift
compiler. It makes sense and it avoids name clashing. Thoughts @syrusakbary @MarkMcCaskey @nlewycky and @jubianchi?@webmaster128 Could you extend this renaming to other compilers in this PR, so that it's consistent across the entire codebase please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So far this is the only new compiler-specific export in
wasmer::
:However, I now also added
LLVMOptLevel
to show the direction in which this is heading.