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