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