@@ -1966,41 +1966,42 @@ addToLibrary({
19661966 $setWasmTableEntry__internal : true ,
19671967 $setWasmTableEntry__deps : [ '$wasmTableMirror' , '$wasmTable' ] ,
19681968 $setWasmTableEntry : ( idx , func ) => {
1969- wasmTable . set ( idx , func ) ;
1969+ wasmTable . set ( { { { toIndexType ( ' idx' ) } } } , func ) ;
19701970 // With ABORT_ON_WASM_EXCEPTIONS wasmTable.get is overridden to return wrapped
19711971 // functions so we need to call it here to retrieve the potential wrapper correctly
19721972 // instead of just storing 'func' directly into wasmTableMirror
1973- wasmTableMirror [ idx ] = wasmTable . get ( idx ) ;
1973+ wasmTableMirror [ idx ] = wasmTable . get ( { { { toIndexType ( ' idx' ) } } } ) ;
19741974 } ,
19751975
19761976 $getWasmTableEntry__internal : true ,
19771977 $getWasmTableEntry__deps : [ '$wasmTableMirror' , '$wasmTable' ] ,
19781978 $getWasmTableEntry : ( funcPtr ) => {
19791979#if MEMORY64
1980- // Function pointers are 64-bit, but wasmTable.get() requires a Number.
1980+ // Function pointers should show up as numbers, even under wasm64, but
1981+ // we still have some places where bigint values can flow here.
19811982 // https://github.com/emscripten-core/emscripten/issues/18200
19821983 funcPtr = Number ( funcPtr ) ;
19831984#endif
19841985 var func = wasmTableMirror [ funcPtr ] ;
19851986 if ( ! func ) {
19861987 if ( funcPtr >= wasmTableMirror . length ) wasmTableMirror . length = funcPtr + 1 ;
1987- wasmTableMirror [ funcPtr ] = func = wasmTable . get ( funcPtr ) ;
1988+ wasmTableMirror [ funcPtr ] = func = wasmTable . get ( { { { toIndexType ( ' funcPtr' ) } } } ) ;
19881989#if ASYNCIFY == 2
19891990 if ( Asyncify . isAsyncExport ( func ) ) {
19901991 wasmTableMirror [ funcPtr ] = func = Asyncify . makeAsyncFunction ( func ) ;
19911992 }
19921993#endif
19931994 }
19941995#if ASSERTIONS && ASYNCIFY != 2 // With JSPI the function stored in the table will be a wrapper.
1995- assert ( wasmTable . get ( funcPtr ) == func , 'JavaScript-side Wasm function table mirror is out of date!' ) ;
1996+ assert ( wasmTable . get ( { { { toIndexType ( ' funcPtr' ) } } } ) == func , 'JavaScript-side Wasm function table mirror is out of date!' ) ;
19961997#endif
19971998 return func ;
19981999 } ,
19992000
20002001#else
20012002
20022003 $setWasmTableEntry__deps : [ '$wasmTable' ] ,
2003- $setWasmTableEntry : ( idx , func ) => wasmTable . set ( idx , func ) ,
2004+ $setWasmTableEntry : ( idx , func ) = > wasmTable . set ( { { { toIndexType ( ' idx' ) } } } , func ) ,
20042005
20052006 $getWasmTableEntry__deps : [ '$wasmTable' ] ,
20062007 $getWasmTableEntry : ( funcPtr ) => {
@@ -2391,9 +2392,9 @@ addToLibrary({
23912392#if RELOCATABLE
23922393 // In RELOCATABLE mode we create the table in JS.
23932394 $wasmTable : `=new WebAssembly.Table({
2394- 'initial': {{{ INITIAL_TABLE }}},
2395+ 'initial': {{{ toIndexType( INITIAL_TABLE) }}},
23952396#if !ALLOW_TABLE_GROWTH
2396- 'maximum': {{{ INITIAL_TABLE }}},
2397+ 'maximum': {{{ toIndexType( INITIAL_TABLE) }}},
23972398#endif
23982399#if MEMORY64 == 1
23992400 'index': 'i64',
0 commit comments