Skip to content
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

WasmBinaryReader: Consistent internal naming #6812

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

sbc100
Copy link
Member

@sbc100 sbc100 commented Aug 5, 2024

For defined functions/globals/tables/memories use f1, t2, m3 etc.

This matches the longer names used for imports such as fimport$1, but keeps the names nice and short by avoiding the embedded dollar sign.

@sbc100 sbc100 requested a review from kripken August 5, 2024 22:42

;; CHECK-BIN-NODEBUG: (import "asm2wasm" "f64-rem" (func $fimport$2 (type $4) (param f64 f64) (result f64)))

;; CHECK-BIN-NODEBUG: (memory $0 4096 4096)
Copy link
Member

Choose a reason for hiding this comment

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

Do you know why these move all the way down to line 1837? That makes things harder to read.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is an auto-update, so no idea. @tlively ? Maybe this file was mistakenly manually updated at some point?

Copy link
Member

Choose a reason for hiding this comment

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

It's because the name of the memory changed from $0 to $m0. The auto update script matches input with output based on name, so when the name changes, the output moves to the bottom with the other unmatched output.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, that looks wrong, then - if the memory had a name $0, then it should stay $0?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds like a bug in the text parser maybe?

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, sorry, I'm still confused - can you connect it back to the original question? I agree that CHECK-BIN-NODEBUG does not preserve the name section, but why does that fact explain this PR's original form (before the workaround) moving line 84 all the way down to 1837?

Copy link
Member

Choose a reason for hiding this comment

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

I am guessing the renaming here somehow interacts with the auto-updater in a bad way, and my concern is that we can work around it here, but this PR modifies a great many tests, and maybe many of them will need such workarounds.

Copy link
Member Author

Choose a reason for hiding this comment

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

Re-reading #6812 (comment) is seems like the auto-updater can only inline stuff when the names match.

In cases like this when we have no names section, I think the only way to make the names match is to explicitly choose the same names that that auto-namer would choose. If you choose any other name then there won't be a match. Is that right @tlively ?

Copy link
Member

Choose a reason for hiding this comment

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

Right 👍

Copy link
Member

Choose a reason for hiding this comment

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

To make sure I follow, so it worked before because the automatic name was $N, and now to keep that working we need to pick $mN?

@sbc100
Copy link
Member Author

sbc100 commented Aug 6, 2024

Suspending work on this until #6813 lands

@sbc100 sbc100 marked this pull request as draft August 6, 2024 14:53
For defined functions/globals/tables/memories use `f1`, `t2`, `m3` etc.

This matches the longer names used for imports such as `fimport$1`, but
keeps the names nice and short by avoiding the embedded dollar sign.
@sbc100
Copy link
Member Author

sbc100 commented Aug 6, 2024

I'm curious what you think of the general direction here? Are these names important? Should the be short? Should they be only numbers in some cases or should we always use some kind of type prefix?

@tlively
Copy link
Member

tlively commented Aug 6, 2024

I think that short names with disambiguating prefixes sound useful 👍

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