Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ See docs/process.md for more on how version tagging works.

6.0.2 (in development)
----------------------
- The `GROWABLE_ARRAYBUFFERS` setting now defaults to 1, which means it will be
used when available. Note that this only affects programs that are built with
`ALLOW_MEMORY_GROWTH`, which is not enabled by default. (#27212)
- New `-sNODERAWSOCKETS` setting that backs the POSIX sockets API with real TCP
(`node:net`) and UDP (`node:dgram`) sockets on Node.js, with no `ws`, proxy
process, or pthreads required. Supports incoming and outgoing TCP, UDP, IPv6,
Expand Down
6 changes: 3 additions & 3 deletions site/source/docs/tools_reference/settings_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3404,13 +3404,13 @@ GROWABLE_ARRAYBUFFERS
Enable support for growable views of Wasm memory. This is a recent Web
platform feature that can make growing the Wasm memory more efficient,
especially in multi-threaded builds.
Setting this to 1 will auto-detect the presence of this API and use it
when available.
The default setting of 1 will auto-detect the presence of this API and use
it when available.
Setting this to 2 will unconditionally require it. This is the only way
to completely remove the overhead of growable memory + pthreads.
This settings does nothing unless ALLOW_MEMORY_GROWTH is set.

Default value: 0
Default value: 1

.. _cross_origin:

Expand Down
6 changes: 3 additions & 3 deletions src/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -2250,13 +2250,13 @@ var JS_BASE64_API = false;
// Enable support for growable views of Wasm memory. This is a recent Web
// platform feature that can make growing the Wasm memory more efficient,
// especially in multi-threaded builds.
// Setting this to 1 will auto-detect the presence of this API and use it
// when available.
// The default setting of 1 will auto-detect the presence of this API and use
// it when available.
// Setting this to 2 will unconditionally require it. This is the only way
// to completely remove the overhead of growable memory + pthreads.
// This settings does nothing unless ALLOW_MEMORY_GROWTH is set.
// [link]
var GROWABLE_ARRAYBUFFERS = 0;
var GROWABLE_ARRAYBUFFERS = 1;

// If the emscripten-generated program is hosted on separate origin then
// starting new pthread worker can violate CSP rules. Enabling
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_mem_O3_grow.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 4339,
"a.out.js.gz": 2132,
"a.out.js": 4386,
"a.out.js.gz": 2154,
"a.out.nodebug.wasm": 5261,
"a.out.nodebug.wasm.gz": 2419,
"total": 9600,
"total_gz": 4551,
"total": 9647,
"total_gz": 4573,
"sent": [
"a (emscripten_resize_heap)"
],
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_mem_O3_grow_standalone.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 3805,
"a.out.js.gz": 1869,
"a.out.js": 3852,
"a.out.js.gz": 1896,
"a.out.nodebug.wasm": 5641,
"a.out.nodebug.wasm.gz": 2659,
"total": 9446,
"total_gz": 4528,
"total": 9493,
"total_gz": 4555,
"sent": [
"args_get",
"args_sizes_get",
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_minimal_pthreads_memgrowth.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 7381,
"a.out.js.gz": 3643,
"a.out.js": 7552,
"a.out.js.gz": 3708,
"a.out.nodebug.wasm": 19064,
"a.out.nodebug.wasm.gz": 8804,
"total": 26445,
"total_gz": 12447,
"total": 26616,
"total_gz": 12512,
"sent": [
"a (memory)",
"b (exit)",
Expand Down
28 changes: 19 additions & 9 deletions tools/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,40 +101,50 @@ def set_config_from_tool_location(config_key, tool_binary, f):
exit_with_error('%s is set to empty value in %s', config_key, EM_CONFIG)


def expandvars(value):
if type(value) == list:
return [expandvars(v) for v in value]
return os.path.expandvars(value)


def parse_config_file():
"""Parse the emscripten config file using python's exec.

Also check EM_<KEY> environment variables to override specific config keys.
"""
config = {'__file__': EM_CONFIG}
config_text = utils.read_file(EM_CONFIG)
os.environ['EM_CONFIG_DIR'] = os.path.dirname(EM_CONFIG)
try:
exec(config_text, config)
except Exception as e:
exit_with_error('error in evaluating config file (%s): %s, text: %s', EM_CONFIG, e, config_text)

CONFIG_KEYS = (
'NODE_JS',
'NODE_JS_TEST',
'BINARYEN_ROOT',
'SPIDERMONKEY_ENGINE',
'V8_ENGINE',
'LLVM_ROOT',
'LLVM_ADD_VERSION',
'CLANG_ADD_VERSION',
'CLOSURE_COMPILER',
'JS_ENGINES',
'WASMER',
'WASMTIME',
'WASM_ENGINES',
'FROZEN_CACHE',
'CACHE',
'PORTS',
'COMPILER_WRAPPER',
)

TEST_KEYS = (
'NODE_JS_TEST',
'V8_ENGINE',
'SPIDERMONKEY_ENGINE',
'JS_ENGINES',
'WASMER',
'WASMTIME',
'WASM_ENGINES',
)

# Only propagate certain settings from the config file.
for key in CONFIG_KEYS:
for key in CONFIG_KEYS + TEST_KEYS:
env_var = 'EM_' + key
env_value = os.environ.get(env_var)
if env_value is not None:
Expand All @@ -148,7 +158,7 @@ def parse_config_file():
exit_with_error(f'environment variable {env_var} must be an absolute path: {env_value}')
globals()[key] = env_value
elif key in config:
globals()[key] = config[key]
globals()[key] = expandvars(config[key])


def read_config():
Expand Down
10 changes: 5 additions & 5 deletions tools/config_template.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# This file will be edited (the {{{ }}} things), and written to `.emscripten`
# when emscripten is first used and no config file is found.

# Note: If you put paths relative to the home directory, do not forget
# os.path.expanduser
# Note: Use can use environment variables in your settings, e.g. use `$HOME`
# for paths relative to the home directory. You can also use `$EM_CONFIG_DIR`
# for the directory where the config file lives.
#
# Any config setting <KEY> in this file can be overridden by setting the
# EM_<KEY> environment variable. For example, settings EM_LLVM_ROOT override
Expand Down Expand Up @@ -34,9 +35,8 @@
#
# JS_ENGINES = [NODE_JS_TEST] # add V8_ENGINE or SPIDERMONKEY_ENGINE if you have them installed too.
#
# import os
# WASMER = os.path.expanduser(os.path.join('~', '.wasmer', 'bin', 'wasmer'))
# WASMTIME = os.path.expanduser(os.path.join('~', 'wasmtime'))
# WASMER = '$HOME/.wasmer/bin/wasmer'
# WASMTIME = '$HOME/wasmtime'
#
# Wasm engines to use in STANDALONE_WASM tests.
#
Expand Down
2 changes: 2 additions & 0 deletions tools/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -1752,6 +1752,8 @@ def get_full_import_name(name):
exit_with_error('wasm2js does not support WASM_BIGINT')
if settings.CAN_ADDRESS_2GB:
exit_with_error('wasm2js does not support >2gb address space')
# WASM2JS does not support GROWABLE_ARRAYBUFFERS at all
default_setting('GROWABLE_ARRAYBUFFERS', 0)

if settings.NODE_CODE_CACHING:
if settings.WASM_ASYNC_COMPILATION:
Expand Down