@@ -957,21 +957,17 @@ var LibraryPThread = {
957
957
#if MEMORY64
958
958
// Calls proxyToMainThread but returns a bigint rather than a number
959
959
$proxyToMainThreadPtr__deps: ['$proxyToMainThread'],
960
- $proxyToMainThreadPtr: function() {
961
- return BigInt(proxyToMainThread.apply(null, arguments));
962
- },
960
+ $proxyToMainThreadPtr: (...args) => BigInt(proxyToMainThread(...args)),
963
961
#endif
964
962
965
963
$proxyToMainThread__deps: ['$withStackSave', '_emscripten_run_on_main_thread_js'].concat(i53ConversionDeps),
966
- $proxyToMainThread__docs: '/** @type{function(number, (number|boolean), ...( number|boolean) )} */',
967
- $proxyToMainThread: function (index, sync) {
964
+ $proxyToMainThread__docs: '/** @type{function(number, (number|boolean), ...number)} */',
965
+ $proxyToMainThread: (index, sync, ...callArgs) => {
968
966
// Additional arguments are passed after those two, which are the actual
969
967
// function arguments.
970
968
// The serialization buffer contains the number of call params, and then
971
969
// all the args here.
972
970
// We also pass 'sync' to C separately, since C needs to look at it.
973
- var numCallArgs = arguments.length - 2;
974
- var outerArgs = arguments;
975
971
// Allocate a buffer, which will be copied by the C code.
976
972
return withStackSave(() => {
977
973
// First passed parameter specifies the number of arguments to the function.
@@ -980,11 +976,11 @@ var LibraryPThread = {
980
976
// type info here). To do that, add a "prefix" before each value that
981
977
// indicates if it is a BigInt, which effectively doubles the number of
982
978
// values we serialize for proxying. TODO: pack this?
983
- var serializedNumCallArgs = numCallArgs {{{ WASM_BIGINT ? "* 2" : "" }}};
979
+ var serializedNumCallArgs = callArgs.length {{{ WASM_BIGINT ? "* 2" : "" }}};
984
980
var args = stackAlloc(serializedNumCallArgs * 8);
985
981
var b = {{{ getHeapOffset('args', 'i64') }}};
986
- for (var i = 0; i < numCallArgs ; i++) {
987
- var arg = outerArgs[2 + i];
982
+ for (var i = 0; i < callArgs.length ; i++) {
983
+ var arg = callArgs[ i];
988
984
#if WASM_BIGINT
989
985
if (typeof arg == 'bigint') {
990
986
// The prefix is non-zero to indicate a bigint.
0 commit comments