@@ -3199,7 +3199,7 @@ addToLibrary({
31993199 $wasmTableMirror : [ ] ,
32003200
32013201 $setWasmTableEntry__internal : true ,
3202- $setWasmTableEntry__deps : [ '$wasmTableMirror' ] ,
3202+ $setWasmTableEntry__deps : [ '$wasmTableMirror' , '$wasmTable' ] ,
32033203 $setWasmTableEntry : ( idx , func ) => {
32043204 wasmTable . set ( idx , func ) ;
32053205 // With ABORT_ON_WASM_EXCEPTIONS wasmTable.get is overriden to return wrapped
@@ -3209,7 +3209,7 @@ addToLibrary({
32093209 } ,
32103210
32113211 $getWasmTableEntry__internal : true ,
3212- $getWasmTableEntry__deps : [ '$wasmTableMirror' ] ,
3212+ $getWasmTableEntry__deps : [ '$wasmTableMirror' , '$wasmTable' ] ,
32133213 $getWasmTableEntry : ( funcPtr ) => {
32143214#if MEMORY64
32153215 // Function pointers are 64-bit, but wasmTable.get() requires a Number.
@@ -3234,8 +3234,10 @@ addToLibrary({
32343234
32353235#else
32363236
3237+ $setWasmTableEntry__deps : [ '$wasmTable' ] ,
32373238 $setWasmTableEntry : ( idx , func ) => wasmTable . set ( idx , func ) ,
32383239
3240+ $getWasmTableEntry__deps : [ '$wasmTable' ] ,
32393241 $getWasmTableEntry : ( funcPtr ) => {
32403242#if MEMORY64
32413243 // Function pointers are 64-bit, but wasmTable.get() requires a Number.
@@ -3612,6 +3614,20 @@ addToLibrary({
36123614 $getNativeTypeSize__deps : [ '$POINTER_SIZE' ] ,
36133615 $getNativeTypeSize : { { { getNativeTypeSize } } } ,
36143616
3617+ #if RELOCATABLE
3618+ // In RELOCATABLE mode we create the table in JS.
3619+ $wasmTable : `=new WebAssembly.Table({
3620+ 'initial': {{{ INITIAL_TABLE }}},
3621+ #if !ALLOW_TABLE_GROWTH
3622+ 'maximum': {{{ INITIAL_TABLE }}},
3623+ #endif
3624+ 'element': 'anyfunc'
3625+ });
3626+ ` ,
3627+ #else
3628+ $wasmTable : undefined ,
3629+ #endif
3630+
36153631 // We used to define these globals unconditionally in support code.
36163632 // Instead, we now define them here so folks can pull it in explicitly, on
36173633 // demand.
0 commit comments