-
Notifications
You must be signed in to change notification settings - Fork 180
Add punycode encoding to v0 mangling #2535
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
Conversation
|
||
#define UNKNOWN_CREATENUM ((uint32_t) (0)) | ||
#define UNKNOWN_CRATENUM ((uint32_t) (UINT32_MAX)) | ||
#define UNKNOWN_NODEID ((uint32_t) (0)) |
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 changed this value because CrateNumItr is initialized to 0, which means a crate compiled first is treated as UNKNOWN_CRATENUM.
ref: #894
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.
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 am not sure but the same might be also true for UNKNOWN_NODEID, UNKNOWN_HIRID, etc.
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 changed this value because CrateNumItr is initialized to 0, which means a crate compiled first is treated as UNKNOWN_CRATENUM. ref: #894
I'm not a fan of putting special values, they should be treated as a completely separate thing (ehehe, rust habits I guess). For now I think this seems mostly ok. At least I can't think of a situation where it break in a realistic scenario. But in the future we might need to handle this properly.
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.
CrateNum field was added to CanonicalPath for the v0 mangling because the field is used as disambiguator in demangled symbols.
Actually CanonicalPath::get_crate_num
internally calls the following assert and fails here:
https://github.com/Rust-GCC/gccrs/blob/e55113ea2bf0cec2f8436a576ce6f2bcaacd1c27/gcc/rust/util/rust-canonical-path.h#L174C50-L174C50
So I have had to modify this value to avoid this assert failure.
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.
Here thats a good idea @tamaroning raise an issue to do the same with the other ID's
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 was reviewing this when I stumbled on thing I commented in a previous PR, this has'nt been rebased yet, hence my confusion. I'll review this again when conflicts will be fixed and the branch rebased. So far, there's not much to say, that's great work!
|
||
#define UNKNOWN_CREATENUM ((uint32_t) (0)) | ||
#define UNKNOWN_CRATENUM ((uint32_t) (UINT32_MAX)) | ||
#define UNKNOWN_NODEID ((uint32_t) (0)) |
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 changed this value because CrateNumItr is initialized to 0, which means a crate compiled first is treated as UNKNOWN_CRATENUM. ref: #894
I'm not a fan of putting special values, they should be treated as a completely separate thing (ehehe, rust habits I guess). For now I think this seems mostly ok. At least I can't think of a situation where it break in a realistic scenario. But in the future we might need to handle this properly.
bbbac30
to
19f07bc
Compare
@P-E-P Thank you for your review. Fixed and rebased on master |
94e5665
to
1266e97
Compare
@P-E-P |
I'm away for a few days. I'll let @CohenArthur review this PR. A brand new look on it can't be bad anyway. |
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.
Looks good! Good work @tamaroning :D
gcc/rust/ChangeLog: * backend/rust-mangle.cc (v0_add_identifier): Added punycode encoding (v0_mangle_item): Likewise. * lex/rust-lex.cc (assert_source_content): Change type (test_buffer_input_source): Change type (test_file_input_source): Change type * resolve/rust-ast-resolve-toplevel.h: fix typo * rust-session-manager.cc (Session::load_extern_crate): fix typo * util/rust-canonical-path.h: fix typo * util/rust-hir-map.cc (NodeMapping::get_error): fix typo (Mappings::Mappings): fix typo * util/rust-mapping-common.h (UNKNOWN_CREATENUM): fix typo (UNKNOWN_CRATENUM): Change 0 to UINT32_MAX Signed-off-by: Raiki Tamura <[email protected]>
1266e97
to
443619b
Compare
@CohenArthur Thanks for your review. fixed. |
Depends on #2533Please review the last commit
I manually checked the following cases for
add_v0_identifier
: