-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
export aliasee if not export all and if alias is exported #8295
Conversation
@kripken do you think this makes sense? we were trying to obtain the list of aliases by scanning the imports and using llvm to scan the BC files, but there was always some which cannot be obtained and the BC level. |
cc @awtcode |
I think this is right, yes. I thought we already handled it, though, but I'm not sure where. Please add a testcase - we need one anyhow, and it will also help understand things. |
@kripken added a test case |
tried to edit this such that it works from main_modules as well but it doesnt seem to work |
emscripten.py
Outdated
@@ -874,6 +874,17 @@ def get_exported_implemented_functions(all_exported_functions, all_implemented, | |||
if key in all_exported_functions or export_all or (export_bindings and key.startswith('_emscripten_bind')): | |||
funcs.add(key) | |||
|
|||
if not export_all: | |||
aliases = metadata['aliases'].keys() | |||
for key in all_exported_functions: |
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.
Is this outer loop needed? (all_exported_functions
may be very large, which worries me)
Instead, how about
for name, alias in metadata['aliases']:
if name in all_implemented:
funcs.add(alias)
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.
thats is actually to reduce the number of exports. we could just export all the alias like what you did, i think there arent many.
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.
thats also why its only run if not export_all, so there shouldnt be that many exports i hope.
tests/test_other.py
Outdated
text = re.sub(r'\$var\$*.', '', text) | ||
text = re.sub(r'param \$\d+', 'param ', text) | ||
text = re.sub(r' +', ' ', text) | ||
# print("text: %s" % text) |
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.
can we remove all the text parsing here? if it is enough to just test for success in running the program, that is simpler and better.
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.
sure let me do that.
I think that existing code (line 1609 you found) handles exporting from the asm.js module, but your new code here is still needed to have the functions in the final list of exports overall. To confirm, I assume the test fails without your code change? |
yes you are right. the test still fails without my code change. |
- export all aliases
strangely i see test which seem to fail which are unrelated to my change |
I think those errors can be ignored (should vanish with merging in latest incoming to here), except for |
@kripken seems like all tests passed after i did a merge from incoming |
Thanks @waterlike86, looks good! |
This test was testing a lot more than it needed to. This simple reproducer also exposes the same issue. Verified by temporarily reverting #8295.
This test was testing a lot more than it needed to. This simple reproducer also exposes the same issue. Verified by temporarily reverting #8295.
This test was testing a lot more than it needed to. This simple reproducer also exposes the same issue. Verified by temporarily reverting #8295.
…orted (emscripten-core#8295) This ensures that calls to aliases work.
This test was testing a lot more than it needed to. This simple reproducer also exposes the same issue. Verified by temporarily reverting emscripten-core#8295.
…s is exported (emscripten-core#8295)" This reverts commit dc90308.
…s is exported (emscripten-core#8295)" This reverts commit dc90308.
…orted (emscripten-core#8295) This ensures that calls to aliases work.
This test was testing a lot more than it needed to. This simple reproducer also exposes the same issue. Verified by temporarily reverting emscripten-core#8295.
we found that when using an exports list (i.e. not export_all), the side module imports the alias.
but just exporting the alias is not enough, we need to export the actual implementation as well (i.e. the aliasee, aliased)