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 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/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``). 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()``. 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): 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):