@@ -279,10 +279,8 @@ impl<'a> TrampolineCompiler<'a> {
279
279
rets[ 0 ] = me. raise_if_negative_one_and_truncate ( rets[ 0 ] ) ;
280
280
} )
281
281
}
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)
286
284
}
287
285
}
288
286
}
@@ -1335,12 +1333,22 @@ impl<'a> TrampolineCompiler<'a> {
1335
1333
) ;
1336
1334
}
1337
1335
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
+ ) {
1339
1341
let args = self . builder . func . dfg . block_params ( self . block0 ) . to_vec ( ) ;
1340
1342
let vmctx = args[ 0 ] ;
1341
1343
let element = args[ 1 ] ;
1342
1344
let context = args[ 2 ] ;
1343
1345
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
+
1344
1352
// table: u32
1345
1353
let table = self
1346
1354
. builder
@@ -1350,7 +1358,7 @@ impl<'a> TrampolineCompiler<'a> {
1350
1358
self . translate_intrinsic_libcall (
1351
1359
vmctx,
1352
1360
host:: thread_spawn_indirect,
1353
- & [ vmctx, table, element, context] ,
1361
+ & [ vmctx, func_ty , table, element, context] ,
1354
1362
TrapSentinel :: Falsy ,
1355
1363
) ;
1356
1364
}
0 commit comments