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

Add more support to extended names section. #1659

Merged
merged 1 commit into from
Apr 8, 2021
Merged

Add more support to extended names section. #1659

merged 1 commit into from
Apr 8, 2021

Conversation

sbc100
Copy link
Member

@sbc100 sbc100 commented Apr 7, 2021

I noticed we lacked support here while debugging #1651.

I noticed we lacked support here while debugging #1651.
@sbc100 sbc100 requested review from binji, aardappel and ngzhian and removed request for binji and aardappel April 7, 2021 17:53
Copy link
Member

@ngzhian ngzhian left a comment

Choose a reason for hiding this comment

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

LGTM, the repetition looks ripe for extracting into a helper, but can be done in a follow-up.

1 inline question on whether we want to add a test case.

@@ -1,6 +1,10 @@
;;; TOOL: run-roundtrip
;;; ARGS: --debug-names
;;; ARGS: --debug-names --enable-bulk-memory
Copy link
Member

Choose a reason for hiding this comment

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

Do we want a new test with this flag and the additions below? Otherwise we only test with this flag enabled.

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 reason I need to add this flag is that naming elem sections isn't possible without bulk memory enabled. If we added another test it would looks just the same but I couldn't include the elem section name (its a parse error without bulk memory).

WDYT, should add a the second (module duplicate) test? I'm happy to to if you think its worth it.

Copy link
Member

Choose a reason for hiding this comment

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

Ic, I can't imagine many cases where the duplicate case will be useful, since bulk-memory flag shouldn't affect the way we handle names for other sections. LGTM to not add a test. Thanks for explaining!

return Result::Ok;
}
if (index >= module_->tables.size()) {
PrintError("invalid table index: %" PRIindex, index);
Copy link
Member Author

Choose a reason for hiding this comment

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

Turns out that templatizing the error message here is not easy in C++... https://stackoverflow.com/questions/1826464/c-style-strings-as-template-arguments

I'll keep trying but will probably land as is and followup with a templetization.

Copy link
Member

Choose a reason for hiding this comment

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

Could we template on a typename T, then pass the entire string "Invalid table index: %" PRIindex as an arg, and maybe let some deduction/conversion happen?
Follow-up (with a TODO to indicate what we would like to do here) would be totally fine.

@sbc100 sbc100 merged commit 6e5684a into main Apr 8, 2021
@sbc100 sbc100 deleted the extended_names branch April 8, 2021 02:11
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.

2 participants