Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: emscripten-core/emscripten
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 157109533b04e4409ed7c48b0ba2e1df380de4d8
Choose a base ref
..
head repository: emscripten-core/emscripten
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 10033092929c48ae32618b83176a578ad78fe37b
Choose a head ref
Showing with 644 additions and 334 deletions.
  1. +6 −0 .circleci/config.yml
  2. +12 −1 ChangeLog.md
  3. +1 −1 Makefile
  4. +35 −0 bootstrap
  5. +86 −0 bootstrap.bat
  6. +66 −0 bootstrap.py
  7. +8 −0 emcc.py
  8. +1 −1 emscripten-version.txt
  9. +48 −11 site/source/docs/api_reference/val.h.rst
  10. +17 −5 site/source/docs/building_from_source/index.rst
  11. +2 −3 site/source/docs/compiling/Dynamic-Linking.rst
  12. +2 −2 site/source/docs/porting/simd.rst
  13. +26 −2 src/cpuprofiler.js
  14. +8 −4 src/embind/embind_ts.js
  15. +10 −12 src/generated_struct_info32.json
  16. +10 −12 src/generated_struct_info64.json
  17. +27 −23 src/library_browser.js
  18. +3 −3 src/library_pthread.js
  19. +20 −49 src/library_webgpu.js
  20. +3 −0 src/memoryprofiler.js
  21. +27 −31 src/parseTools.js
  22. +3 −0 src/parseTools_legacy.js
  23. +6 −8 src/struct_info.json
  24. +2 −2 system/include/emscripten/val.h
  25. +13 −26 system/include/webgpu/webgpu.h
  26. +11 −22 system/include/webgpu/webgpu_cpp.h
  27. +18 −38 system/lib/webgpu/webgpu_cpp.cpp
  28. +4 −4 test/code_size/hello_wasm_worker_wasm.json
  29. +4 −4 test/code_size/hello_webgl2_wasm.json
  30. +4 −4 test/code_size/hello_webgl2_wasm2js.json
  31. +4 −4 test/code_size/hello_webgl_wasm.json
  32. +4 −4 test/code_size/hello_webgl_wasm2js.json
  33. +13 −0 test/hello_world_argv.c
  34. +0 −29 test/hello_world_exit.c
  35. +7 −0 test/optimizer/JSDCE-defaultArg-output.js
  36. +9 −0 test/optimizer/JSDCE-defaultArg.js
  37. +3 −0 test/other/embind_tsgen.cpp
  38. +6 −0 test/other/embind_tsgen.d.ts
  39. +1 −1 test/other/metadce/test_metadce_cxx_except.size
  40. +1 −1 test/other/metadce/test_metadce_cxx_except_wasm.size
  41. +1 −1 test/other/metadce/test_metadce_cxx_mangle.size
  42. +1 −1 test/other/metadce/test_metadce_cxx_noexcept.size
  43. +1 −1 test/other/metadce/test_metadce_cxx_wasmfs.size
  44. +1 −1 test/other/metadce/test_metadce_files_wasmfs.size
  45. +1 −1 test/other/metadce/test_metadce_minimal_O0.jssize
  46. +1 −1 test/other/metadce/test_metadce_minimal_O1.jssize
  47. +1 −1 test/other/metadce/test_metadce_minimal_pthreads.size
  48. +1 −1 test/other/test_unoptimized_code_size.js.size
  49. +1 −1 test/other/test_unoptimized_code_size_no_asserts.js.size
  50. +10 −5 test/test_browser.py
  51. +2 −0 test/test_core.py
  52. +0 −1 test/test_emrun.c
  53. +9 −2 test/test_other.py
  54. +16 −0 test/test_sanity.py
  55. +4 −5 test/wasm_worker/wait32_notify.c
  56. +3 −3 test/wasm_worker/wait64_notify.c
  57. +1 −0 test/wasm_worker/wait64_notify.out
  58. +9 −1 tools/acorn-optimizer.js
  59. +2 −1 tools/install.py
  60. +1 −0 tools/maint/create_entry_points.py
  61. +47 −0 tools/maint/find_unused_test_files.py
6 changes: 6 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -57,6 +57,10 @@ commands:
# In order make our external version of emscripten use the emsdk
# config we need to explicitly set EM_CONFIG here.
echo "export EM_CONFIG=~/emsdk/.emscripten" >> $BASH_ENV
bootstrap:
description: "bootstrap"
steps:
- run: ./bootstrap
npm-install:
description: "npm ci"
steps:
@@ -156,6 +160,7 @@ commands:
echo "final .emscripten:"
cat ~/emsdk/.emscripten
- emsdk-env
- bootstrap
- npm-install
build-libs:
description: "Build all libraries"
@@ -214,6 +219,7 @@ commands:
name: submodule update
command: git submodule update --init
- emsdk-env
- bootstrap
- npm-install
- pip-install
upload-test-results:
13 changes: 12 additions & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
@@ -18,8 +18,17 @@ to browse the changes between the tags.

See docs/process.md for more on how version tagging works.

