diff --git a/emcc.py b/emcc.py index 426108b897191..ed8b03398e4ef 100755 --- a/emcc.py +++ b/emcc.py @@ -1714,6 +1714,9 @@ def do_minify(): # minifies the code. this is also when we do certain optimizati wasm_js = wasm_js.replace("Module['providedTotalMemory']", str(shared.Settings.TOTAL_MEMORY)) wasm_js = wasm_js.replace('Module["providedTotalMemory"]', str(shared.Settings.TOTAL_MEMORY)) wasm_js = wasm_js.replace('EMSCRIPTEN_', 'emscripten_') # do not confuse the markers + if shared.Settings.BINARYEN_METHOD: + wasm_js = wasm_js.replace("Module['wasmJSMethod']", '"' + shared.Settings.BINARYEN_METHOD + '"') # " or '? who knows :) + wasm_js = wasm_js.replace('Module["wasmJSMethod"]', '"' + shared.Settings.BINARYEN_METHOD + '"') js = open(js_target).read() combined = open(js_target, 'w') combined.write(wasm_js) @@ -1721,7 +1724,7 @@ def do_minify(): # minifies the code. this is also when we do certain optimizati combined.write(js) combined.close() # generate .wast file - subprocess.check_call([os.path.join(binaryen_bin, 'asm2wasm'), asm_target], stdout=open(wasm_target, 'w')) + subprocess.check_call([os.path.join(binaryen_bin, 'asm2wasm'), asm_target, wasm_target + '.mappedGlobals'], stdout=open(wasm_target, 'w')) # If we were asked to also generate HTML, do that if final_suffix == 'html': diff --git a/emscripten-version.txt b/emscripten-version.txt index 5a987baa05cbc..9afe4cb4f0e52 100644 --- a/emscripten-version.txt +++ b/emscripten-version.txt @@ -1,2 +1,2 @@ -"1.35.11" +"1.35.12" diff --git a/emscripten.py b/emscripten.py index 2dd5bb5cc97be..ca5bb24196dba 100755 --- a/emscripten.py +++ b/emscripten.py @@ -245,7 +245,9 @@ def save_settings(): mem_init)) if settings['SIDE_MODULE']: - pre = pre.replace('Runtime.GLOBAL_BASE', 'gb').replace('{{{ STATIC_BUMP }}}', str(staticbump)) + pre = pre.replace('Runtime.GLOBAL_BASE', 'gb') + if settings['SIDE_MODULE'] or settings['BINARYEN']: + pre = pre.replace('{{{ STATIC_BUMP }}}', str(staticbump)) funcs_js = [funcs] parts = pre.split('// ASM_LIBRARY FUNCTIONS\n') diff --git a/src/preamble.js b/src/preamble.js index a56009427fb35..df993f055fd71 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -1984,4 +1984,8 @@ if (!ENVIRONMENT_IS_PTHREAD) addOnPreRun(function() { if (!ENVIRONMENT_IS_PTHREAD) addOnPreRun(function() { if (typeof SharedArrayBuffer !== 'undefined') { addRunDependency('pthreads'); PThread.allocateUnusedWorkers({{{PTHREAD_POOL_SIZE}}}, function() { removeRunDependency('pthreads'); }); }}); #endif +#if BINARYEN +var STATIC_BUMP = {{{ STATIC_BUMP }}}; +#endif + // === Body === diff --git a/src/settings.js b/src/settings.js index 3350bcd5958af..d2ebc152858aa 100644 --- a/src/settings.js +++ b/src/settings.js @@ -616,6 +616,9 @@ var BINARYEN = ""; // Path to [Binaryen](https://github.com/WebAssembly/binaryen // This path should be to the root Binaryen directory (not the /bin subfolder). // You need to build Binaryen, so that /bin/wasm.js under the Binaryen // directory exists. +var BINARYEN_METHOD = ""; // Either 'asm2wasm', in which case we parse asm.js into wasm on the + // client, or 'wasm-s-parser' in which case we parse wasm s-expression + // code. var WASM = 0; // Older WebAssembly experiment. Compress the asm.js module into an early proposal for WebAssembly, // and ship a decompressor that runs on the client. diff --git a/tests/test_other.py b/tests/test_other.py index a13559b171997..30a3c61530345 100644 --- a/tests/test_other.py +++ b/tests/test_other.py @@ -2397,7 +2397,7 @@ def check_simd(self, expected_simds, expected_out): def test_autovectorize_linpack(self): Popen([PYTHON, EMCC, path_from_root('tests', 'linpack.c'), '-O2', '-s', 'SIMD=1', '-DSP', '-s', 'PRECISE_F32=1', '--profiling']).communicate() - self.check_simd(100, 'Unrolled Single Precision') + self.check_simd(30, 'Unrolled Single Precision') def test_autovectorize_bullet(self): Building.emcc(path_from_root('tests','bullet_hello_world.cpp'), ['-O2', '-s', 'SIMD=1', '-s', 'INLINING_LIMIT=1', '--llvm-lto', '2', '-s', 'USE_BULLET=1', '-profiling'], output_filename='a.out.js') diff --git a/tools/shared.py b/tools/shared.py index 9c77caeac45f2..5c266337b5d23 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -1543,8 +1543,8 @@ class ret: for line in output.split('\n'): if len(line) == 0: continue parts = filter(lambda seg: len(seg) > 0, line.split(' ')) - # pnacl-nm will print zero offsets for bitcode - if len(parts) == 3 and parts[0] == "00000000": + # pnacl-nm will print zero offsets for bitcode, and newer llvm-nm will print present symbols as -------- T name + if len(parts) == 3 and parts[0] in ["00000000", "--------"]: parts.pop(0) if len(parts) == 2: # ignore lines with absolute offsets, these are not bitcode anyhow (e.g. |00000630 t d_source_name|) status, symbol = parts