-
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
Asyncify: Support for new add-list, and updates for binaryen list changes #11438
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
02bdb33
Update for binaryen asyncify add-list
kripken 5c35ce2
more [ci skip]
kripken 661a92e
wip [ci skip]
kripken 7ecc244
fix [ci skip]
kripken b799eaa
Merge remote-tracking branch 'origin/master' into asyncupdate
kripken 48ce736
changelog
kripken 7b9489f
Support old names for now
kripken 896dc4f
Merge remote-tracking branch 'origin/master' into asyncupdate
kripken f34b4f8
fix text
kripken File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include <assert.h> | ||
#include <stdio.h> | ||
#include <emscripten.h> | ||
|
||
int x = 0; | ||
|
||
struct Structy { | ||
virtual int virty() { | ||
if (x == 1337) return virty(); // don't inline me | ||
emscripten_sleep(1); | ||
return 42; | ||
} | ||
}; | ||
|
||
Structy y; | ||
|
||
__attribute__((noinline)) | ||
void virt() { | ||
if (x == 1337) { | ||
// don't inline me | ||
virt(); | ||
} | ||
Structy *z = &y; | ||
printf("virt: %d\n", z->virty()); // but the indirect call itself! | ||
} | ||
|
||
int main() { | ||
EM_ASM({ | ||
Module.counter = (Module.counter || 0) + 1; | ||
if (Module.counter > 10) throw "infinite loop due to asyncify bug?"; | ||
}); | ||
virt(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
virt: 42 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7862,22 +7862,22 @@ def test_asyncify_unused(self): | |
|
||
@parameterized({ | ||
'normal': ([], True), | ||
'blacklist_a': (['-s', 'ASYNCIFY_BLACKLIST=["foo(int, double)"]'], False), | ||
'blacklist_b': (['-s', 'ASYNCIFY_BLACKLIST=["bar()"]'], True), | ||
'blacklist_c': (['-s', 'ASYNCIFY_BLACKLIST=["baz()"]'], False), | ||
'whitelist_a': (['-s', 'ASYNCIFY_WHITELIST=["main","__original_main","foo(int, double)","baz()","c_baz","Structy::funcy()","bar()"]'], True), | ||
'whitelist_b': (['-s', 'ASYNCIFY_WHITELIST=["main","__original_main","foo(int, double)","baz()","c_baz","Structy::funcy()"]'], True), | ||
'whitelist_c': (['-s', 'ASYNCIFY_WHITELIST=["main","__original_main","foo(int, double)","baz()","c_baz"]'], False), | ||
'whitelist_d': (['-s', 'ASYNCIFY_WHITELIST=["foo(int, double)","baz()","c_baz","Structy::funcy()"]'], False), | ||
'whitelist_b_response': ([], True, '["main","__original_main","foo(int, double)","baz()","c_baz","Structy::funcy()"]'), | ||
'whitelist_c_response': ([], False, '["main","__original_main","foo(int, double)","baz()","c_baz"]'), | ||
'removelist_a': (['-s', 'ASYNCIFY_REMOVE_LIST=["foo(int, double)"]'], False), | ||
'removelist_b': (['-s', 'ASYNCIFY_REMOVE_LIST=["bar()"]'], True), | ||
'removelist_c': (['-s', 'ASYNCIFY_REMOVE_LIST=["baz()"]'], False), | ||
'onlylist_a': (['-s', 'ASYNCIFY_ONLY_LIST=["main","__original_main","foo(int, double)","baz()","c_baz","Structy::funcy()","bar()"]'], True), | ||
'onlylist_b': (['-s', 'ASYNCIFY_ONLY_LIST=["main","__original_main","foo(int, double)","baz()","c_baz","Structy::funcy()"]'], True), | ||
'onlylist_c': (['-s', 'ASYNCIFY_ONLY_LIST=["main","__original_main","foo(int, double)","baz()","c_baz"]'], False), | ||
'onlylist_d': (['-s', 'ASYNCIFY_ONLY_LIST=["foo(int, double)","baz()","c_baz","Structy::funcy()"]'], False), | ||
'onlylist_b_response': ([], True, '["main","__original_main","foo(int, double)","baz()","c_baz","Structy::funcy()"]'), | ||
'onlylist_c_response': ([], False, '["main","__original_main","foo(int, double)","baz()","c_baz"]'), | ||
}) | ||
@no_asan('asan is not compatible with asyncify stack operations; may also need to not instrument asan_c_load_4, TODO') | ||
@no_fastcomp('new asyncify only') | ||
def test_asyncify_lists(self, args, should_pass, response=None): | ||
if response is not None: | ||
create_test_file('response.file', response) | ||
self.emcc_args += ['-s', 'ASYNCIFY_WHITELIST[email protected]'] | ||
self.emcc_args += ['-s', 'ASYNCIFY_ONLY_LIST[email protected]'] | ||
self.set_setting('ASYNCIFY', 1) | ||
self.emcc_args += args | ||
try: | ||
|
@@ -7889,6 +7889,25 @@ def test_asyncify_lists(self, args, should_pass, response=None): | |
if should_pass: | ||
raise | ||
|
||
@parameterized({ | ||
'normal': ([], True), | ||
'ignoreindirect': (['-s', 'ASYNCIFY_IGNORE_INDIRECT'], False), | ||
'add': (['-s', 'ASYNCIFY_IGNORE_INDIRECT', '-s', 'ASYNCIFY_ADD_LIST=["main","virt()"]'], True), | ||
}) | ||
@no_asan('asan is not compatible with asyncify stack operations; may also need to not instrument asan_c_load_4, TODO') | ||
@no_fastcomp('new asyncify only') | ||
def test_asyncify_indirect_lists(self, args, should_pass): | ||
self.set_setting('ASYNCIFY', 1) | ||
self.emcc_args += args | ||
try: | ||
self.do_run_in_out_file_test('tests', 'core', 'test_asyncify_indirect_lists', assert_identical=True) | ||
if not should_pass: | ||
should_pass = True | ||
raise Exception('should not have passed') | ||
except Exception: | ||
if should_pass: | ||
raise | ||
|
||
@no_asan('asyncify stack operations confuse asan') | ||
@no_fastcomp('wasm-backend specific feature') | ||
def test_emscripten_scan_registers(self): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8931,7 +8931,7 @@ def test_emcc_parsing(self): | |
|
||
@no_fastcomp('uses new ASYNCIFY') | ||
def test_asyncify_escaping(self): | ||
proc = run_process([EMCC, path_from_root('tests', 'hello_world.c'), '-s', 'ASYNCIFY=1', '-s', "ASYNCIFY_WHITELIST=[DOS_ReadFile(unsigned short, unsigned char*, unsigned short*, bool)]"], stdout=PIPE, stderr=PIPE) | ||
proc = run_process([EMCC, path_from_root('tests', 'hello_world.c'), '-s', 'ASYNCIFY=1', '-s', "ASYNCIFY_ONLY_LIST=[DOS_ReadFile(unsigned short, unsigned char*, unsigned short*, bool)]"], stdout=PIPE, stderr=PIPE) | ||
self.assertContained('emcc: ASYNCIFY list contains an item without balanced parentheses', proc.stderr) | ||
self.assertContained(' DOS_ReadFile(unsigned short', proc.stderr) | ||
self.assertContained('Try to quote the entire argument', proc.stderr) | ||
|
@@ -8943,10 +8943,10 @@ def test_asyncify_response_file(self): | |
"DOS_ReadFile(unsigned short, unsigned char*, unsigned short*, bool)" | ||
] | ||
''') | ||
proc = run_process([EMCC, path_from_root('tests', 'hello_world.c'), '-s', 'ASYNCIFY=1', '-s', "ASYNCIFY_WHITELIST[email protected]"], stdout=PIPE, stderr=PIPE) | ||
proc = run_process([EMCC, path_from_root('tests', 'hello_world.c'), '-s', 'ASYNCIFY=1', '-s', "ASYNCIFY_ONLY_LIST[email protected]"], stdout=PIPE, stderr=PIPE) | ||
# we should parse the response file properly, and then issue a proper warning for the missing function | ||
self.assertContained( | ||
'Asyncify whitelist contained a non-matching pattern: DOS_ReadFile(unsigned short, unsigned char*, unsigned short*, bool)', | ||
'Asyncify onlylist contained a non-matching pattern: DOS_ReadFile(unsigned short, unsigned char*, unsigned short*, bool)', | ||
proc.stderr) | ||
|
||
# Sockets and networking | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I like these names :D