Skip to content

Fix hashing of a use of a name without the context/target for it #3601

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

Merged
merged 3 commits into from
Feb 24, 2021
Merged

Conversation

kripken
Copy link
Member

@kripken kripken commented Feb 24, 2021

Before this we would assert on hashing e.g. (br $x) by itself, without the
context so we recognized the name $x. Somehow that was not an issue
until delegate, we just happened to not hash such things. I believe I remember
that @aheejin noticed this issue before, but given we didn't have a testcase,
we deferred fixing it - now is the time, I guess, as with delegate it is easy to
get e.g. CodeFolding to hash a Try with a delegate.

Issue found by emscripten-core/emscripten#13485

@kripken kripken requested review from tlively and aheejin February 24, 2021 00:08
Comment on lines +353 to +354
static_assert(sizeof(Index) == sizeof(int32_t),
"wasm64 will need changes here");
Copy link
Member

Choose a reason for hiding this comment

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

Why is this?

Copy link
Member Author

Choose a reason for hiding this comment

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

The data structure here is std::map<Name, Index> internalNames; so I think the idea in the assertion is that wasm64 might need something bigger than an Index if it has over 2^32 names? I agree it should be clarified.

Copy link
Member

@aheejin aheejin left a comment

Choose a reason for hiding this comment

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

Thank you!

@kripken kripken merged commit 6656dfa into main Feb 24, 2021
@kripken kripken deleted the hashn branch February 24, 2021 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants