From 9b275b24a96d152cbe14336d9f99d5efd8530bd1 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Sat, 27 Sep 2014 09:37:47 -0700 Subject: [PATCH 1/5] use f32 in other.test_simd --- tests/test_other.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_other.py b/tests/test_other.py index 5fb27c9e05b91..11c0863e76cac 100644 --- a/tests/test_other.py +++ b/tests/test_other.py @@ -2331,7 +2331,7 @@ def test_simd(self): simd_args += ['-bb-vectorize-vector-bits=128', '-force-vector-width=4'] self.clear() - Popen([PYTHON, EMCC, path_from_root('tests', 'linpack.c'), '-O2', '-s', 'SIMD=1', '-DSP', '--llvm-opts', str(simd_args)]).communicate() + Popen([PYTHON, EMCC, path_from_root('tests', 'linpack.c'), '-O2', '-s', 'SIMD=1', '-DSP', '--llvm-opts', str(simd_args), '-s', 'PRECISE_F32=1']).communicate() self.assertContained('Unrolled Single Precision', run_js('a.out.js')) def test_dependency_file(self): From 2f57b4b2ceca89c1558864891c58d553bc1f9270 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Sun, 28 Sep 2014 17:56:24 -0700 Subject: [PATCH 2/5] fix warning on EXPORTED_FUNCTIONS, and improve test --- emscripten.py | 4 +++- tests/test_core.py | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/emscripten.py b/emscripten.py index 0112bea1394f6..0ea37f706bbfc 100755 --- a/emscripten.py +++ b/emscripten.py @@ -932,7 +932,9 @@ def save_settings(): exported_implemented_functions.add(key) implemented_functions = set(metadata['implementedFunctions']) if settings['ASSERTIONS'] and settings.get('ORIGINAL_EXPORTED_FUNCTIONS'): - for requested in settings['ORIGINAL_EXPORTED_FUNCTIONS']: + original_exports = settings['ORIGINAL_EXPORTED_FUNCTIONS'] + if original_exports[0] == '@': original_exports = json.loads(open(original_exports[1:]).read()) + for requested in original_exports: if requested not in all_implemented and \ requested != '_malloc': # special-case malloc, EXPORTED by default for internal use, but we bake in a trivial allocator and warn at runtime if used in ASSERTIONS logging.warning('function requested to be exported, but not implemented: "%s"', requested) diff --git a/tests/test_core.py b/tests/test_core.py index 550198a99bddf..f42b0f67e0253 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -5982,20 +5982,22 @@ def test_exported_response(self): src = r''' #include #include + #include extern "C" { int other_function() { return 5; } } int main() { - printf("waka!\n"); + int x = EM_ASM_INT_V({ return Module._other_function() }); + printf("waka %d!\n", x); return 0; } ''' open('exps', 'w').write('["_main","_other_function"]') self.emcc_args += ['-s', 'EXPORTED_FUNCTIONS=@exps'] - self.do_run(src, '''waka!''') + self.do_run(src, '''waka 5!''') assert 'other_function' in open('src.cpp.o.js').read() def test_add_function(self): From 98018a8e79f4fc10ea6ab217bfbbba83e61b2d59 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Sun, 28 Sep 2014 20:47:29 -0700 Subject: [PATCH 3/5] note on 64-bit ints in ccall/cwrap; #2823 --- site/source/docs/api_reference/preamble.js.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/site/source/docs/api_reference/preamble.js.rst b/site/source/docs/api_reference/preamble.js.rst index 01dec9e4224a2..79bb6cc487db8 100644 --- a/site/source/docs/api_reference/preamble.js.rst +++ b/site/source/docs/api_reference/preamble.js.rst @@ -52,6 +52,7 @@ Calling compiled C functions from JavaScript :param ident: The name of the C function to be called. :param returnType: The return type of the function. This can be ``"number"``, ``"string"`` or ``"array"``, which correspond to the appropriate JavaScript types (use ``"number"`` for any C pointer, and ``"array"`` for JavaScript arrays and typed arrays; note that arrays are 8-bit), or for a void function it can be ``null`` (note: the JavaScript ``null`` value, not a string containing the word "null"). + .. note:: 64-bit integers become two 32-bit parameters, for the low and high bits (since 64-bit integers cannot be represented in JavaScript numbers). :param argTypes: An array of the types of arguments for the function (if there are no arguments, this can be omitted). Types are as in ``returnType``, except that ``array`` is not supported as there is no way for us to know the length of the array). :param args: An array of the arguments to the function, as native JavaScript values (as in ``returnType``). Note that string arguments will be stored on the stack (the JavaScript string will become a C string on the stack). :returns: The result of the function call as a native JavaScript value (as in ``returnType``). From b753171807fc38b747883b3749b8d71c5a3e3556 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jukka=20Jyl=C3=A4nki?= Date: Mon, 29 Sep 2014 15:08:36 +0300 Subject: [PATCH 4/5] Update documentation on the default state of --memory-init-file --- site/source/docs/tools_reference/emcc.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/source/docs/tools_reference/emcc.rst b/site/source/docs/tools_reference/emcc.rst index 9129c786f91bf..80bd6aded42f7 100644 --- a/site/source/docs/tools_reference/emcc.rst +++ b/site/source/docs/tools_reference/emcc.rst @@ -363,8 +363,8 @@ Options that are modified or new in *emcc* are listed below: ``--memory-init-file `` Specifies whether to emit a separate memory initialization file. Possible ``on`` values are: - - ``0``: Do not emit a separate memory initialization file (default). Instead keep the static initialization inside the generated JavaScript as text. - - ``1``: Emit a separate memory initialization file in binary format. This is more efficient than storing it as text inside JavaScript, but does mean you have another file to publish. The binary file will also be loaded asynchronously, which means ``main()`` will not be called until the file is downloaded and applied; you cannot call any C functions until it arrives. + - ``0``: Do not emit a separate memory initialization file. Instead keep the static initialization inside the generated JavaScript as text. This is the default setting if compiling with -O0 or -O1 link-time optimization flags. + - ``1``: Emit a separate memory initialization file in binary format. This is more efficient than storing it as text inside JavaScript, but does mean you have another file to publish. The binary file will also be loaded asynchronously, which means ``main()`` will not be called until the file is downloaded and applied; you cannot call any C functions until it arrives. This is the default setting when compiling with -O2 or higher. .. note:: The :ref:`safest way ` to ensure that it is safe to call C functions (the initialisation file has loaded) is to call a notifier function from ``main()``. From c40c7c218c3cfac5d832607733cf1cbc6ba47dab Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Mon, 29 Sep 2014 15:24:26 -0700 Subject: [PATCH 5/5] 1.25.0 --- emscripten-version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emscripten-version.txt b/emscripten-version.txt index 63fbeafc47eb3..cf1b8301402c6 100644 --- a/emscripten-version.txt +++ b/emscripten-version.txt @@ -1,2 +1,2 @@ -1.24.1 +1.25.0