Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 6 additions & 1 deletion test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -3644,11 +3644,16 @@ def test_embind_tsgen_bigint(self):
self.run_process(args)
self.assertFileContents(test_file('other/embind_tsgen_bigint.d.ts'), read_file('embind_tsgen_bigint.d.ts'))

@parameterized({
'': [[]],
'pthread': [['-pthread']],
})
@requires_wasm64
def test_embind_tsgen_memory64(self):
def test_embind_tsgen_memory64(self, args):
# Check that when memory64 is enabled longs & unsigned longs are mapped to bigint in the generated TS bindings
self.run_process([EMXX, test_file('other/embind_tsgen_memory64.cpp'),
'-lembind', '--emit-tsd', 'embind_tsgen_memory64.d.ts', '-sMEMORY64'] +
args +
self.get_cflags())
self.assertFileContents(test_file('other/embind_tsgen_memory64.d.ts'), read_file('embind_tsgen_memory64.d.ts'))

Expand Down
10 changes: 7 additions & 3 deletions tools/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -2036,6 +2036,12 @@ def run_embind_gen(options, wasm_target, js_syms, extra_settings):
if basename == 'libembind.js':
settings.JS_LIBRARIES[i] = os.path.join(dirname, 'libembind_gen.js')
settings.MIN_NODE_VERSION = 160000 if settings.MEMORY64 else 150000
# The final version of the memory64 proposal is not implemented until node
# v24, so we need to lower it away in order to execute the binary at build
# time.
# TODO Remove lowering when emsdk version of node is >= 24 and just require it.
if settings.MEMORY64:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be == 1 there and below.

settings.MEMORY64 = 2
# Source maps haven't been generated yet and aren't needed to run embind_gen.
settings.LOAD_SOURCE_MAP = 0
outfile_js = in_temp('tsgen.js')
Expand All @@ -2045,9 +2051,7 @@ def run_embind_gen(options, wasm_target, js_syms, extra_settings):
# Build the flags needed by Node.js to properly run the output file.
node_args = []
if settings.MEMORY64:
# The final version of the memory64 proposal is not yet implemented in any
# shipping version of node, so we need to lower it away in order to
# execute the binary at built time.
# See comment above about lowering memory64.
building.run_wasm_opt(outfile_wasm, outfile_wasm, ['--memory64-lowering', '--table64-lowering'])
if settings.WASM_EXCEPTIONS:
node_args += shared.node_exception_flags(config.NODE_JS)
Expand Down