@@ -279,10 +279,8 @@ impl<'a> TrampolineCompiler<'a> {
279279 rets[ 0 ] = me. raise_if_negative_one_and_truncate ( rets[ 0 ] ) ;
280280 } )
281281 }
282- Trampoline :: ThreadSpawnIndirect { ty : _, table } => {
283- // TODO: eventually pass through the `ty` argument to check the
284- // table's funcref signature.
285- self . translate_thread_spawn_indirect ( * table)
282+ Trampoline :: ThreadSpawnIndirect { ty, table } => {
283+ self . translate_thread_spawn_indirect ( * ty, * table)
286284 }
287285 }
288286 }
@@ -1335,12 +1333,22 @@ impl<'a> TrampolineCompiler<'a> {
13351333 ) ;
13361334 }
13371335
1338- fn translate_thread_spawn_indirect ( & mut self , table : RuntimeTableIndex ) {
1336+ fn translate_thread_spawn_indirect (
1337+ & mut self ,
1338+ func_ty : TypeFuncIndex ,
1339+ table : RuntimeTableIndex ,
1340+ ) {
13391341 let args = self . builder . func . dfg . block_params ( self . block0 ) . to_vec ( ) ;
13401342 let vmctx = args[ 0 ] ;
13411343 let element = args[ 1 ] ;
13421344 let context = args[ 2 ] ;
13431345
1346+ // func_ty: u32
1347+ let func_ty = self
1348+ . builder
1349+ . ins ( )
1350+ . iconst ( ir:: types:: I32 , i64:: from ( func_ty. as_u32 ( ) ) ) ;
1351+
13441352 // table: u32
13451353 let table = self
13461354 . builder
@@ -1350,7 +1358,7 @@ impl<'a> TrampolineCompiler<'a> {
13501358 self . translate_intrinsic_libcall (
13511359 vmctx,
13521360 host:: thread_spawn_indirect,
1353- & [ vmctx, table, element, context] ,
1361+ & [ vmctx, func_ty , table, element, context] ,
13541362 TrapSentinel :: Falsy ,
13551363 ) ;
13561364 }
0 commit comments