Skip to content

Commit 2a689a6

Browse files
committed
[emscripten] Remove -sWASM_BIGINT flag
This flag has been enabled by default in emscripten for a while now so I don't think we need this here anymore. The main user-visible effect of this change is that it makes the `module.i64.const` JS method now simply take a single bigint rather than a pair numbers.
1 parent 23f7af1 commit 2a689a6

File tree

3 files changed

+15
-19
lines changed

3 files changed

+15
-19
lines changed

CMakeLists.txt

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -297,21 +297,6 @@ else() # MSVC
297297
endif()
298298

299299
if(EMSCRIPTEN)
300-
# Note: to debug with DWARF you will usually want to enable BIGINT support, as
301-
# that helps avoid running Binaryen on the wasm after link. Binaryen's DWARF
302-
# rewriting has known limitations, so avoiding it during link is recommended
303-
# where possible (like local debugging).
304-
#
305-
# Note that this is debug info for Binaryen itself, that is, when you are
306-
# debugging Binaryen source code. This flag has no impact on what Binaryen
307-
# does when run on wasm files.
308-
option(ENABLE_BIGINT "Enable wasm BigInt support" OFF)
309-
if(ENABLE_BIGINT)
310-
add_link_flag("-sWASM_BIGINT")
311-
else()
312-
add_link_flag("-sWASM_BIGINT=0")
313-
endif()
314-
315300
if("${CMAKE_BUILD_TYPE}" MATCHES "Release")
316301
# Extra check that cmake has set -O3 in its release flags.
317302
# This is really as an assertion that cmake is behaving as we expect.

scripts/test/shared.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def is_exe(fpath):
195195
which('gcc') or which('clang'))
196196
NATIVEXX = (os.environ.get('CXX') or which('mingw32-g++') or
197197
which('g++') or which('clang++'))
198-
NODEJS = os.environ.get('NODE') or which('node') or which('nodejs')
198+
NODEJS = os.environ.get('NODE') or os.environ.get('EMSDK_NODE') or which('node') or which('nodejs')
199199
MOZJS = which('mozjs') or which('spidermonkey')
200200

201201
V8 = os.environ.get('V8') or which('v8') or which('d8')
@@ -264,9 +264,8 @@ def has_shell_timeout():
264264

265265
try:
266266
if NODEJS is not None:
267-
subprocess.check_call([NODEJS, '--version'],
268-
stdout=subprocess.PIPE,
269-
stderr=subprocess.PIPE)
267+
version = subprocess.check_output([NODEJS, '--version'])
268+
print(f'Using node ({NODEJS}) version: {version.strip()}')
270269
except (OSError, subprocess.CalledProcessError):
271270
NODEJS = None
272271
if NODEJS is None:

src/js/binaryen.js-post.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#preprocess
2+
13
// export friendly API methods
24
function preserveStack(func) {
35
try {
@@ -1090,12 +1092,22 @@ function wrapModule(module, self = {}) {
10901092
'store32'(offset, align, ptr, value, name) {
10911093
return preserveStack(() => Module['_BinaryenStore'](module, 4, offset, align, ptr, value, Module['i64'], strToStack(name)));
10921094
},
1095+
#if WASM_BIGINT
10931096
'const'(x, y) {
10941097
return preserveStack(() => {
10951098
const tempLiteral = stackAlloc(sizeOfLiteral);
10961099
Module['_BinaryenLiteralInt64'](tempLiteral, x, y);
10971100
return Module['_BinaryenConst'](module, tempLiteral);
10981101
});
1102+
#else
1103+
'const'(x) {
1104+
return preserveStack(() => {
1105+
assert(typeof x == 'bigint', 'i64.const requires a bigint');
1106+
const tempLiteral = stackAlloc(sizeOfLiteral);
1107+
Module['_BinaryenLiteralInt64'](tempLiteral, x);
1108+
return Module['_BinaryenConst'](module, tempLiteral);
1109+
});
1110+
#endif
10991111
},
11001112
'clz'(value) {
11011113
return Module['_BinaryenUnary'](module, Module['ClzInt64'], value);

0 commit comments

Comments
 (0)