3.1.47 (in development)
3.1.48 (in development)
-----------------------
- A new top-level `bootstrap` script was added. This script is for emscripten
developers and helps take a care of post-checkout tasks such as `npm install`.
If this script needs to be run (e.g. becuase package.json was changed, emcc
will exit with an error. (#19736)
- `emscripten::val` now supports C++20 `co_await` operator for JavaScript
`Promise`s. (#20420)

3.1.47 - 10/09/23
-----------------
- The boost-headers port was updated to v1.83.0.
- The `noExitRuntime` global is now a JS library symbol that will only be
included as needed. User of `noExitRuntime` will now need to declare a
@@ -105,6 +114,7 @@ See docs/process.md for more on how version tagging works.
with the new `__i53abi` decorator. When this is set to true, i64 values are
automatically converted to JS numbers (i53) at the JS boundary. Parameters
outside of the i53 will show up as NaN in the JS code (#19711)
- EM_JS functions are now supported in side modules (#19705)

3.1.42 - 06/22/23
-----------------
@@ -350,6 +360,7 @@ See docs/process.md for more on how version tagging works.
occupy linear memory at all. The default for `DEFAULT_PTHREAD_STACK_SIZE` was
also reduced from 2MB to 64KB to match.
- Improved error messages for writing custom JS libraries. (#18266)
- EM_ASM code is now supported in side modules (#18228)

3.1.26 - 11/17/22
-----------------
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ dist: $(DISTFILE)
install:
@rm -rf $(DESTDIR)
./tools/install.py $(DESTDIR)
npm install --production --prefix $(DESTDIR)
npm install --omit=dev --prefix $(DESTDIR)

# Create an distributable archive of emscripten suitable for use
# by end users. This archive excludes node_modules as it can include native
35 changes: 35 additions & 0 deletions bootstrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/sh
# Copyright 2020 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
#
# Entry point for running python scripts on UNIX systems.
#
# Automatically generated by `create_entry_points.py`; DO NOT EDIT.
#
# To make modifications to this file, edit `tools/run_python.sh` and then run
# `tools/maint/create_entry_points.py`

# $PYTHON -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal
# of cpython used in cross compilation via setup.py.
unset _PYTHON_SYSCONFIGDATA_NAME

if [ -z "$PYTHON" ]; then
PYTHON=$EMSDK_PYTHON
fi

if [ -z "$PYTHON" ]; then
PYTHON=$(command -v python3 2> /dev/null)
fi

if [ -z "$PYTHON" ]; then
PYTHON=$(command -v python 2> /dev/null)
fi

if [ -z "$PYTHON" ]; then
echo 'unable to find python in $PATH'
exit 1
fi

exec "$PYTHON" -E "$0.py" "$@"
86 changes: 86 additions & 0 deletions bootstrap.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
:: Entry point for running python scripts on windows systems.
::
:: Automatically generated by `create_entry_points.py`; DO NOT EDIT.
::
:: To make modifications to this file, edit `tools/run_python.bat` and then run
:: `tools/maint/create_entry_points.py`

:: N.b. In Windows .bat scripts, the ':' character cannot appear inside any if () blocks,
:: or there will be a parsing error.

:: All env. vars specified in this file are to be local only to this script.
@setlocal
:: -E will not ignore _PYTHON_SYSCONFIGDATA_NAME an internal
:: of cpython used in cross compilation via setup.py.
@set _PYTHON_SYSCONFIGDATA_NAME=
@set EM_PY=%EMSDK_PYTHON%
@if "%EM_PY%"=="" (
set EM_PY=python
)

:: Work around Windows bug https://github.com/microsoft/terminal/issues/15212 : If this
:: script is invoked via enclosing the invocation in quotes via PATH lookup, then %~f0 and
:: %~dp0 expansions will not work.
:: So first try if %~dp0 might work, and if not, manually look up this script from PATH.
@if exist %~f0 (
set MYDIR=%~dp0
goto FOUND_MYDIR
)
@for %%I in (%~n0.bat) do (
@if exist %%~$PATH:I (
set MYDIR=%%~dp$PATH:I
) else (
echo Fatal Error! Due to a Windows bug, we are unable to locate the path to %~n0.bat.
echo To help this issue, try removing unnecessary quotes in the invocation of emcc,
echo or add Emscripten directory to PATH.
echo See github.com/microsoft/terminal/issues/15212 and
echo github.com/emscripten-core/emscripten/issues/19207 for more details.
)
)
:FOUND_MYDIR

:: Python Windows bug https://bugs.python.org/issue34780: If this script was invoked via a
:: shared stdin handle from the parent process, and that parent process stdin handle is in
:: a certain state, running python.exe might hang here. To work around this, if
:: EM_WORKAROUND_PYTHON_BUG_34780 is defined, invoke python with '< NUL' stdin to avoid
:: sharing the parent's stdin handle to it, avoiding the hang.

:: On Windows 7, the compiler batch scripts are observed to exit with a non-zero errorlevel,
:: even when the python executable above did succeed and quit with errorlevel 0 above.
:: On Windows 8 and newer, this issue has not been observed. It is possible that this
:: issue is related to the above python bug, but this has not been conclusively confirmed,
:: so using a separate env. var EM_WORKAROUND_WIN7_BAD_ERRORLEVEL_BUG to enable the known
:: workaround this issue, which is to explicitly quit the calling process with the previous
:: errorlevel from the above command.

:: Also must use goto to jump to the command dispatch, since we cannot invoke emcc from
:: inside a if() block, because if a cmdline param would contain a char '(' or ')', that
:: would throw off the parsing of the cmdline arg.
@if "%EM_WORKAROUND_PYTHON_BUG_34780%"=="" (
@if "%EM_WORKAROUND_WIN7_BAD_ERRORLEVEL_BUG%"=="" (
goto NORMAL
) else (
goto NORMAL_EXIT
)
) else (
@if "%EM_WORKAROUND_WIN7_BAD_ERRORLEVEL_BUG%"=="" (
goto MUTE_STDIN
) else (
goto MUTE_STDIN_EXIT
)
)

:NORMAL_EXIT
@"%EM_PY%" -E "%MYDIR%%~n0.py" %*
@exit %ERRORLEVEL%

:MUTE_STDIN
@"%EM_PY%" -E "%MYDIR%%~n0.py" %* < NUL
@exit /b %ERRORLEVEL%

:MUTE_STDIN_EXIT
@"%EM_PY%" -E "%MYDIR%%~n0.py" %* < NUL
@exit %ERRORLEVEL%

:NORMAL
@"%EM_PY%" -E "%MYDIR%%~n0.py" %*
66 changes: 66 additions & 0 deletions bootstrap.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/usr/bin/env python3
"""Bootstrap script for emscripten developers / git users.
After checking out emscripten there are certain steps that need to be
taken before it can be used. This script enumerates and automates
these steps and is able to run just the steps that are needed based
on the timestamps of various input files (kind of like a dumb version
of a Makefile).
"""
import argparse
import os
import shutil
import sys

__rootdir__ = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, __rootdir__)

STAMP_DIR = os.path.join(__rootdir__, 'out')

from tools import shared, utils

actions = [
('npm packages', 'package.json', [shutil.which('npm'), 'ci']),
# TODO(sbc): Remove the checked in entry point files and have them
# built on demand by this step.
('create entry points', 'tools/maint/create_entry_points.py', [sys.executable, 'tools/maint/create_entry_points.py']),
('git submodules', 'test/third_party/posixtestsuite/', [shutil.which('git'), 'submodule', 'update', '--init']),
]


def get_stamp_file(action_name):
return os.path.join(STAMP_DIR, action_name.replace(' ', '_') + '.stamp')


def check():
for name, filename, _ in actions:
stamp_file = get_stamp_file(name)
filename = utils.path_from_root(filename)
if not os.path.exists(stamp_file) or os.path.getmtime(filename) > os.path.getmtime(stamp_file):
utils.exit_with_error(f'emscripten setup is not complete ("{name}" is out-of-date). Run bootstrap.py to update')


def main(args):
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('-v', '--verbose', action='store_true', help='verbose', default=False)
parser.add_argument('-n', '--dry-run', action='store_true', help='dry run', default=False)
args = parser.parse_args()

for name, filename, cmd in actions:
stamp_file = get_stamp_file(name)
filename = utils.path_from_root(filename)
if os.path.exists(stamp_file) and os.path.getmtime(filename) <= os.path.getmtime(stamp_file):
print('Up-to-date: %s' % name)
continue
print('Out-of-date: %s' % name)
if args.dry_run:
print(' (skipping: dry run) -> %s' % ' '.join(cmd))
return
print(' -> %s' % ' '.join(cmd))
shared.run_process(cmd, cwd=utils.path_from_root())
utils.safe_ensure_dirs(STAMP_DIR)
utils.write_file(stamp_file, 'Timestamp file created by bootstrap.py')


if __name__ == '__main__':
main(sys.argv[1:])
8 changes: 8 additions & 0 deletions emcc.py
Original file line number Diff line number Diff line change
@@ -59,6 +59,14 @@

logger = logging.getLogger('emcc')

# In git checkouts of emscripten `bootstrap.py` exists to run post-checkout
# steps. In packaged versions (e.g. emsdk) this file does not exist (because
# it is excluded in tools/install.py) and these steps are assumed to have been
# run already.
if os.path.exists(utils.path_from_root('.git')) and os.path.exists(utils.path_from_root('bootstrap.py')):
import bootstrap
bootstrap.check()

# endings = dot + a suffix, compare against result of shared.suffix()
C_ENDINGS = ['.c', '.i']
CXX_ENDINGS = ['.cppm', '.pcm', '.cpp', '.cxx', '.cc', '.c++', '.CPP', '.CXX', '.C', '.CC', '.C++', '.ii']
2 changes: 1 addition & 1 deletion emscripten-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.47-git
3.1.48-git
Loading