@@ -280,10 +280,8 @@ impl<'a> TrampolineCompiler<'a> {
280280 rets[ 0 ] = me. raise_if_negative_one_and_truncate ( rets[ 0 ] ) ;
281281 } )
282282 }
283- Trampoline :: ThreadSpawnIndirect { ty : _, table } => {
284- // TODO: eventually pass through the `ty` argument to check the
285- // table's funcref signature.
286- self . translate_thread_spawn_indirect ( * table)
283+ Trampoline :: ThreadSpawnIndirect { ty, table } => {
284+ self . translate_thread_spawn_indirect ( * ty, * table)
287285 }
288286 }
289287 }
@@ -1336,12 +1334,22 @@ impl<'a> TrampolineCompiler<'a> {
13361334 ) ;
13371335 }
13381336
1339- fn translate_thread_spawn_indirect ( & mut self , table : RuntimeTableIndex ) {
1337+ fn translate_thread_spawn_indirect (
1338+ & mut self ,
1339+ func_ty : TypeFuncIndex ,
1340+ table : RuntimeTableIndex ,
1341+ ) {
13401342 let args = self . builder . func . dfg . block_params ( self . block0 ) . to_vec ( ) ;
13411343 let vmctx = args[ 0 ] ;
13421344 let element = args[ 1 ] ;
13431345 let context = args[ 2 ] ;
13441346
1347+ // func_ty: u32
1348+ let func_ty = self
1349+ . builder
1350+ . ins ( )
1351+ . iconst ( ir:: types:: I32 , i64:: from ( func_ty. as_u32 ( ) ) ) ;
1352+
13451353 // table: u32
13461354 let table = self
13471355 . builder
@@ -1351,7 +1359,7 @@ impl<'a> TrampolineCompiler<'a> {
13511359 self . translate_intrinsic_libcall (
13521360 vmctx,
13531361 host:: thread_spawn_indirect,
1354- & [ vmctx, table, element, context] ,
1362+ & [ vmctx, func_ty , table, element, context] ,
13551363 TrapSentinel :: Falsy ,
13561364 ) ;
13571365 }
0 commit comments