Skip to content

Commit

Permalink
enable binaryen async compilation only in wasm-only mode
Browse files Browse the repository at this point in the history
  • Loading branch information
kripken committed Jan 19, 2017
1 parent 1380d0f commit 038123f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 9 additions & 2 deletions emcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1291,9 +1291,16 @@ def check(input_file):
if opt_level > 0:
if 'BINARYEN_ASYNC_COMPILATION=0' not in settings_changes:
shared.Settings.BINARYEN_ASYNC_COMPILATION = 1
# async compilation requires a swappable module - we swap it in when it's ready
if shared.Settings.BINARYEN_ASYNC_COMPILATION == 1:
shared.Settings.SWAPPABLE_ASM_MODULE = 1
if shared.Building.is_wasm_only():
# async compilation requires a swappable module - we swap it in when it's ready
shared.Settings.SWAPPABLE_ASM_MODULE = 1
else:
# if not wasm-only, we can't do async compilation as the build can run in other
# modes than wasm (like asm.js) which may not support an async step
shared.Settings.BINARYEN_ASYNC_COMPILATION = 0
if 'BINARYEN_ASYNC_COMPILATION=1' in settings_changes:
logging.warning('BINARYEN_ASYNC_COMPILATION requested, but disabled since not in wasm-only mode')

# wasm outputs are only possible with a side wasm
if target.endswith(WASM_ENDINGS):
Expand Down
1 change: 1 addition & 0 deletions tests/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3307,6 +3307,7 @@ def test_binaryen_async(self):
(['-O3'], 1),
(['-s', 'BINARYEN_ASYNC_COMPILATION=1'], 1), # force it on
(['-O1', '-s', 'BINARYEN_ASYNC_COMPILATION=0'], 0), # force it off
(['-s', 'BINARYEN_ASYNC_COMPILATION=1', '-s', 'BINARYEN_METHOD="native-wasm,asmjs"'], 0), # try to force it on, but have it disabled
]:
print opts, expect
self.btest('binaryen_async.c', expected=str(expect), args=['-s', 'BINARYEN=1', '--shell-file', 'shell.html'] + opts)
Expand Down

0 comments on commit 038123f

Please sign in to comment.