Skip to content
Merged
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
8 changes: 6 additions & 2 deletions test/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -4876,7 +4876,11 @@ def test_dylink_raii_exceptions(self):

@with_all_eh_sjlj
@with_dylink_reversed
def test_dylink_exceptions_try_catch(self):
@parameterized({
'': ([],),
'dyncalls': (['-sDYNCALLS'],),
})
def test_dylink_exceptions_try_catch(self, args):
self.dylink_test(main=r'''
#include <stdio.h>
extern void side();
Expand All @@ -4898,7 +4902,7 @@ def test_dylink_exceptions_try_catch(self):
printf("side: caught %.1f\n", f);
}
}
''', expected=['main: caught 3\nside: caught 5.3\n'])
''', expected=['main: caught 3\nside: caught 5.3\n'], cflags=args)

@with_all_eh_sjlj
@with_dylink_reversed
Expand Down
15 changes: 8 additions & 7 deletions tools/js_manipulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,19 @@ def isidentifier(name):


def make_dynCall(sig, args):
# wasm2c and asyncify are not yet compatible with direct wasm table calls
if settings.MEMORY64:
args = list(args)
args[0] = f'Number({args[0]})'
# wasm2c and asyncify are not yet compatible with direct wasm table calls so use
# the legacy DYNCALLS mechanism.
if settings.DYNCALLS or not is_legal_sig(sig):
args = ','.join(args)
if not settings.MAIN_MODULE and not settings.SIDE_MODULE:
# Optimize dynCall accesses in the case when not building with dynamic
# linking enabled.
return 'dynCall_%s(%s)' % (sig, args)
else:
return 'Module["dynCall_%s"](%s)' % (sig, args)
if settings.MAIN_MODULE or settings.SIDE_MODULE:
# In dynamic linking mode not all of the dynCall_xxx function are defined
# in the main module so might not be available as global symbols.
# See `registerDynCallSymbols` in `libdylink.js`.
return "dynCalls['%s'](%s)" % (sig, args)
return 'dynCall_%s(%s)' % (sig, args)
else:
call_args = ",".join(args[1:])
return f'getWasmTableEntry({args[0]})({call_args})'
Expand Down