Skip to content

Do we need to escape names in the names section? [not for landing] #2261

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

Closed
wants to merge 1 commit into from

Conversation

kripken
Copy link
Member

@kripken kripken commented Jul 25, 2019

@yurydelendik - see the code here. I don't see any tests fail with this change (here or in emscripten) which removes the escaping.

The benefit to the change is the names look normal in the wast ("foo()" instead of "foo\20\28"). This also helps with features like an asyncify whitelist/blacklist, which need to use internal function names.

What is the purpose of the escaping? I don't fully understand why it's there.

@yurydelendik
Copy link
Contributor

yurydelendik commented Jul 25, 2019

What is the purpose of the escaping? I don't fully understand why it's there.

The related PR can be found at #1646 . You also mentioned there, that the approach seems necessary as (call "quoted") is not valid wat.

Also (func $foo ... and (func "$foo" ... have too different meaning: former defines function with an id, the latter was exported function at some point, as I recall.

@kripken
Copy link
Member Author

kripken commented Jul 25, 2019

Thanks @yurydelendik! I remember now. Yeah, it does seem necessary, as you said back then and now :) Sadly it is making another feature I need (asyncify lists) harder...

Closing this, I'll figure something out.

@kripken kripken closed this Jul 25, 2019
@kripken kripken deleted the unescape branch July 25, 2019 16:19
kripken added a commit that referenced this pull request Jul 26, 2019
The blacklist means "functions here are to be ignored and not instrumented, we can assume they never unwind." The whitelist means "only these functions, and no others, can unwind." I had hoped such lists would not be necessary, since Asyncify's overhead is much smaller than the old Asyncify and Emterpreter, but as projects have noticed, the overhead to size and speed is still significant. The lists give power users a way to reduce any unnecessary overhead.

A slightly tricky thing is escaping of names: we escape names from the names section (see #2261 #1646). The lists arrive in human-readable format, so we escape them before comparing to the internal escaped names. To enable that I refactored wasm-binary a little bit to provide the escaping logic, cc @yurydelendik

If both lists are specified, an error is shown (since that is meaningless). If a name appears in a list that is not in the module, we show a warning, which will hopefully help people debug typos etc. I had hoped to make this an error, but the problem is that due to inlining etc. a single list will not always work for both unoptimized and optimized builds (a function may vanish when optimizing, due to duplicate function elimination or inlining).

Fixes #2218.
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